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 键。经过测试,原生支持很多种语言。
在 Insert 编辑模式时,输入某个词,然后:
按 Ctrl+ x 再按 Ctrl+l,就会显示出一个提示列表。
按 Ctrl+ n 或 Ctrl+ p 上下选择。
当然,这样按键太麻烦,我们要做键盘映射了:
” 按 Ctrl+ d 显示自动补全
inoremap <C-d> <C-x><C-l>