I\'ve started using Vim to develop Perl scripts and am starting to find it very powerful.
One thing I like is to be able to open multiple files at once with:
<
If using only vim built-in commands, the best one that I ever saw to switch among multiple buffers is this:
nnoremap f :set nomore:ls:set more:b
It perfectly combines both :ls
and :b
commands -- listing all opened buffers and waiting for you to input the command to switch buffer.
Given above mapping in vimrc, once you type
,
23
to go to buffer 23,#
to go to the alternative/MRU buffer,
, or
to autocomplete,
or
to stay on current bufferA snapshot of output for the above key mapping is:
:set nomore|:ls|:set more
1 h "script.py" line 1
2 #h + "file1.txt" line 6 -- '#' for alternative buffer
3 %a "README.md" line 17 -- '%' for current buffer
4 "file3.txt" line 0 -- line 0 for hasn't switched to
5 + "/etc/passwd" line 42 -- '+' for modified
:b ' here'
In the above snapshot:
%a
for current, h
for hidden, #
for previous, empty for hasn't been switched to.+
for modified.Also, I strongly suggest set hidden
. See :help 'hidden'
.