VIM替代插件的原生功能合集(持续更新)

How to Do 90% of What Plugins Do (With Just Vim)

This collection is inspired by the youtube video: How to Do 90% of What Plugins Do (With Just Vim)

VIM内置文件浏览框NetRW

g:netrw_browse_split是重要的选项,直接影响体验:

*g:netrw_browse_split*    when browsing, <cr> will open the file by:
                =0: re-using the same window  (default)
                =1: horizontally splitting the window first
                =2: vertically   splitting the window first
                =3: open file in new tab
                =4: act like "P" (ie. open previous window)
*g:netrw_liststyle*        Set the default listing style:
                                = 0: thin listing (one file per line)
                                = 1: long listing (one file per line with time
                     stamp information and file size)
                = 2: wide listing (multiple files in columns)
                = 3: tree style listing

File Navigation

# Fuzzy recursively search file in current folder & open it
:find *test.py**

# Fuzzy search buffers ever opened & open it
:b *file*

Vim原生补全工具 OmniComplete

用了一天倒腾自动补全插件,实在是崩溃,但凡有点名气的都对vim本身的编译有很麻烦的要求。搜索过程中才发现Vim其实是自带补全功能的,称为OmniComplete
输代码的过程中,直接按Ctrl+X然后再按Ctrl+O,就会弹出vim猜测的一系列补全内容。可以在菜单里按“上下键”选择,注意是方向上下键,不是JK键。
经过测试,原生支持很多种语言。

VIM替代插件的原生功能合集(持续更新)

在Insert编辑模式时,输入某个词,然后:

  • Ctrl+X再按Ctrl+l,就会显示出一个提示列表。
  • Ctrl+nCtrl+p上下选择。

当然,这样按键太麻烦,我们要做键盘映射了:

" 按Ctrl+d显示自动补全
inoremap <C-d> <C-x><C-l>

vim

相关推荐