vim小技巧

vim定时保存session

把如下代码保存为sess.vim

let g:sname = strftime('.session/%Y_%m_%d__%H_%M_%S.vim')
function! SaveSession(timer)
  if !isdirectory(".session")
    call mkdir(".session", "p", 0755)
  endif
  execute "mksession!" g:sname
endfunction
let timer = timer_start(180000, 'SaveSession', {'repeat':-1})

然后在vim中执行

source sess.vim

在json数组中跳转到端点的[]括号

va[
比如光标在d处,按下va[,可以跳转到[]上
[
{a:b},
{c:d}
]

delete hidden buffer

function DeleteHiddenBuffers()
    let tpbl=[]
    call map(range(1, tabpagenr('$')), 'extend(tpbl, tabpagebuflist(v:val))')
    for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)==-1')
        silent execute 'bwipeout' buf
    endfor
endfunction

然后

:call DeleteHiddenBuffers()

build from source

configure的命令

set -x
make distclean
export LD_LIBRARY_PATH=/tvm/python3.8-compile/python3.8/lib:${LD_LIBRARY_PATH}
export PATH=/tvm/python3.8-compile/python3.8/bin/:${PATH}
export LDFLAGS="-rdynamic"
#vi_cv_path_python=/home/like12/opt/python3.8/bin/python3.8
./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

Leave a Comment