Saturday, April 14, 2012

Solved: set paste in : mode only

For any interested, I did arrange for paste to be set, only in : cmdline mode,
without using the getcmdtype() function and an alternate abbreviation command.
Thus, abbreviations expand in insert, and search modes, but not in command
line mode. Easy - but a little clunky:

au InsertEnter * set nopaste
noremap Z9 /
map / :set nopaste<CR>Z9
noremap Z8 ?
map ? :set nopaste<CR>Z8
noremap Z7 :
map : :set paste<CR>Z7

The useful trick is redefining a command, by noremapping another command to
it, and then adding whatever you want to the real command. Noremap prevents
an infinite regress when the redefined command is executed.


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