etc/vim/gvimrc文件配置

本文介绍了Vim编辑器的基本配置方法,包括设置文件编码、语法高亮、自动补全等功能,以及如何通过配置文件gvimrc来实现个性化设置。


" Make external commands work through a pipe instead of a pseudo-tty
"set noguipty

" You can also specify a different font, overriding the default font
"if has('gui_gtk2')
"  set guifont=Bitstream/ Vera/ Sans/ Mono/ 12
"else
"  set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1
"endif

" If you want to run gvim with a dark background, try using a different
" colorscheme or running 'gvim -reverse'.
" http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/ has examples and
" downloads for the colorschemes on vim.org

" Source a global configuration file if available
if filereadable("/etc/vim/gvimrc.local")
  source /etc/vim/gvimrc.local
endif

color murphy

" Basics {
     " 关闭兼容模式
     set nocompatible
   
     " 设定文件浏览器目录为当前目录
     set bsdir=buffer
     set autochdir
   
     " 设置编码
     set enc=utf-8
   
     " 设置文件编码
     set fenc=utf-8
   
     " 设置文件编码检测类型及支持格式
     set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
   
     " 指定菜单语言
     set langmenu=zh_CN.UTF-8
     source $VIMRUNTIME/delmenu.vim
     source $VIMRUNTIME/menu.vim
   
     " 与windows共享剪切板
     set clipboard+=unnamed
   
     " 键盘操作
     map <up> gk
     map <down> gj
 

 
     " 命令行高度
     set cmdheight=1
   
     " 中文帮助
     if version > 603
     set helplang=cn
     endif
 
     " 增强检索功能
     set tags=./tags,./../tags,./**/tags
   

 " }
 
      
 " Visual {
     
     " 设置开启语法高亮
     syntax on
 
     " 设置语法高亮度
     " set syn=cpp
   
 
     " 查找结果高亮度显示
     set hlsearch
   
     " tab宽度
     set tabstop=4
     set cindent shiftwidth=4
     set autoindent shiftwidth=4
     " }
 
     " Autocommands {
     " 自动补全
     filetype plugin indent on
 
     " 只在下列文件类型被侦测到的时候显示行号,普通文本文件不显示
     if has("autocmd")
        autocmd FileType xml,html,c,cs,java,perl,shell,bash,cpp,python,vim,php,ruby set number
        autocmd FileType xml,html vmap <c -o> <esc>'<i <!--<ESC>o<esc>'>o-->
        autocmd FileType java,c,cpp,cs vmap <c -o> <esc>'<o /*<ESC>'>o*/
        autocmd FileType html,text,php,vim,c,java,xml,bash,shell,perl,python setlocal textwidth=100
        autocmd Filetype html,xml,xsl source $VIMRUNTIME/plugin/closetag.vim
      " Error happend, repair needed
      " autocmd BufReadPost *
      "    / if line("'/"") > 0 && line("'/"") < = line("$") |
      "    /   exe "normal g`/"" |
      "    / endif
     endif " has("autocmd")
   
     " 自动完成
     autocmd FileType python set omnifunc=pythoncomplete#Complete
     autocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJS
     autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
     autocmd FileType css set omnifunc=csscomplete#CompleteCSS
     autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
     autocmd FileType php set omnifunc=phpcomplete#CompletePHP
     autocmd FileType c set omnifunc=ccomplete#Complete
 
     " auto complete
     " inoremap } }<esc>: <cr>O
 " }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值