Tuesday, August 4, 2015

Re: Any automatic bracket-insertion plugins not breaking undo?

Jacob Niehus wrote:

> I would love to see this in mainline as well. I've been using it quite
> extensively for four months now with these maps to move the cursor
> left/right by word/WORD and to the first column, first non-blank, and
> last column without breaking undo:
>
> " Move cursor in insert mode without splitting undo
> inoremap <Left> <C-g>U<Left>
> inoremap <Right> <C-g>U<Right>
> inoremap <expr> <Home> col('.') == match(getline('.'), '\S') + 1 ?
> \ repeat('<C-g>U<Left>', col('.') - 1) :
> \ (col('.') < match(getline('.'), '\S') ?
> \ repeat('<C-g>U<Right>', match(getline('.'), '\S') + 0) :
> \ repeat('<C-g>U<Left>', col('.') - 1 - match(getline('.'), '\S')))
> inoremap <expr> <End> repeat('<C-g>U<Right>', col('$') - col('.'))
> imap <C-b> <Home>
> imap <C-e> <End>
>
> Here's an update to the patch that applies cleanly to Vim 7.4.803.

This appears to be OK to include. However, a test is missing.
Especially that using this at the end of the line, then a cursor-right
should work as before, because it moves to the next line.


--
You were lucky to have a LAKE! There were a hundred and sixty of
us living in a small shoebox in the middle of the road.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: