> First, why don't you use just
> noremap : :set nopaste<CR>:
I was afraid of an infinite regress which happened to me with other
attempts. That is, I thought the final : would execute the new :
command defined by the map. I understood ``nore'' as preventing the
left side of a map from being defined again in a new map. I now
realize that `nore'' also tells vim not to execute the new map
when it encounters the final :.
> Second, have you tested this in visual mode? It won't work, as well as `2:` in normal mode.
Normal mode was never a problem, because abbreviations are never
expanded in normal mode anyway. Visual mode is also not a problem,
because my friend, for whom I wrote the maps, never uses visual or
select mode (he is blind!).
T
ake a different approach:
> function s:SetNoPaste()
> set nopaste
> return ''
> endfunction
> noremap <expr> : s:SetNoPaste().':'
> noremap <expr> / s:SetNoPaste().'/'
> noremap <expr> ? s:SetNoPaste().'?'
Actually, I've abandoned disabling abbreviations on the : line by
setting paste, because paste has some undesirable side effects, e.g.,
textwidth and wrapmargin are set to 0 and you cant reset them on the :
line because it is mapped to set paste whenever you go there.
Other indirect ways to disable abbreviations on the command line, are:
use true EX mode, or use autocommands for a command line window. I
think I need to bite the bullet and redefine abbreviate using the
getcmdtype() function. If I could get the
cmdline window to act like : without its own peculiarities, or if I
could enter EX mode and arrange to automatically exit it, after a
single command (e.g., automatically execute :vi <ENTER> -- I would
go there, since that would be very easy.
--
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