[vim] NewFromFile snippet
http://gist.github.com/296629
fun! s:NewFromFile(file)
let file = a:file
if strlen( a:file ) == 0
let file = expand('%')
endif
let newfile = input('New Filename:',file,'file')
cal system(printf('cp %s %s',file,newfile))
exec 'tabedit ' . newfile
endf
com! -nargs=? -complete=file NewFromFile :cal s:NewFromFile(<q-args>)
" Usage:
:NewFromFile (current editing file)
:NewFromFile path/to/file
completion supported.
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.38.15.179
※ 編輯: kornelius 來自: 114.38.15.179 (02/06 17:28)
Editor 近期熱門文章
PTT數位生活區 即時熱門文章