vim 实用配置

修改文件~/.vimrc 如下:

set nu " 显示行号
colorscheme torte " 设定配色方案
set tabstop=4 " 设定 tab 长度为 4
set nobackup " 覆盖文件时不备份
set nocompatible "not compatible with vi
set showmatch
set incsearch
set wrap
"set fencs=utf-8
" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)
"set mouse=a
"set selection=exclusive
"set selectmode=mouse,key

"文件自动检测外部更改
set autoread

"c文件自动缩进
set cindent
"set shiftwidth=4

"自动对齐
set autoindent

"智能缩进
set smartindent

"高亮查找匹配
set hlsearch

set laststatus=2 " 总是显示状态栏
highlight StatusLine cterm=bold ctermfg=yellow ctermbg=blue
" 获取当前路径,将$HOME转化为~
function! CurDir()
let curdir = substitute(getcwd(), $HOME, "~", "g")
return curdir
endfunction
set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%] "显示文件名:总行数,总的字符数
set ruler "在编辑过程中,在右下角显示光标位置的状态行

"set statusline=[%n]\ %f%m%r%h\ \|\ \ pwd:\ %{CurDir()}\ \ \|%=\|\ %l,%c\ %p%%\ \|\ ascii=%b,hex=%b%{((&fenc==\"\")?\"\":\"\ \|\ \".&fenc)}\ \|\ %{$USER}\ @\ %{hostname()}\

 

posted @ 2017-12-29 16:46  cicero  阅读(215)  评论(0编辑  收藏  举报