{"id":139,"date":"2023-05-15T11:17:26","date_gmt":"2023-05-15T03:17:26","guid":{"rendered":"https:\/\/boostup.cf\/?p=139"},"modified":"2026-09-05T11:18:51","modified_gmt":"2026-09-05T03:18:51","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-6af9c285c6826\" 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-6af9c285c6826\"><\/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><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/189505.xyz\/?p=139\/#sipu_%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%87%E4%BB%B6_su_%E8%A2%AB_vim_%E5%BD%93%E4%BD%9C_cuda_%E6%96%87%E4%BB%B6%E8%AF%AD%E6%B3%95%E5%A4%84%E7%90%86\" title=\"\nsipu \u81ea\u5b9a\u4e49\u6587\u4ef6 .su \u88ab vim \u5f53\u4f5c cuda \u6587\u4ef6\u8bed\u6cd5\u5904\u7406 \n\">\nsipu \u81ea\u5b9a\u4e49\u6587\u4ef6 .su \u88ab vim \u5f53\u4f5c cuda \u6587\u4ef6\u8bed\u6cd5\u5904\u7406 \n<\/a><ul class='ez-toc-list-level-2'><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/189505.xyz\/?p=139\/#%E8%AF%86%E5%88%AB_su_%E6%96%87%E4%BB%B6%E4%B8%BA_cuda\" title=\"\n\u8bc6\u522b .su \u6587\u4ef6\u4e3a cuda \n\">\n\u8bc6\u522b .su \u6587\u4ef6\u4e3a cuda \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/189505.xyz\/?p=139\/#%E5%A2%9E%E5%8A%A0%E5%85%B3%E9%94%AE%E5%AD%97clusterDim_clusterIdx\" title=\"\n\u589e\u52a0\u5173\u952e\u5b57clusterDim clusterIdx \n\">\n\u589e\u52a0\u5173\u952e\u5b57clusterDim clusterIdx \n<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/189505.xyz\/?p=139\/#project_local_hpp_as_cuda_for_sipu_project%E5%8F%AF%E9%80%89\" title=\"\nproject local: hpp as cuda for sipu project(\u53ef\u9009) \n\">\nproject local: hpp as cuda for sipu project(\u53ef\u9009) \n<\/a><\/li><\/ul><\/li><\/ul><\/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<h1><span class=\"ez-toc-section\" id=\"sipu_%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%87%E4%BB%B6_su_%E8%A2%AB_vim_%E5%BD%93%E4%BD%9C_cuda_%E6%96%87%E4%BB%B6%E8%AF%AD%E6%B3%95%E5%A4%84%E7%90%86\"><\/span>\nsipu \u81ea\u5b9a\u4e49\u6587\u4ef6 .su \u88ab vim \u5f53\u4f5c cuda \u6587\u4ef6\u8bed\u6cd5\u5904\u7406<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h2><span class=\"ez-toc-section\" id=\"%E8%AF%86%E5%88%AB_su_%E6%96%87%E4%BB%B6%E4%B8%BA_cuda\"><\/span>\n\u8bc6\u522b .su \u6587\u4ef6\u4e3a cuda<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre><code>cat \/data\/like\/vim-port-all\/config\/.vim\/filetype.vim \nau BufNewFile,BufRead *.cl setf opencl\n&quot; sioriign su file as cuda file\nau BufNewFile,BufRead *.su setfiletype cuda<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"%E5%A2%9E%E5%8A%A0%E5%85%B3%E9%94%AE%E5%AD%97clusterDim_clusterIdx\"><\/span>\n\u589e\u52a0\u5173\u952e\u5b57clusterDim clusterIdx<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre><code>cat \/data\/like\/vim-port-all\/config\/.vim\/after\/syntax\/cuda.vim\n&quot; SiPU-specific CUDA-like built-in variables.\nsyntax keyword cudaVariable clusterDim clusterIdx<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"project_local_hpp_as_cuda_for_sipu_project%E5%8F%AF%E9%80%89\"><\/span>\nproject local: hpp as cuda for sipu project(\u53ef\u9009)<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>sikernel \u4f1a\u628a device code \u5199\u5728hpp\u6587\u4ef6,<strong>device<\/strong>, blockIdx \u7b49 cuda\u4e13\u5c5e keyword   \u5728 .hpp \u6587\u4ef6\u6ca1\u6709\u8bed\u6cd5\u9ad8\u4eae<br \/>\n\u8bbe\u7f6e project local .vimrc<\/p>\n<pre><code>augroup project_cuda_hpp\n  autocmd!\n  autocmd BufRead,BufNewFile *.hpp set ft=cuda\naugroup END\n<\/code><\/pre>\n<p>\u5e76\u5728\u6839 .vimr \u6587\u4ef6\u914d\u7f6e: <\/p>\n<pre><code>&quot;&quot;&quot; https:\/\/akrabat.com\/using-vimrc-for-project-specific-settings\/\n&quot;&quot; vim \u6bcf\u4e2a\u9879\u76ee\u6709\u81ea\u5df1\u7684.vimr\u914d\u7f6e\u6587\u4ef6\nset exrc\nset secure\n&quot;&quot; end vim \u6bcf\u4e2a\u9879\u76ee\u6709\u81ea\u5df1\u7684.vimr\u914d\u7f6e\u6587\u4ef6\n<\/code><\/pre>\n<p>\u6ce8\u610f\uff1aautocmd BufRead,BufNewFile <em>.hpp set ft=cuda\u53ef\u4ee5\u628ahpp\u5f53\u4f5ccuda, autocmd BufRead,BufNewFile <\/em>.hpp setfiletype cuda\u6ca1\u6709\u4f5c\u7528\uff0cvim \u4ecd\u65e7\u663e\u793ahpp\u662fcpp \u6587\u4ef6\uff0c\u4ec0\u4e48\u539f\u56e0\uff1f<br \/>\nset ft=cuda\u662f\u5f3a\u5236\u4fee\u6539\u3002setfiletype cuda, \u5148\u68c0\u6d4b\u6587\u4ef6\u5df2\u7ecf\u662fcpp, \u5c31\u4e0d\u4f1a\u8986\u76d6\u4e86\uff0c\u9664\u975e\u539f\u6765\u6ca1\u6709\u68c0\u6d4b\u5230 filetype,\u518d\u8bbe\u7f6e\u6210 cuda.<\/p>\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":20,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions"}],"predecessor-version":[{"id":707,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions\/707"}],"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}]}}