{"id":139,"date":"2023-05-15T11:17:26","date_gmt":"2023-05-15T03:17:26","guid":{"rendered":"https:\/\/boostup.cf\/?p=139"},"modified":"2025-05-15T16:26:28","modified_gmt":"2025-05-15T08:26:28","slug":"vim%e5%b0%8f%e6%8a%80%e5%b7%a7","status":"publish","type":"post","link":"https:\/\/189505.xyz\/?p=139","title":{"rendered":"vim\u5c0f\u6280\u5de7"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_40 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" area-label=\"ez-toc-toggle-icon-1\"><label for=\"item-6a1caa693bdb7\" aria-label=\"Table of Content\"><span style=\"display: flex;align-items: center;width: 35px;height: 30px;justify-content: center;direction:ltr;\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/label><input  type=\"checkbox\" id=\"item-6a1caa693bdb7\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/189505.xyz\/?p=139\/#vim%E5%AE%9A%E6%97%B6%E4%BF%9D%E5%AD%98session\" title=\"vim\u5b9a\u65f6\u4fdd\u5b58session\">vim\u5b9a\u65f6\u4fdd\u5b58session<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/189505.xyz\/?p=139\/#%E5%9C%A8json%E6%95%B0%E7%BB%84%E4%B8%AD%E8%B7%B3%E8%BD%AC%E5%88%B0%E7%AB%AF%E7%82%B9%E7%9A%84%E6%8B%AC%E5%8F%B7\" title=\"\n\u5728json\u6570\u7ec4\u4e2d\u8df3\u8f6c\u5230\u7aef\u70b9\u7684[]\u62ec\u53f7 \n\">\n\u5728json\u6570\u7ec4\u4e2d\u8df3\u8f6c\u5230\u7aef\u70b9\u7684[]\u62ec\u53f7 \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/189505.xyz\/?p=139\/#delete_hidden_buffer\" title=\"\ndelete hidden buffer \n\">\ndelete hidden buffer \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/189505.xyz\/?p=139\/#build_from_source\" title=\"\nbuild from source \n\">\nbuild from source \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/189505.xyz\/?p=139\/#YouCompleteMe_Python%E6%8C%87%E5%AE%9A%E8%A7%A3%E9%87%8A%E5%99%A8%EF%BC%8C%E8%B7%B3%E8%BD%AC%E5%88%B0third-party%E5%BA%93\" title=\"\nYouCompleteMe Python\u6307\u5b9a\u89e3\u91ca\u5668\uff0c\u8df3\u8f6c\u5230third-party\u5e93 \n\">\nYouCompleteMe Python\u6307\u5b9a\u89e3\u91ca\u5668\uff0c\u8df3\u8f6c\u5230third-party\u5e93 \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/189505.xyz\/?p=139\/#cscope%E9%87%8D%E6%96%B0%E5%8A%A0%E8%BD%BD%E6%95%B0%E6%8D%AE%E5%BA%93\" title=\"\ncscope\u91cd\u65b0\u52a0\u8f7d\u6570\u636e\u5e93 \n\">\ncscope\u91cd\u65b0\u52a0\u8f7d\u6570\u636e\u5e93 \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/189505.xyz\/?p=139\/#python%E8%B7%B3%E8%BD%AC%E5%88%B0%E5%87%BD%E6%95%B0%E5%BC%80%E5%A7%8B%E5%92%8Cclass%E5%BC%80%E5%A7%8B\" title=\"\npython\u8df3\u8f6c\u5230\u51fd\u6570\u5f00\u59cb\u548cclass\u5f00\u59cb \n\">\npython\u8df3\u8f6c\u5230\u51fd\u6570\u5f00\u59cb\u548cclass\u5f00\u59cb \n<\/a><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"vim%E5%AE%9A%E6%97%B6%E4%BF%9D%E5%AD%98session\"><\/span>vim\u5b9a\u65f6\u4fdd\u5b58session<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\n\u628a\u5982\u4e0b\u4ee3\u7801\u4fdd\u5b58\u4e3asess.vim\n<\/p>\n<pre><code>let g:sname = strftime(&#039;.session\/%Y_%m_%d__%H_%M_%S.vim&#039;)\nfunction! SaveSession(timer)\n  if !isdirectory(&quot;.session&quot;)\n    call mkdir(&quot;.session&quot;, &quot;p&quot;, 0755)\n  endif\n  execute &quot;mksession!&quot; g:sname\nendfunction\nlet timer = timer_start(180000, &#039;SaveSession&#039;, {&#039;repeat&#039;:-1})<\/code><\/pre>\n<p>\n\u7136\u540e\u5728vim\u4e2d\u6267\u884c\n<\/p>\n<pre><code>source sess.vim<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"%E5%9C%A8json%E6%95%B0%E7%BB%84%E4%B8%AD%E8%B7%B3%E8%BD%AC%E5%88%B0%E7%AB%AF%E7%82%B9%E7%9A%84%E6%8B%AC%E5%8F%B7\"><\/span>\n\u5728json\u6570\u7ec4\u4e2d\u8df3\u8f6c\u5230\u7aef\u70b9\u7684[]\u62ec\u53f7<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre>\nva[\n\u6bd4\u5982\u5149\u6807\u5728d\u5904,\u6309\u4e0bva[\uff0c\u53ef\u4ee5\u8df3\u8f6c\u5230[]\u4e0a\n[\n{a:b},\n{c:d}\n]\n\n<\/pre>\n<h1><span class=\"ez-toc-section\" id=\"delete_hidden_buffer\"><\/span>\ndelete hidden buffer<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre><code>function DeleteHiddenBuffers()\n    let tpbl=[]\n    call map(range(1, tabpagenr(&#039;$&#039;)), &#039;extend(tpbl, tabpagebuflist(v:val))&#039;)\n    for buf in filter(range(1, bufnr(&#039;$&#039;)), &#039;bufexists(v:val) &amp;&amp; index(tpbl, v:val)==-1&#039;)\n        silent execute &#039;bwipeout&#039; buf\n    endfor\nendfunction<\/code><\/pre>\n<p>\u7136\u540e<\/p>\n<pre><code>:call DeleteHiddenBuffers()<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"build_from_source\"><\/span>\nbuild from source<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>configure\u7684\u547d\u4ee4<\/p>\n<pre><code>set -x\nmake distclean\nexport LD_LIBRARY_PATH=\/tvm\/python3.8-compile\/python3.8\/lib:${LD_LIBRARY_PATH}\nexport PATH=\/tvm\/python3.8-compile\/python3.8\/bin\/:${PATH}\nexport LDFLAGS=&quot;-rdynamic&quot;\n#vi_cv_path_python=\/home\/like12\/opt\/python3.8\/bin\/python3.8\n.\/configure --prefix=\/tvm\/vim-install\/ --enable-python3interp=yes --with-python3-config-dir=\/tvm\/python3.8-compile\/python3.8\/lib\/python3.8\/config-3.8-x86_64-linux-gnu\/ --with-python3-command=\/tvm\/python3.8-compile\/python3.8\/bin\/python3.8<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"YouCompleteMe_Python%E6%8C%87%E5%AE%9A%E8%A7%A3%E9%87%8A%E5%99%A8%EF%BC%8C%E8%B7%B3%E8%BD%AC%E5%88%B0third-party%E5%BA%93\"><\/span>\nYouCompleteMe Python\u6307\u5b9a\u89e3\u91ca\u5668\uff0c\u8df3\u8f6c\u5230third-party\u5e93<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u5728conda\u73af\u5883\u4e2d\u6bd4\u8f83\u6709\u7528<br \/>\n\u5728\u4f60\u7684\u9879\u76ee\u4e0b\u65b0\u5efa.ycm_extra_conf.py\u6587\u4ef6\uff0c\u6307\u5b9a\u89e3\u91ca\u5668\u8def\u5f84\u548cthird-party\u5e93<\/p>\n<pre><code>(torch2) like@a141:~\/package\/torchmo$ cat .ycm_extra_conf.py\ndef Settings(**kwargs):\n  return {\n    &#039;interpreter_path&#039;: &#039;\/share_data\/users\/like\/miniconda3\/envs\/torch2\/bin\/python&#039;,\n    &#039;sys_path&#039;: [\n      &#039;\/share_data\/users\/like\/miniconda3\/envs\/torch2\/lib\/python3.10\/site-packages\/&#039;\n    ]\n  }<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"cscope%E9%87%8D%E6%96%B0%E5%8A%A0%E8%BD%BD%E6%95%B0%E6%8D%AE%E5%BA%93\"><\/span>\ncscope\u91cd\u65b0\u52a0\u8f7d\u6570\u636e\u5e93<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>:cs reset<\/p>\n<h1><span class=\"ez-toc-section\" id=\"python%E8%B7%B3%E8%BD%AC%E5%88%B0%E5%87%BD%E6%95%B0%E5%BC%80%E5%A7%8B%E5%92%8Cclass%E5%BC%80%E5%A7%8B\"><\/span>\npython\u8df3\u8f6c\u5230\u51fd\u6570\u5f00\u59cb\u548cclass\u5f00\u59cb<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre><code>[[\n\u76f4\u63a5\u8df3\u5230\u6700\u5916\u5c42\u7684class\u6216\u8005\u51fd\u6570\u5b9a\u4e49\uff0c\u8fde\u5c40\u90e8\u51fd\u6570\u7684\u5b9a\u4e49\u90fd\u8df3\u8fc7\n[m\n\u53ea\u8df3\u4e00\u6b21\uff0c\u5230\u6700\u5185\u5c42\u51fd\u6570\u5b9a\u4e49<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>vim\u5b9a\u65f6\u4fdd\u5b58session \u628a\u5982\u4e0b\u4ee3\u7801\u4fdd\u5b58\u4e3asess.vim let g:sname = strftime( &#8230; <a title=\"vim\u5c0f\u6280\u5de7\" class=\"read-more\" href=\"https:\/\/189505.xyz\/?p=139\" aria-label=\"More on vim\u5c0f\u6280\u5de7\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"_links":{"self":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/139"}],"collection":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=139"}],"version-history":[{"count":13,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions"}],"predecessor-version":[{"id":525,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions\/525"}],"wp:attachment":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}