Vya*_*nov 3 vim file-type autocomplete
我想绑定这样的东西:
对于CSS,HTML文件: <c-space> <c-x><c-n>
对于Ruby文件: <c-space> <c-x><c-u>
这该怎么做?
该文件是更完整,精确无误,但简要地说:
从您要使用的文件类型开始,在ftplugin文件夹中创建一个文件(如果需要,创建此文件夹).
??? vim
? ??? after
? ??? autoload
? ??? bundle
? ??? ftplugin
? ? ??? python.vim
? ? ??? rnoweb.vim
? ? ??? tex.vim
? ??? syntax
Run Code Online (Sandbox Code Playgroud)
在其中一个文件中,python.vim例如,一行像
noremap! <buffer> <F5> <Esc>:w<CR>:!python % <CR>
Run Code Online (Sandbox Code Playgroud)
将只是在此缓冲区中为此文件类型定义的绑定.确保filetype plugin on或类似出现在您的vimrc中.
编辑:Peter Rincker的优秀建议:地图命令和<buffer>标志的noremap版本.他还提醒我们使用setlocal而不是set在我们的filetype插件文件中.