A modern side panel for Vim
Begin by creating a new panel with the :VimpanelCreate
command.
:VimpanelCreate myprojects
Load this panel in the current window with :VimpanelLoad
:VimpanelLoad myprojects
Add entries to the panel with the :Vimpanel
command.
:Vimpanel D:\Projects
The path you just added will act as a root and you can now expand and browse it. At any time you can add other roots to the panel.
To get rid of a root, select it and use the :VimpanelRemove
command. This does not delete anything from
the filesystem, it just takes it off the panel.
Sort your panel entries by editing the Vimpanel storage file. The format of this file is painfully simple:
each line is an entry to the panel. There is a :VimpanelEdit
command that makes this easier, by opening up
that file:
:VimpanelEdit mypanel
You will need to refresh the panel after this, with the :VimpanelRefresh
command or the <F5>
key.
Inside the panel, focus on a single directory by entering explorer mode:
x
In this mode, you can also move up a dir by using the u
key, or change the root by using the c
key.
Exit explorer mode at any time by pressing x
again.
Inside the panel, several actions and filesystem operations are available. Check the full list below.
When you're done working, save the state of you panel and everything else you have on the screen:
:VimpanelSessionMake
This uses Vim's mksession
command and some extra magic to save the state of your panels (the state
is defined by which dirs are expanded and which are closed).
When you're ready to work again, load up that session using:
:VimpanelSessionLoad
And that's about it. To make your life easier, you can use abbreviations or mappings for all these commands.
Here are some recommendations to put in your vimrc
:
map <leader>ss :VimpanelSessionMake<CR>
map <leader>sl :VimpanelSessionLoad<CR>
cabbrev vp Vimpanel
cabbrev vl VimpanelLoad
cabbrev vc VimpanelCreate
cabbrev ve VimpanelEdit
cabbrev vr VimpanelRemove
Tip: autocomplete works for panel names, so you can press vl<space><tab>
and get a full list of panel names.
<CR> or double-click expand directory or open file
<F5> refresh panel
<C-c> or yy copy selected node (file or dir)
<C-v> or p paste nodes
dd delete node
r rename node
a add new node
ff copy node path to clipboard
You can use visual selection (v
or V
) to grab some files and then press <C-c>
or y
to copy them.
Paste them anywhere else with the p
key.
Toggle explorer mode by selecting a folder and pressing the x
key. In this mode you can freely explore the filesystem.
The selected folder will become the root of the tree, but you can change to another root using the c
key or explore the
parent directory using the u
key (move up).
Why is this mode needed? For 2 main reasons:
Vimpanel is built on a heavily modified NERDTree API.
You will find many similarities with NERDTree but many key differences as well.