【发布时间】:2014-02-20 21:59:59
【问题描述】:
如果我打开一个 c 文件并且我的缓冲区正在使用 "c.vim" ftplugin,那么打开/编辑/获取我的 .vimrc ,我失去了 "c.vim" ftplugin 的功能。
自动重新加载 ftplugin 的最佳方法是什么?
这是一个例子:
获取我的 .vimrc:
之前 c 文件的缓冲区状态// This line has an existing comment.
// I used 'o' while on the above line to continue that comment.
// Awesome, after pressing return I am still commenting.
获取我的 .vimrc:
后 c 文件的缓冲区状态// This line has an existing comment.
I used 'o' while on the above line to try and continue that comment.
After pressing return it is obvious the ftplugin for this filetype is not active.
这是我的 .vimrc,以防它以某种方式导致问题:
set nocompatible
set backspace=indent,eol,start
filetype plugin indent on
syntax on
set hls
nnoremap <leader>ev :split $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
【问题讨论】:
-
您不能手动或以编程方式获取 ftplugins:它们是由 Vim 在检测到相关文件类型时获取的。此外,您没有显示该 ftplugin 中的内容,甚至没有说明它应该涵盖的文件类型。请用更多信息替换您问题中的借口。
-
romainl 感谢您的回复,我应该更换什么借口?我可以添加文件类型是 c 代码。使用 vim 中包含的标准 c 文件类型...上次更改是 2007 年 9 月 25 日。这有帮助吗?
-
“我真诚地提前道歉”和朋友们。
-
采购您的
~/.vimrc不应该让您处于这种情况。找到~/.vimrc之后,:set syntax的输出是什么?只是为了确定,真的是~/.vimrc吗?
标签: vim vim-plugin