Friday, May 11, 2012

Re: Toggle paste and nonu in one keystroke

On Fri, May 11, 2012 at 2:25 PM, Christian Brabandt <cblists@256bit.org> wrote:
> This is way too complicated, :set allows to toggle values by itself
> (:h :set-!), so this should work:
>
> :nnoremap <f2> :set nu! paste!<cr>
>

Thanks, Christian, that is very helpful!

However I am having trouble with the Insert version. I am trying this code:
:inoremap <F2> <Esc>:set nu! paste!<cr>

However, when I press F2 in Insert mode I get the text <F2> inserted
into the document!

Also, I will have trouble with reentering Insert mode, because if I
use "i" or "a" then I will have troubles at the end or beginning of
text lines. Is there a workaround for that?

Thanks!

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

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