Making virtualedit a local option
virtualedit is a global option. This means that when you call
setlocal virtualedit it's not set just for this buffer but for all windows and all buffers. This is confusing, but only options labeled
local to buffer in help can be set to the local buffer.
virtualedit is labeled as global.
However there is a hack. You can simulate this as a buffer local option by setting it on
BufEnter and unsetting it on
In my .vimrc.local I have
autocmd BufNewFile,BufRead,BufEnter *.part setlocal virtualedit+=all autocmd BufLeave *.part setlocal virtualedit-=all
Set it when you enter, unset it when you leave, and now the setting is confined to the buffer you'd like to use it in.Tweet