vim 配置文件

来源:互联网 发布:英语来源 知乎 编辑:程序博客网 时间:2024/06/14 09:16
source $VIMRUNTIME/vimrc_example.vimsource $VIMRUNTIME/mswin.vimbehave mswin"设置vim外观colorscheme elflord"set guifont=Monaco\ 10set guifont=Monaco\ for\ Powerline\ 10set nuset ai "设置自动缩进set ts=4set sw=4 "设置自动缩进长度为4格set showmatch "设置括号匹配set matchtime=1 "括号匹配显示时间为1(最短,似乎1,2,3,4可选)"设置不备份"set nobackup""设置默认目录"set completeopt=longest,menu"设置默认编码为 utf8set encoding=utf-8"设置文件编码检测类型及支持格式set fileencodings=utf-8,gbk,ucs-bom,gb18030,gb2312,cp936"指定菜单语言set langmenu=zh_CN.UTF-8"使用中文帮助 use chinese helpset helplang=cnsource $VIMRUNTIME/delmenu.vimsource $VIMRUNTIME/menu.vim"更改 zencoding 默认的展开命令let g:user_emmet_expandabbr_key = '<c-e>'let g:use_emmet_complete_tag = 1" NERDTree 开关按钮map <F9> :NERDTreeToggle<CR>:map <F7> :MRU<CR>" 设置taglist 的窗口显示在右边map <F8> :TlistToggle<CR>let Tlist_Use_Right_Window=1let Tlist_Ctags_Cmd='ctags'  "let Tlist_Show_One_File=0   "让taglist 可以同时展示多个文件的函数列表,如果想要只有1个,设置为1默认为0let Tlist_File_Fold_Auto_Close=1  "非当前文件,函数列表折叠隐藏let Tlist_Process_File_Always=0 "是否一直处理tags 1:处理,0:不处理。不是一直实时更新tagslet Tlist_Inc_Winwidth=0"gvimfullscreen.dll 使gvim全屏,按F11全屏if has("gui_running") && has("win32")map <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR> endif"gvim 界面简化set guioptions-=m "不显示菜单 set guioptions-=T "不显示工具栏set guioptions-=r "不显示右侧的滚动条set guioptions-=L "不显示左侧的滚动条"将ESC映射为 jjimap jj <ESC>imap ww <C-S>au BufRead,BufNewFile *.js set syntax=jquerylet g:indent_guides_start_level=2set completeopt=longest,menu inoremap <C-]><C-X><C-]>au! BufRead,BufNewFile *.json set filetype=json "设定json文件类型,自动高亮json语法augroup json_autocmd   autocmd!   autocmd FileType json set autoindent   autocmd FileType json set formatoptions=tcq2l   autocmd FileType json set textwidth=78 shiftwidth=2   autocmd FileType json set softtabstop=2 tabstop=8   autocmd FileType json set expandtab   autocmd FileType json set foldmethod=syntax augroup END " vim-Powerline插件set laststatus=2set t_Co=256"let g:Powerline_symbols = 'unicode'let g:Powerline_symbols = 'fancy'" 括号补全"inoremap ( ()<left>"inoremap [ []<left>"inoremap { {}<left>"Vundle 插件管理" vundle {set rtp+=~/.vim/bundle/vundle/" 如果在windows下使用的话,设置为 " set rtp+=$HOME/.vim/bundle/vundle/" }"" let Vundle manage Vundle" required! "Bundle 'gmarik/vundle'" My Bundles here:"" original repos on github" github上的用户写的插件,使用这种用户名+repo名称的方式" Bundle 'tpope/vim-fugitive'" Bundle 'Lokaltog/vim-easymotion'" Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}" Bundle 'tpope/vim-rails.git'" vim-scripts repos" vimscripts的repo使用下面的格式,直接是插件名称" non github reposo" 非github的插件,可以直接使用其git地址" Bundle 'git://git.wincent.com/command-t.git'" ..."" Brief help" :BundleList          - list configured bundles" :BundleInstall(!)    - install(update) bundles" :BundleSearch(!) foo - search(or refresh cache first) for foo" :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles" vundle主要就是上面这个四个命令,例如BundleInstall是全部重新安装,BundleInstall!则是更新" 一般安装插件的流程为,先BundleSearch一个插件,然后在列表中选中,按i安装" 安装完之后,在vimrc中,添加Bundle 'XXX',使得bundle能够加载,这个插件,同时如果" 需要配置这个插件,也是在vimrc中设置即可" see :h vundle for more details or wiki for FAQ" NOTE: comments after Bundle command are not allowed.."autoload _vimrc 无需重启使用新的vim定制autocmd! bufwritepost ~/.vimrc source %""""""""""""----------------------------------------------------------------------------------------------------------set guifont=Courier_New:h17"set background=black "背景使用黑色 color torteset autoindentset cindent" Tab键的宽度set tabstop=4" 统一缩进为4set softtabstop=4set shiftwidth=4" 不要用空格代替制表符set noexpandtab" 在行和段开始处使用制表符set smarttab" 为C程序提供自动缩进set smartindent"自动补全"":inoremap ( ()<ESC>i"":inoremap ) <c-r>=ClosePair(')')<CR>"":inoremap { {<CR>}<ESC>O"":inoremap } <c-r>=ClosePair('}')<CR>"":inoremap [ []<ESC>i"":inoremap ] <c-r>=ClosePair(']')<CR>":inoremap " ""<ESC>i"":inoremap ' ''<ESC>iset guioptions=r   "开启滚动条"不高亮显示匹配括号let loaded_matchparen = 1"去掉声音set noeb "增强模式中的命令行自动完成操作set wildmenu" 使回格键(backspace)正常处理indent, eol, start等set backspace=2" 允许backspace和光标键跨越行边界set whichwrap+=<,>,h,l" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)set mouse=aset selection=exclusiveset selectmode=mouse,key"自动开启时需要在~/.vimrc中进行配置:autocmd FileType css set omnifunc=csscomplete#CompleteCSSautocmd FileType html set omnifunc=htmlcomplete#CompleteTags 

关闭高亮匹配括号:

:NoMatchParen

如果要再开启,可以用

:DoMatchParen

如果要更改颜色,可以用hi,例如:

:hi MatchParen ctermbg=blue ctermfg=white

如果要更改需要匹配的符号,可以编辑matchpairs选项

更多0


0 0