Working with big projects, I often find myself needing to view/edit several files at once.
If I have multiple buffers open, is there a way to split the window to view multiple files in one command?
E.g. usually I begin my workflow by entering my project's root directory, entering vim
in the terminal, and then entering :n **/*.py
to recursively load all python files that exist in the project as buffers.
Simple example, I have these buffers:
:ls
1 %a ".vimrc" line 1
2 "rsync_to_home.bash" line 0
3 "README.md" line 0
4 ".zshrc" line 0
I want to split the screen to show "rsync_to_home.bash"
, ".zshrc"
, along with the current buffer (.vimrc
), as horizontally split windows. To accomplish this, I would have to do:
:sb 2 <Enter>
:sb 4 <Enter>
But calling :sb for each file individually is tedious, and :sb 2 4
doesn't work. Also, if I'm working with a lot of files, I would probably have to repeat :ls
between the :sb
calls to make sure I'm calling the right buffer numbers.
:sb
a buffer name... For example:sb rsy
followed by:sb zsh
, with any unique substring of the buffer (file) name. Regarding using a single command, how about joining them with|
?:sb rsy|sb zsh
should work...