vim默认配置功能较少,以下提供一种我自己喜欢的vim的配置。
打开vi ~/.vimrc(有可能没有这个文件,自己创建就好)
set nu "show number
syntax on "syntax highlight
set cursorline "have cursorline
set cindent "
set smartindent "
set autoindent "
set ignorecase
set hlsearch "highlight search word
set shiftwidth=4 "
set tabstop=4 "tab = 4
map <silent> <F10> :TlistToggle<cr> "use <Fn> to open/close Tlist
"let Tlist_Auto_Open=1 "每次自动打开Tlist
let Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的
let Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vim
"let Tlist_Use_Right_Window = 1 "在右侧窗口中显示taglist窗口
set showmatch "设置自动检测括号是否匹配
set incsearch
set ruler
set laststatus=2 "显示当前文件名
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif "自动跳转到上次文件打开的位置
"set fdm=syntax
然后vi一个文件,会发现很漂亮哦