Something like this works, for starters:
nnoremap : :set paste<CR>:
That disables them in command mode. But now I have to enable them back again,
somehow when I leave command mode and return to normal mode. I could use an
autocmmand to set and then unset paste, when entering and leaving a cmd
window, but there are no autocommands for entering and leaving command mode.
Any ideas?
Not sure that's answering your question, but maybe pastetoggle?
:help 'pastetoggle'
set pastetoggle=<F5>
Michael
You can work around it:
function! Abbreviate(lhs, rhs)
if getcmdtype() =~ '[/?]'
return a:rhs
else
return a:lhs
endif
endfu
function! Abbr(args)
if len(split(a:args)) < 2
echo "Need 2 arguments"
return
endif
let lhs = matchstr(a:args, '^\s*\zs\S*')
let rhs = matchstr(a:args, '^\s*\S*\s\+\zs.*')
exe printf(':cnorea %s <c-\>eAbbreviate(''%s'',''%s'')<cr>', lhs, lhs,
rhs)
endfu
com! -nargs=+ Sab :call Abbr(<q-args>)
And then use :Sab foo foobar
regards,
Christian