- gvim下的普通配置:
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,gb2312,gbk,latin1
"这个是自定义将文件写入存储介质时的字符集这里设为gb2312
" fileencodings=gb2312,gbk
endif
set nocompatible
"菜单栏通常还是要保留起, 即使在linux下的纯vim使用时, 也是保留起的 一是美观,而是有时候有些操作还是需要从菜单栏来操作
"set guioptions-=m
set guioptions-=T
set guifont=新宋体:h13
colorscheme desert
set shiftwidth=4
set softtabstop=4
set lines=36 columns=110
winpos 230 40
" 设置文件修改时自动载入, 自动保存
set autoread
set autowrite
set cursorline
set magic
set syntax=on
set incsearch
set hlsearch
"搜索时,忽略大小写
set ignorecase
"按F3实现NERDTree的自动切换
map <F3> :NERDTreeToggle<CR>
map <C-A> ggvGy
" vi中的所有字符都没有特殊含义!vim要与vi兼容, 但是在表示vim中一些特殊含义的时候, 就得
" 要把这些特殊符合,从兼容集cpoptions中去掉!
set cpoptions-=<
" 从cpoptions中去掉C, 启用行继续符 \, 解决“E10:..."问题
set cpoptions-=C
set cpoptions-=u "去掉和vi兼容的撤销undo u命令?
"统一的,用一个命令来解决vim和vi的兼容性问题
"那就是, 不要让vim去兼容,去管vi的, 完全使用vim的操作方式, 不管vi的,
"也就不用一个一个地来设置cpoptions了
"set nocompatible
"在insert mode下也可以 快速移动到行尾和行首"
inoremap hm <esc>I
inoremap <c-l> <esc>A
inoremap jk <esc>
inoremap jj <esc>ji
inoremap kk <esc>ki
inoremap hh <esc>ha
inoremap ll <esc>la
inoremap nn <esc>ji
set nu
" 自动匹配括号, 引号
inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {}<ESC>i
inoremap ' ''<ESC>i
" allow backspacing over everything in insert mode
set bs=indent,eol,start
" always set autoindenting on
set ai
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=100
set ruler
" Only do this part when compiled with support for autocommands
if has("autocmd")
augroup redhat
autocmd!
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
" don't write swapfile on most commonly used directories for NFS mounts or USB sticks
autocmd BufNewFile,BufReadPre /media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp
" start with spec file template
autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec
augroup END
endif
if has("cscope") && filereadable("/usr/bin/cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
filetype plugin on
if &term=="xterm"
set t_Co=8
set t_Sb=[4%dm
set t_Sf=[3%dm
endif
" Don't wake up system with blinking cursor:
" http://www.linuxpowertop.org/known.php
let &guicursor = &guicursor . ",a:blinkon0"
" 设置不生成备份和交换文件,这个要放在最后
" 同样的设置,后面的设置(可能从$runtime/...中引入其他配置)会覆盖前面的设置
" 如这里,当后面设置set backup, 将会覆盖前面的set nobackup
" 从而一直找不到生成backup文件的原因!!
" 将系统剪切板设置为默认的 “未命名”寄存器,便于粘贴
set clipboard=unnamed
cd ~
" 如果需要想对特定的文件类型使用特定的字体,则可以将下面的语句加入到vimrc文件中去:
" autocmd BufEnter *. txt set guifont = Arial \ 12
"支持鼠标操作, 选择, 拖动等操作, 这个很有用
set mouse=a
set nobackup
set noswapfile
根据文件类型设置缩进格式
"au FileType html,python,vim,javascript set shiftwidth=2
"
从这里开始设置vundle的安装配置.=============
set nocompatible
filetype off
"这里来设置/ 规定vundle这个管理插件本身的运行路径
set rtp+=$VIM/vimfiles/bundle/vundle/
" 这里规定 bundle安装的其他插件的放置路径, 如果rc的参数为空,
" 就默认的放在$HOME/.vim/bundle/这个目录下.
call vundle#rc('$VIM/vimfiles/bundle/')
Plugin 'gmarik/vundle.git' "实际上github上的个人的vundle项目可以不用加.git后缀.
Plugin 'scrooloose/nerdtree'
map tt :NERDTreeToggle<CR>
map ff :NERDTreeFind<CR>>>
Plugin 'bling/vim-airline'
"Plugin 'taglist.vim'
"Plugin 'snipMate'
Plugin 'minibufexplorerpp'
Plugin 'mattn/emmet-vim'
Plugin 'godlygeek/tabular'
" 注意这个跟imap插入模式下的 <c-l> 不同:
map <c-l> :Tab /=<CR>
Plugin 'Shougo/neocomplcache'
Plugin 'asins/vim-dict'
"Plugin 'mbbill/echofunc'
Plugin 'DoxygenToolkit.vim'
Plugin 'colorizer'
Plugin 'terryma/vim-multiple-cursors'
"Plugin 'Kien/ctrlp.vim'
"
"Plugin 'ctrlpvim/ctrlp.vim'
"Plugin 'nathanaelkane/vim-indent-guides'
call vundle#end()
filetype plugin indent on
"vim-indent-guides
let g:indent_guides_auto_colors = 0
let g:indent_guides_guide_size = 1
let g:indent_guides_start_level = 2
let g:indent_guides_enable_on_vim_startup = 1
noremap <leader>sj :IndentGuidesToggle<cr>
autocmd VimEnter Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
autocmd VimEnter Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
hi IndentGuidesOdd guibg=red ctermbg=3
hi IndentGuidesEven guibg=green ctermbg=4
let g:user_emmet_leader_key="<c-e>"
let NERDTreeShowBookmarks=1
nmap <F4> :NERDTreeToggle<CR>
" set statusline=%{EchoFuncGetStatusLine()}
" let g:EchoFuncShowOnStatus = 1
"Taglist
map <F6> :Tlist<CR>
"let Tlist_Auto_Open = 1
let Tlist_Use_Right_Window=1
nmap <F7> :ctags -R<CR>
""configure Doxygen variables
let g:DoxygenToolkit_commentType = "php"
let g:DoxygenToolkit_authorName="liy"
let s:licenseTag = "Copyright(C)\<enter>"
let s:licenseTag = s:licenseTag . "For free\<enter>"
let s:licenseTag = s:licenseTag . "All right reserved\<enter>"
let g:DoxygenToolkit_licenseTag = s:licenseTag
let g:DoxygenToolkit_briefTag_funcName="yes"
let g:doxygen_enhanced_color=1
let g:DoxygenToolkit_briefTag_pre="@brief\t"
let g:DoxygenToolkit_paramTag_pre="@params\t"
let g:DoxygenToolkit_returnTag="@return\t"
let g:DoxygenToolkit_blockHeader="--------------------------------------------------------------------------"
""let g:DoxygenToolkit_blockFooter="--------------------------------------------------------------------------"
imap <leader>cm <esc>:Dox<CR>
map cm :Dox<CR>
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:20'
let g:NERDTreeChDirMode =2
let g:ctrlp_working_path_mode = 'rw'
let g:ctrlp_by_filename=1
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$\|.rvm$'
let g:ctrlp_match_window_bottom=1
let g:ctrlp_max_height=15
let g:ctrlp_match_window_reversed=0
let g:ctrlp_mruf_max=500
let g:ctrlp_follow_symlinks=1
" NERD_commenter
let NERDSpaceDelims=1
let NERDCompactSexyComs=1
let g:NERDDefaultAlign = 'left'
"Plugin 'terryma/vim-multiple-cursors'
let g:multi_cursor_use_default_mapping=1
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-b>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
在当前目录及其子目录下**, 的所有文件* 中, 搜索当前光标所在的单词. 使用ss
"表示搜索(sou, suo 的意思)
map ss :noautocmd execute "vimgrep /".expand("<cword>")."/gj **/*" <Bar> cw<CR>