在Linux下是避免不了的要使用Vim/vi,楓竹夢今天分享一下本身的vim配置的文件。linux
該文件通常保存爲~/.vimrc
。具體的內容以下:vim
set ts=4
set expandtab
set nu
set autoindent
set cindent
set hlsearch
set shiftwidth=4
set sts=4
function! HeaderInsert()
call setline(1, '/**********************************************************************')
call append(1, ' * Filename : '.bufname("%"))
call append(2, ' * Description : ')
call append(3, ' * Author : Furzoom')
call append(4, ' * Email : mn@furzoom.com')
call append(5, ' * Date : '.strftime("%Y-%m-%d"))
call append(6, ' * Last modified : '.strftime("%Y-%m-%d"))
call append(7, ' * Version : 0.0.1')
call append(8, ' **********************************************************************/')
endfunction
function! ModifiedDate()
call cursor(6,1)
if search('Last modified') != 0
let line = line('.')
call setline(line," * Last modified: ".strftime("%Y-%m-%d"))
endif
endfunction
:map <F2> :call HeaderInsert()<CR>G2o<ESC>ggjjA
:autocmd FileWritePre,BufWritePre *.c ks|call ModifiedDate()|'s
將快捷鍵綁定到F2上。markdown
更多請參考Vim配置。app