I mostly work on website and sometimes I need to have 3 or 4 buffers displayed for backend and 3 or 4 buffers for frontend at the same time. Tabs are here for that but buffers are mixed. I know I'm a bit fussy but is there a way create buffers "collections" from tab ? It could limit number of opened buffers by tab and be easier to switch from one (buffer) to another.
I use tabs quite extensively to work on different directories (sometimes 4+ tabs)
Combining a plugin like CtrlP
and the :lcd
command you can effectively have multiple workspaces (each with a different directory) with minimal mental upkeep.
The :lcd
command changes the directory for the current window only, so the way I use it is as follows.
:tabnew
:lcd ~/somewhere/else
ctrl + p
(default binding for CtrlP
to open files in current directory) and find the file you want to edit:tn
and :tp
(obviously I have keybindings for these since I do a lot of switching)So basically each tab will have it's own working directory, and you use ctrl + p
to switch between files/buffers.
Yes, you can have window-local argument lists:
$ vim
:arglocal foo bar baz
:tabnew
:arglocal arthur robert charles
Now, :args
in the first tab page should output:
[foo] bar baz
and, in the second tab page:
[arthur] robert charles
One potential problem with this approach is that you are somehow restrained to argument-specific commands:
:n[ext]
:prev[ious] (or :N[ext])
:fir[st] (or :rew[ind])
:la[st]
:argl[ocal]
and tab-specific commands:
:tabn[ext] (or gt)
:tabp[revious] (or :tabN[ext]) (or gT)
:tabfir[st] (or :tabr[ewind])
:tabl[ast]
which are not as flexible as the more generic commands available if you only use a global argument list (:b <tab>
, the cycling nature of :bn/:bp
…).
That said, you still have the possibility to look for a plugin on vim.org.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With