记住文件上次打开的位置
可在~/.vimrc下加入如下配置:
"remember last update or view postion"
" Only do this part when compiled with support for autocommands
if has("autocmd")
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
endif
设置tab的宽度
可在~/.vimrc文件中写入以下配置将tab的宽度设置成为4个空格:
set tabstop=4
设置自动缩进
在~/.vimrc文件中写入以下配置:
set shiftwidth=4
set smartindent