Vim配置文件

在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

相关文章
相关标签/搜索