官术网_书友最值得收藏!

  • Mastering Vim
  • Ruslan Osipov
  • 246字
  • 2021-06-10 18:51:30

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?

Hint: it's the bottom left one—but you don't have a way of knowing that. NERDTree opens files in the last created window.

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). 

If you have NERDTree installed when using Vinegar, you'll get a NERDTree window instead of Netrw. To avoid NERDTree replacing Netrw (and to make commands like - work), set   let NERDTreeHijackNetrw = 0 in your .vimrc  file.

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.

主站蜘蛛池模板: 岢岚县| 德保县| 金阳县| 凤城市| 济南市| 行唐县| 江口县| 黄山市| 怀安县| 思茅市| 屏东市| 乌鲁木齐县| 铁力市| 万全县| 通海县| 宁远县| 中牟县| 沁水县| 宝鸡市| 揭西县| 蒙自县| 边坝县| 济宁市| 铁力市| 顺义区| 枣阳市| 胶州市| 密山市| 商河县| 清镇市| 芒康县| 满洲里市| 保山市| 那曲县| 政和县| 渭源县| 双牌县| 拉孜县| 周宁县| 肇庆市| 永寿县|