Created
September 11, 2014 22:02
-
-
Save syui/8192e440c49d879338eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"filename : airautofile.vim | |
"" ファイルを保存して終了するときに、ファイル名を指定行に記述する | |
""" setting | |
"" 有効、無効の設定 (on=1, {off=0, null}) | |
" let g:air_autofile_cmd = 1 | |
"" 行の指定 (nullの場合は最終行) | |
" let g:air_autofile_line = 1 | |
"" 先頭につける文章を指定する (def : " ) | |
" let g:air_autofile_commnet = '"filename : ' | |
if !exists("g:air_autofile_cmd") | |
let g:air_autofile_cmd = 0 | |
en | |
if exists("g:air_autofile_commnet") == 0 | |
let g:air_autofile_commnet = '" ' | |
en | |
fu! s:air_autofile_write() | |
let s:airline = g:air_autofile_commnet . expand("%:t") | |
if exists("g:air_autofile_line") | |
if s:airline != getline(g:air_autofile_line) | |
call append(g:air_autofile_line - 1, s:airline) | |
en | |
el | |
if s:airline != getline("$") | |
call append("$", s:airline) | |
en | |
en | |
endf | |
com! -nargs=0 -bar AirAutoFileWrite call <SID>air_autofile_write() | |
nn <Plug>(AirAutoFileWrite) :AirAutoFileWrite<CR> | |
fu! s:air_autofile_cmd() | |
aug airautofile_vimrc | |
au! | |
" QuitPreは、:wq を実行した時に発動するオートコマンドです | |
au QuitPre * silent! AirAutoFileWrite | |
aug END | |
endf | |
if g:air_autofile_cmd >= 1 | |
silent! call <SID>air_autofile_cmd() | |
en |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment