Friday, May 11, 2012

Toggle paste and nonu in one keystroke

Hi all, I am trying to write a function that will toggle the states
"paste && nonu" and "nopaste && nu". I cobbled a few things together
but although I figured this would be easy, it is eluding me. I need
some sort of persistent variable to test state mode. I also need it to
work in both Insert and Normal modes.

noremap <F2> PasteMode()
function! PasteMode()
if exists(SOME_TYPE_OF_PERSISTENT_VARIABLE)
unset PERSISTENT_VARIABLE
set nopaste
set nu
else
set PERSISTENT_VARIABLE
set paste
set nonu
endif
endfunction



Thanks in advance for any advice.

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