Vim C 和 C++ 的设置?
Vim settings for C and C++?
创建带有 c 扩展名的新文件会出现处理错误。我在我的其他机器上使用 Clion,但经过深思熟虑后,我决定搬到 vim,在那里我从事大部分其他语言的工作。
我的 c 和插件的点文件?
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
问题出在插件 'luchermitte/lh-cpp' 作为用于 c 开发的插件包,其中包含使用 Plug 而不是 Vundle 安装它们,这在我的环境中造成了冲突。
因此,您要么必须删除 lh-cpp,要么将 vundle 更改为 bundle 等。
也通过这个安装清除了我的想法process
我的 lh-cpp 插件带有依赖项。无论您使用什么插件管理器,既不是 VAM 也不是 vim-flavour(唯一真正支持依赖项的两个),您都必须明确声明插件管理器的依赖项。
我已经在 readme 中列出了您需要的所有内容。将它应用到我列出的插件管理器之外的插件管理器应该不会很复杂。如果我犯了错误,或者有其他错误,请不要害怕提出问题。
可以肯定的是:不要混用插件管理器。选择一个并将您遇到的所有内容转换为它的语法。
PS:我不使用 c.vim,我不能保证您同时使用两者不会发现任何冲突。 lh-cpp 不附带 lib C 函数的片段,但在主题上有 those, it has its own Doxygen related features. And (CMake based) compilation, code indexation, project management, etc. are deported to other plugins. See my post on quora。
创建带有 c 扩展名的新文件会出现处理错误。我在我的其他机器上使用 Clion,但经过深思熟虑后,我决定搬到 vim,在那里我从事大部分其他语言的工作。
我的 c 和插件的点文件?
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
问题出在插件 'luchermitte/lh-cpp' 作为用于 c 开发的插件包,其中包含使用 Plug 而不是 Vundle 安装它们,这在我的环境中造成了冲突。
因此,您要么必须删除 lh-cpp,要么将 vundle 更改为 bundle 等。
也通过这个安装清除了我的想法process
我的 lh-cpp 插件带有依赖项。无论您使用什么插件管理器,既不是 VAM 也不是 vim-flavour(唯一真正支持依赖项的两个),您都必须明确声明插件管理器的依赖项。
我已经在 readme 中列出了您需要的所有内容。将它应用到我列出的插件管理器之外的插件管理器应该不会很复杂。如果我犯了错误,或者有其他错误,请不要害怕提出问题。
可以肯定的是:不要混用插件管理器。选择一个并将您遇到的所有内容转换为它的语法。
PS:我不使用 c.vim,我不能保证您同时使用两者不会发现任何冲突。 lh-cpp 不附带 lib C 函数的片段,但在主题上有 those, it has its own Doxygen related features. And (CMake based) compilation, code indexation, project management, etc. are deported to other plugins. See my post on quora。