vim: 设置vim交换文件的目录

35 views
Skip to first unread message

Copper Hill

unread,
Jul 2, 2009, 5:55:37 AM7/2/09
to worldhunter
http://www.blogjava.net/zhyiwww/archive/2009/05/31/279233.html


通常vim会在你编辑文件的目录创建交换文件,比如你编辑的文件是aaa.txt,vim会生成aaa.txt.swp文件,有的时候,不希望在当前目
录,可以把交换文件放到其他的目录里面去。
debian系统下
修改/etc/vim/vimrc
添加 set directory=/tmp就可以了

Hong Zhaogang

unread,
Jul 30, 2009, 5:32:05 AM7/30/09
to worldhunter
function! RangeFill(stop)
let l:num = 1
while l:num <= a:stop
call append(line('$'), l:num)
let l:num = l:num+1
endwhile
endfunction

function! DigitAlign(d,w)
let l:ret = a:d
while len(l:ret) < a:w
let l:ret = "a".l:ret
endwhile
let l:ret = substitute(l:ret,"a","0","g")
return l:ret
endfunction

function! LRCFix(step,flag)
" put current lrc file forward/backward step*10 ms
:g/^\[\d\+:\d\+.\d\+\]/s/^\[\(\d\+\):\(\d\+\).\(\d\+\)\(.*\)$/
\="[".((submatch(1)*60+submatch(2))*1000+submatch(3)*10).submatch(4)/
if a:flag > 0
:g/^\[\d\+\]/s/^\[\(\d\+\)\(.*\)$/\="[".(submatch
(1)+a:step*10).submatch(2)/
else
:g/^\[\d\+\]/s/^\[\(\d\+\)\(.*\)$/\="[".(submatch(1)-
a:step*10).submatch(2)/
endif
:g/^\[\d\+\]/s@^\[\(\d\+\)\(.*\)$@\="[".DigitAlign(submatch(1)/
60000,2).":".DigitAlign((submatch(1)%60000)/1000,2).".".DigitAlign
(((submatch(1)%60000)%1000)/10,2).submatch(2)@
:g/^\[-\d\+\]/s@^\[-\d\+\(.*\)$@[00:00.00\1@
endfunction
Reply all
Reply to author
Forward
0 new messages