C和C ++的Vim设置?

时间:2017-05-23 08:14:12

标签: vim vim-plugin

使用c扩展名创建新文件会带来处理错误。我在其他机器上使用Clion但是经过深思熟虑后,我决定转到vim,在那里我可以完成大部分其他语言的工作。

我的c和插件的dotfile?

Plugin 'luchermitte/lh-cpp'
Plugin 'cscope.vim'
Plugin 'c.vim'

" += C.vim config
let  g:C_UseTool_cmake    = 'yes'
let  g:C_UseTool_doxygen = 'yes'

错误:我想解决这些错误。

Error detected while processing /Users/frrank/.vim/bundle/lh-cpp/ftplugin/c/c_menu.vim:
line   43:
E117: Unknown function: lh#option#get
E15: Invalid expression: lh#option#get('c_menu_priority', '50', 'g')
line   44:
E117: Unknown function: lh#option#get
E15: Invalid expression: lh#option#get('c_menu_name',     '&C++', 'g')
line   66:
E121: Undefined variable: s:menu_prio
E15: Invalid expression: 'amenu <silent> '.s:menu_prio.'.100 '.escape(s:menu_name.'.-100-', '\ '). ' <Nop>'
line   69:
E121: Undefined variable: s:menu_prio
E15: Invalid expression: 'amenu <silent> '.s:menu_prio.'.100.1 '. escape(s:menu_name.'.&Help.&Contents', '\ '). ' :help lh-cpp-readme.txt<cr>'
line   72:
E121: Undefined variable: s:menu_prio
E15: Invalid expression: 'amenu <silent> '.s:menu_prio.'.100.2 '. escape(s:menu_name.'.&Help.&Features', '\ '). ' :help lh-cpp-features<cr>'
line   75:
E121: Undefined variable: s:menu_prio
E15: Invalid expression: 'amenu <silent> '.s:menu_prio.'.100.3 '. escape(s:menu_name.'.&Help.&First Steps', '\ '). ' :help lh-cpp-first-steps<cr>'
line   79:
E121: Undefined variable: s:menu_prio
E15: Invalid expression: 'amenu <silent> '.s:menu_prio.'.100.20.10 '. escape(s:menu_name.'.&Help.Code &snippets.&Brackets', '\ '). ' :help brackets-for-C<cr>'
line   82:
E121: Undefined variable: s:menu_prio
E15: Invalid expression: 'amenu <silent> '.s:menu_prio.'.100.20.20 '. escape(s:menu_name.'.&Help.Code &snippets.&C snippets', '\ '). ' :help C_control-statements<cr>'
Error detected while processing /Users/frrank/.vim/bundle/lh-cpp/ftplugin/c/c_pvs-2-qf.vim:

Error detected while processing /Users/frrank/.vim/bundle/lh-cpp/ftplugin/c/c_snippets.vim:
line   65:
E492: Not an editor command: :Brackets #if\ 0 #endif -insert=0 -nl -trigger=<localleader>0
line   68:
E492: Not an editor command: :Brackets #if\ 0 #else!mark!\n#endif -insert=0 -nl -trigger=<localleader>1
line   81:
E492: Not an editor command:   Inoreabbr <buffer> <silent> if <C-R>=lh#cpp#snippets#def_abbr('if ', '\<c-f\>if(!cursorhere!){!mark!}!mark!')<cr>
line   95:
E492: Not an editor command:   Inoreabbr <buffer> <silent> elif <C-R>=lh#cpp#snippets#def_abbr('elif ', '\<c-f\>else if(!cursorhere!) {!mark!}!mark!')<cr>
line  109:
E492: Not an editor command:   Inoreabbr <buffer> <silent> else <C-R>=lh#cpp#snippets#insert_if_not_before('else ', '\<c-f\>else{!cursorhere!}!mark!', 'if')<cr><c-f>
line  123:
E492: Not an editor command:   Inoreabbr <buffer> <silent> for <C-R>=lh#cpp#snippets#def_abbr('for ', { '! lh#cpp#use_cpp11()': '\<c-f\>for(!cursorhere!;!mark!;!mark!){!mark!}!mark!
', '  lh#cpp#use_cpp11()': '\<c-f\>for(!cursorhere!){!mark!}!mark!' })<cr>
line  133:
E492: Not an editor command:   Inoreabbr <buffer> <silent> while <C-R>=lh#cpp#snippets#def_abbr('while ', '\<c-f\>while(!cursorhere!){!mark!}!mark!')<cr>
line  152:
E492: Not an editor command:   Inoreabbr <buffer> <silent> do <C-R>=lh#cpp#snippets#def_abbr('do ', '\<c-f\>do{!cursorhere!}while(!mark!);!mark!')<cr><c-f>
line  179:
E492: Not an editor command:   Inoreabbr <buffer> <silent> switch <C-R>=lh#cpp#snippets#def_abbr('switch ', '\<c-f\>switch(!cursorhere!){!mark!}!mark!')<cr>
line  202:
E492: Not an editor command:   Brackets /* */ -visual=0
line  203:
E492: Not an editor command:   Brackets /* */ -visual=0 -trigger=<kDivide><kMultiply>
line  205:
E492: Not an editor command:   Brackets /* */ -insert=0 -trigger=<m-v>
Error detected while processing /Users/frrank/.vim/bundle/lh-cpp/ftplugin/c/previewWord.vim:
line   46:
E117: Unknown function: lh#mapping#plug
line   50:
E117: Unknown function: lh#mapping#plug
line   64:
E117: Unknown function: lh#menu#def_toggle_item
line   66:
E117: Unknown function: lh#mapping#plug 

2 个答案:

答案 0 :(得分:2)

我的lh-cpp插件附带了依赖项。无论你使用什么插件管理器,哪个不是VAM,也不是vim-flavor(只有两个真正支持依赖关系),你必须明确声明插件管理器的依赖关系。

我已在readme中列出了您需要的所有内容。将它调整到另一个插件管理器并不是非常复杂,而不是我列出的插件管理器。如果我犯了错误,或者有其他错误,请不要害怕打开问题。

可以肯定:不要混合插件管理器。选择一个并将您遇到的所有内容转换为其语法。

PS:我不使用c.vim,我不能保证你不会因为使用两者而观察到任何冲突。 lh-cpp没有提供lib C函数的片段,但是对于those,它有自己的Doxygen related features。并且(CMake based) compilation,代码索引,project management等会被逐出其他插件。有关该主题,请参阅my post on quora

答案 1 :(得分:0)

问题在于插件'luchermitte / lh-cpp'作为c开发的插件包,其中包含使用在我的环境中发生冲突的Plug not Vundle安装它们。

所以要么你必须删除lh-cpp或将vundle改为bundle等等。

通过此安装process

清除了我的想法