Tuesday, December 27, 2011

Re: Many maps don't work well the the cursor is on the end of a line

Hi Yichao!

On So, 25 Dez 2011, Yichao Zhou wrote:

> In insert mode, I like emacs-like <Meta-d>, but I found that
> imap <M-d> <C-O>de
> does not work well then it is on the end of a line.
> So does
> imap <C-K> <C-G>u<C-O>D
>
> imap <M-d> _<Left><C-O>de
> works great, but the screen will blink since we insert a _ into the
> text.
>
> Any other advice?

try setting virtualedit=onemore

That should work better. Alternatively, use something like
imap <M-d> <C-G>u<C-\><C-O>D

That shouldn't move the cursor, when temporarily switching to normal
mode in your mapping.

> Also, I want to do the Visual-mode swapping (http://vim.wikia.com/wiki/
> Swapping_characters,_words_and_lines)
>
> vnoremap <C-X> <Esc>`.``gvP``P
>
> To use this mapping: first, delete some text (using any normal Vim
> command, such as daw, dt, in normal mode, x in visual mode). Then, use
> visual mode to select some other text, and press Ctrl-X. The two
> pieces of text should then be swapped.
>
> This map doesn't work great when first deleted text are on the end of
> text. Neither does the plugin visswap.

What is the problem with this mapping?

regards,
Christian
--

--
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

No comments:

Post a Comment