by cturner · 17y ago · 0 comments
set bufhidden
nmap <C-h> :bp
nmap <C-l> :bn
If you put this in your .vimrc file, you'll need to put a '^M' at the end of the nmap lines. You do this by doing <C-v><C-m> and it puts in a special character that means newline. Then you can switch between open buffers with ctrl+l and ctrl+h even if you have unsaved changes. it will end up looking like this: set bufhidden
nmap <C-h> :bp^M
nmap <C-l> :bn^M
Unfortunately if you have many files open and don't touch them all it prevents you from quitting with a message 'E173: 17 more files to edit'. I haven't worked out how to obliterate this without damaging features I want (e.g. not quitting when there's unsaved data in those other files).The default vim that ships with linux distributions is often a pile of junk that has been hacked by the distribution, is missing features like these. You want to get vim-extended under redhat-like distributions (they've significantly improved the quality if their junk vim in recent releases), and vim-nox or vim-full in debian-like distributions.
And I think you mean "set hidden".
And regarding E173: You can :qa, which won't lose any unsaved changes.
And the proper vim package for Debian or Ubuntu is "vim". "vim-full" is the old name and it just installs "vim".