LINUX vi(vim) 高亮显示语法文件

来源:互联网 发布:mac 一定要分两个 区 编辑:程序博客网 时间:2024/06/05 18:12

" 在目录 /etc/ 下面,有个名为vimrc的文件,
" 这是系统中公共的vim配置文件,对所有用户都有效。而在每个用户的主
" 目录下,都可以自己建立私有的配置文件,命名为:.vimrc

" 取消自动注释
au FileType c,cpp setlocal comments-=:// comments+=f://
" 设置编码支持
let &termencoding=&encoding
set fileencodings=utf-8,gbk,gb2312,ucs-bom,cp936
" 语法高亮
syntax on
" 设置 tab 站位符长度
set tabstop=4
set shiftwidth=4
" 设置自动对齐
set cindent
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
" 取消行号显示
set nonu
" 设置行号显示
set nu
if &term=="xterm"
    set t_Co=8
    set t_Sb=^[[4%dm
    set t_Sf=^[[3%dm
endif

"设置光标位于最近修改的一行

if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

 

原创粉丝点击