{"id":278,"date":"2023-08-18T18:04:57","date_gmt":"2023-08-18T10:04:57","guid":{"rendered":"http:\/\/blog.xjfvps.top\/index.php\/2023\/08\/18\/vim%e5%ae%89%e8%a3%85youcompleteme-%e6%8f%92%e4%bb%b6\/"},"modified":"2023-08-18T21:25:32","modified_gmt":"2023-08-18T13:25:32","slug":"vim%e5%ae%89%e8%a3%85youcompleteme-%e6%8f%92%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/blog.fs.cloudns.biz\/index.php\/2023\/08\/18\/vim%e5%ae%89%e8%a3%85youcompleteme-%e6%8f%92%e4%bb%b6\/","title":{"rendered":"vim\u5b89\u88c5YouCompleteMe \u63d2\u4ef6"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u8981\u5b89\u88c5YouCompleteMe \uff0cvim\u987b\u652f\u6301python\u3002\u770b\u662f\u5426\u652f\u6301\uff0c\u53ef\u4ee5\u5728vim\u4e2d\uff1aversion \u67e5\u770b\uff0c \u5982\u679cpython\u524d\u6709+\u53f7\uff0c\u5c31\u662f\u652f\u6301\uff0c\u51cf\u53f7\u5c31\u662f\u4e0d\u652f\u6301\u3002<\/p>\n<p>\u5982\u679c\u4e0d\u652f\u6301\uff0c\u9700\u8981\u4ee5\u7f16\u8bd1\u5b89\u88c5\u65b9\u5f0f\u91cd\u65b0\u5b89\u88c5vim\u3002<\/p>\n<p>\u7f16\u8bd1\u914d\u7f6e\u9009\u9879\uff1a<\/p>\n<p>.\/configure &#8211;with-features=huge &#8211;enable-pythoninterp &#8211;enable-python3interp &#8211;enable-luainterp &#8211;enable-multibyte &#8211;enable-sniff &#8211;enable-fontset<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u6211\u7684\u673a\u5668\u4e0a\u88c5\u6709python2.7.5 \u548c python3.3\uff0c \u4f46\u52a0\u4e86enable-python3interp\u53c2\u6570\u4f9d\u7136\u6ca1\u6709\u652f\u6301py3\uff0c\u4e0d\u77e5\u4f55\u6545\uff0c\u5148\u4e0d\u7ba1\uff0cYouCompleteMe \u53ea\u8981\u6c42\u6709py2.6\u4ee5\u4e0a\u3002<\/p>\n<p>\u5b89\u88c5vundle\u63d2\u4ef6<\/p>\n<p><span>git clone https:\/\/github.com\/gmarik\/vundle.git ~\/.vim\/bundle\/vundle<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span>\u5728.vimrc\u4e2d\u914d\u7f6e<\/span><\/p>\n<p>&nbsp;<\/p>\n<div class=\"cnblogs_code\">\n<pre><span style=\"color: #0000ff;\">set<\/span> nocompatible              <span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> be iMproved, required<\/span>\nfiletype off                  <span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> required<\/span>\n\n<span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> set the runtime path to include Vundle and initialize<\/span>\n<span style=\"color: #0000ff;\">set<\/span> rtp+=~\/.vim\/bundle\/vundle\/<span style=\"color: #000000;\">\ncall vundle#rc()\n<\/span><span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> alternatively, pass a path where Vundle should install plugins<\/span><span style=\"color: #800000;\">\n\"<\/span><span style=\"color: #800000;\">let path = '~\/some\/path\/here'<\/span><span style=\"color: #800000;\">\n\"<\/span><span style=\"color: #800000;\">call vundle#rc(path)<\/span>\n\n<span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> let Vundle manage Vundle, required<\/span>\nPlugin <span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">gmarik\/vundle<\/span><span style=\"color: #800000;\">'<\/span>\n\n<span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> The following are examples of different formats supported.<\/span><span style=\"color: #800000;\">\n\"<\/span><span style=\"color: #800000;\"> Keep Plugin commands between here and filetype plugin indent on.<\/span><span style=\"color: #800000;\">\n\"<\/span><span style=\"color: #800000;\"> scripts on GitHub repos<\/span>\nPlugin <span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">tpope\/vim-fugitive<\/span><span style=\"color: #800000;\">'<\/span><span style=\"color: #000000;\">\nPlugin <\/span><span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">Lokaltog\/vim-easymotion<\/span><span style=\"color: #800000;\">'<\/span><span style=\"color: #000000;\">\nPlugin <\/span><span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">tpope\/vim-rails.git<\/span><span style=\"color: #800000;\">'<\/span>\n<span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> The sparkup vim script is in a subdirectory of this repo called vim.<\/span><span style=\"color: #800000;\">\n\"<\/span><span style=\"color: #800000;\"> Pass the path to set the runtimepath properly.<\/span>\nPlugin <span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">rstacruz\/sparkup<\/span><span style=\"color: #800000;\">'<\/span>, {<span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">rtp<\/span><span style=\"color: #800000;\">'<\/span>: <span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">vim\/<\/span><span style=\"color: #800000;\">'<\/span><span style=\"color: #000000;\">}\n<\/span><span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> scripts from http:\/\/vim-scripts.org\/vim\/scripts.html<\/span>\nPlugin <span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">L9<\/span><span style=\"color: #800000;\">'<\/span><span style=\"color: #000000;\">\nPlugin <\/span><span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">FuzzyFinder<\/span><span style=\"color: #800000;\">'<\/span>\n<span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> scripts not on GitHub<\/span>\nPlugin <span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">git:\/\/git.wincent.com\/command-t.git<\/span><span style=\"color: #800000;\">'<\/span>\n<span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> git repos on your local machine (i.e. when working on your own plugin)<\/span>\nPlugin <span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">file:\/\/\/home\/gmarik\/path\/to\/plugin<\/span><span style=\"color: #800000;\">'<\/span>\n<span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> ...<\/span>\n<span style=\"color: #000000;\">\nfiletype plugin indent on     <\/span><span style=\"color: #800000;\">\"<\/span><span style=\"color: #800000;\"> required<\/span>\nBundle <span style=\"color: #800000;\">'<\/span><span style=\"color: #800000;\">Valloric\/YouCompleteMe<\/span><span style=\"color: #800000;\">'<\/span><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #800000;\"><span style=\"color: #000000; line-height: 1.5;\">\u3000\u3000\u4fdd\u5b58\u9000\u51fa\uff0c\u6253\u5f00vim\uff0c\u8f93\u5165 :<\/span><span style=\"color: #000000; line-height: 1.5;\">BundleInstall \u8fdb\u884c\u81ea\u52a8\u5b89\u88c5<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span>\u8fdb\u7a0b\u5982\u4e0b\uff0c+\u53f7\u8868\u793a\u5df2\u7ecf\u5b89\u88c5\uff0c&gt;\u8868\u793a\u6b63\u5728\u5b89\u88c5\u3002<\/span><\/p>\n<div class=\"cnblogs_Highlighter\">\n<pre class=\"brush:csharp;gutter:true;\">. Plugin 'gmarik\/vundle' |~ \n+ Plugin 'tpope\/vim-fugitive' |~ \n+ Plugin 'Lokaltog\/vim-easymotion' |~ \n+ Plugin 'tpope\/vim-rails.git' |~ \n+ Plugin 'rstacruz\/sparkup' |~ \n+ Plugin 'L9' |~ \n+ Plugin 'FuzzyFinder' |~ \n&gt; Plugin 'git:\/\/git.wincent.com\/command-|~ \nt.git' |~ \nPlugin 'file:\/\/\/home\/gmarik\/path\/to\/pl|~ \nugin' |~ \nPlugin 'Valloric\/YouCompleteMe' |~ \nHelptags\n<\/pre>\n<\/div>\n<p>\u3000\u3000<\/p>\n<p>\u7ed3\u675f\u65f6\u6709\u4e2a\u9519\u8bef\uff0c\u8fd9\u662f\u6b63\u5e38\u7684\uff0c\u56e0\u4e3aycm\u9700\u8981\u624b\u5de5\u7f16\u8bd1\u51fa\u5e93\u6587\u4ef6<\/p>\n<p>Done! With errors; press l to view log<br \/>ycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected; you need<br \/> to compile YCM before using it. Read the docs!<\/p>\n<p>\u5230&nbsp;.vim\/bundle\/YouCompleteMe \u4e0b\u8dd1<\/p>\n<p> &nbsp;<span>.\/install.sh &#8211;clang-completer<\/span><\/p>\n<p>\u53c2\u6570\u662f\u4e3a\u4e86\u652f\u6301c\/c++ \u7684\u8865\u5168\u3002<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\u8fdb\u884c\u4e00\u4e9b\u7b80\u5355\u7684\u914d\u7f6e\u5c31\u53ef\u4ee5\u4f7f\u7528\u3002<\/p>\n<p>YouCompleteMe \u7684\u8865\u5168\u914d\u7f6e\u6587\u4ef6\u5728\/bundle\/YouCompleteMe\/cpp\/ycm\/.ycm_extra_conf.py\uff0c\u8fd9\u662f\u4e2a\u9690\u85cf\u6587\u4ef6\u3002<\/p>\n<p>\u9ed8\u8ba4\u4f1a\u4f7f\u7528\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4e5f\u53ef\u4ee5\u628a\u8fd9\u4e2a\u6587\u4ef6copy\u5230\u5de5\u7a0b\u7684\u6839\u76ee\u5f55\u4e2d\u4f5c\u4fee\u6539\uff0c\u6253\u5f00\u5de5\u7a0b\u6587\u4ef6\u65f6\u4f1a\u4f18\u5148\u4f7f\u7528\u5f53\u524d\u76ee\u5f55\u4e0b\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<p>\u5982\u679c\u627e\u4e0d\u5230\uff0c\u4f1a\u6839\u636e\u914d\u7f6e\u4e2d\u7684ycm_global_ycm_extra_conf \u8fdb\u884c\u67e5\u627e\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728.vimrc \u4e2d\u6dfb\u52a0<\/p>\n<p>let mapleader = &#8220;,&#8221; &nbsp;&#8221; \u8fd9\u4e2aleader\u5c31\u6620\u5c04\u4e3a\u9017\u53f7&ldquo;\uff0c&rdquo;<\/p>\n<p>let g:ycm_global_ycm_extra_conf = &#8216;~\/.vim\/bundle\/YouCompleteMe\/cpp\/ycm\/.ycm_extra_conf.py&#8217; &nbsp; &ldquo;\u914d\u7f6e\u9ed8\u8ba4\u7684ycm_extra_conf.py<br \/>nnoremap &lt;leader&gt;jd :YcmCompleter GoToDefinitionElseDeclaration&lt;CR&gt; &nbsp; &ldquo;\u6309,jd \u4f1a\u8df3\u8f6c\u5230\u5b9a\u4e49<br \/>let g_ycm_confirm_extra_conf=0 &nbsp; &nbsp;&ldquo;\u6253\u5f00vim\u65f6\u4e0d\u518d\u8be2\u95ee\u662f\u5426\u52a0\u8f7dycm_extra_conf.py\u914d\u7f6e<br \/>let g:ycm_collect_identifiers_from_tag_files = 1 &#8220;\u4f7f\u7528ctags\u751f\u6210\u7684tags\u6587\u4ef6<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; &nbsp; \u8981\u5b89\u88c5YouCompleteMe \uff0cvim\u987b\u652f\u6301py &hellip; <a href=\"https:\/\/blog.fs.cloudns.biz\/index.php\/2023\/08\/18\/vim%e5%ae%89%e8%a3%85youcompleteme-%e6%8f%92%e4%bb%b6\/\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,12,8,1],"tags":[14,13],"class_list":["post-278","post","type-post","status-publish","format-standard","hentry","category-c","category-vim","category-8","category-uncategorized","tag-c","tag-vim"],"_links":{"self":[{"href":"https:\/\/blog.fs.cloudns.biz\/index.php\/wp-json\/wp\/v2\/posts\/278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.fs.cloudns.biz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.fs.cloudns.biz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.fs.cloudns.biz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.fs.cloudns.biz\/index.php\/wp-json\/wp\/v2\/comments?post=278"}],"version-history":[{"count":1,"href":"https:\/\/blog.fs.cloudns.biz\/index.php\/wp-json\/wp\/v2\/posts\/278\/revisions"}],"predecessor-version":[{"id":314,"href":"https:\/\/blog.fs.cloudns.biz\/index.php\/wp-json\/wp\/v2\/posts\/278\/revisions\/314"}],"wp:attachment":[{"href":"https:\/\/blog.fs.cloudns.biz\/index.php\/wp-json\/wp\/v2\/media?parent=278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.fs.cloudns.biz\/index.php\/wp-json\/wp\/v2\/categories?post=278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.fs.cloudns.biz\/index.php\/wp-json\/wp\/v2\/tags?post=278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}