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

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

Plugin spotlight – CtrlP

CtrlP is a fuzzy completion plugin that helps you open the files you need quickly, given that you somewhat know what you're looking for. CtrlP is available from https://github.com/ctrlpvim/ctrlp.vim (see the Installing plugins section earlier in this chapter for installation instructions). 

Install it and hit Ctrl + p:

This shows the list of files in the project directory. Type in a partial filename or a path, and the list of files will narrow down to string matches. You can use Ctrl + j and Ctrl + k to navigate up and down the list, and Enter to open the file. Esc closes the CtrlP window.

CtrlP also allows you to navigate through buffers and most recently used files. With the CtrlP window open, you can use Ctrl + f and Ctrl + b to cycle through the available options.

You can invoke these directly by executing :CtrlPBuffer for buffers and :CtrlPMRU for the most recently used ones. You can also use :CtrlPMixed to search through files, buffers, and the most recently used files at the same time.

You can also add custom mappings for these to your .vimrc file. For example, to map Ctrl + b to :CtrlPBuffer, you could do the following:

nnoremap <C-b> :CtrlPBuffer<cr>  " Map CtrlP buffer mode to Ctrl + B.
主站蜘蛛池模板: 旌德县| 宝坻区| 彝良县| 上饶市| 长垣县| 庄河市| 雷山县| 麻城市| 木里| 浦县| 朝阳县| 清原| 巴东县| 姚安县| 佳木斯市| 康马县| 鹤岗市| 旺苍县| 裕民县| 巴中市| 石河子市| 彭山县| 长宁区| 武平县| 沂南县| 天门市| 隆安县| 独山县| 襄垣县| 石楼县| 乳源| 塔城市| 南郑县| 华坪县| 永春县| 襄汾县| 宕昌县| 江津市| 宜阳县| 黄大仙区| 伊金霍洛旗|