- Mastering Vim
- Ruslan Osipov
- 246字
- 2025-04-04 15:36:08
Plugin spotlight – Vinegar
Tim Pope's vinegar.vim is a simple plugin that addresses the difficulty of using project drawers with Vim split window functionality. Plugins such as NERDTree become rather disorienting to work with when you have more than one window open in a split.
In the following example, three windows are open (and a fourth NERDTree window on the left):
When pressing Enter with the cursor in the NERDTree window, which window will the new file be opened in?
Tim Pope solves this problem with a small plugin called Vinegar, which makes using Netrw a more seamless experience. It's available over at https://github.com/tpope/vim-vinegar (see Installing plugins for installation instructions).
Vinegar adds a handy new mapping: - (dash) to open Netrw in a current directory. Try it out:
The plugin hides Netrw's help bar, which might be confusing at first. Hit I (uppercase i) to bring it back. Another shortcut, Shift + ~ key, takes you to your home directory, which is often where you'll store your projects.