Tuesday, November 29, 2011

Re: Why I'm not switching to command mode?

After some retries I figure out command that does the thing I want:

snoremap <C-C> <ESC>gv"*ygv<ESC>

Few lessons learned:
1) if vnoremap is used I'm not able to return to command mode for some reason
2) first esc goes to command mode
3) gv restores selection and goes to the visual mode
4) "*y copies selection to windows clipboard
5) second gv<ESC> is used to go to command mode with preserving cursor position.

The question is - could this command be written easier?

-- Alexander


On Tue, Nov 29, 2011 at 1:02 PM, Alex Kostikov <alex.kostikov@gmail.com> wrote:
> I want Ctrl+C to copy selected text to clipboard and switch to command
> mode.
> The line bellow populates clipboard but doesn't do the switching to
> command mode. Why?
>
> vnoremap <C-c> "+y<ESC>
>
> -- Alexander
>
>

--
Alexander Kostikov

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