我的VIM配置

近来,键盘敲的手疼,所以贴出VIM配置,看看是什么原因导致的手疼,是键盘太差了,还是vim配置有问题。

set nu
set ts=4
set expandtab
set autoindent
set shiftwidth=4

set encoding=utf-8
set termencoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936

set backspace=indent,eol,start
filetype plugin indent on

"快捷键的前缀字符,默认是\,但是因为小指疼,改为-
let mapleader="-"
"使vim配置生效
nnoremap <leader>ss :source ~/.vimrc<cr>
"搜索高亮
set hlsearch

"set iskeyword=@,48-57,_,192-255,^.,^/,^:

set rtp+=~/.vim/bundle/Vundle.vim
"set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim/
set laststatus=2
"set t_Co=256
let g:Powerline_symbols = 'fancy'

set nocompatible              " be iMproved, required

filetype off
call vundle#begin()

Plugin 'gmarik/Vundle.vim'
Plugin 'fatih/vim-go'
Plugin 'Valloric/YouCompleteMe'
Plugin 'majutsushi/tagbar'
Plugin 'vim-syntastic/syntastic'
Plugin 'scrooloose/nerdcommenter' "多行注释,leader键+cc生成, leader+cu删除注释
Plugin 'Lokaltog/vim-powerline'
Plugin 'vim-scripts/Markdown'
Plugin 'altercation/vim-colors-solarized'
Plugin 'Raimondi/delimitMate'
Plugin 'Lokaltog/vim-easymotion' "快速跳转,按两下leader键和f组合  
Plugin 'vim-scripts/grep.vim' "在命令行模式使用grep命令,:Grep

call vundle#end()
filetype on

"solarized 
syntax enable
set background=dark
"let g:solarized_termcolors=256
"colorscheme solarized

"molokai
"let g:molokai_original = 1
"let g:rehash256 = 1
let g:go_def_mapping_enabled=1
au FileType go nmap <c-t> <Plug>(go-def-pop)
set runtimepath^=~/.vim/bundle/ctrlp.vim
"F9 弹出Tagbar
nmap <F9> :TagbarToggle<CR>
nmap cp :CtrlP<cr>
nmap <F6> :bn<cr>
nmap <F5> :bp<cr>
nmap bn :bn<cr>
nmap bm :bp<cr>
nmap <Leader> :Grep<cr>

nmap <Leader>t :NERDTreeToggle<CR>
"保持原格式粘贴
nnoremap <F12> :set paste<CR>
"exit window
nmap <Leader>q :q<CR> 
nmap <Leader>aq :qa<CR> 
nmap <Leader>p "+p 
" 定义快捷键保存当前窗口内容  
nmap <Leader>w :w<CR>
" 定义快捷键保存所有窗口内容并退出 vim  
nmap <Leader>WQ :wa<CR>:q<CR> 
" 依次遍历子窗口  
nnoremap ww <C-W><C-W>  
" 跳转至右方的窗口  
nnoremap wl <C-W>l  
" 跳转至左方的窗口  
nnoremap wh <C-W>h  
" 跳转至上方的子窗口  
nnoremap wk <C-W>k  
" 跳转至下方的子窗口  
nnoremap wj <C-W>j  
" 跳到行尾
nnoremap ee g_
" 向上翻页
nnoremap bb <C-b>
" 向下翻页
nnoremap ff <C-f>

" YCM 补全菜单配色  
" 菜单  
highlight Pmenu ctermfg=2 ctermbg=3 guifg=#005f87 guibg=#EEE8D5  
" 选中项  
highlight PmenuSel ctermfg=2 ctermbg=3 guifg=#AFD700 guibg=#106900  
" 补全功能在注释中同样有效  
let g:ycm_complete_in_comments=1  
" 允许 vim 加载 .ycm_extra_conf.py 文件,不再提示  
let g:ycm_confirm_extra_conf=0  
" 开启 YCM 标签补全引擎  
let g:ycm_collect_identifiers_from_tags_files=1  
" 引入 C++ 标准库tags  
set tags+=/data/misc/software/misc./vim/stdcpp.tags  
" YCM 集成 OmniCppComplete 补全引擎,设置其快捷键  
"inoremap <leader>; <C-x><C-o>  
" 补全内容不以分割子窗口形式出现,只显示补全列表  
set completeopt-=preview  
" 从第一个键入字符就开始罗列匹配项  
let g:ycm_min_num_of_chars_for_completion=1  
" 禁止缓存匹配项,每次都重新生成匹配项  
let g:ycm_cache_omnifunc=0  
" 语法关键字补全  
let g:ycm_seed_identifiers_with_syntax=1  
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'  

"cscope 快捷键
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>

"easymotion
map <Leader><leader>h <Plug>(easymotion-linebackward)
map <Leader><Leader>j <Plug>(easymotion-j)
map <Leader><Leader>k <Plug>(easymotion-k)
map <Leader><leader>l <Plug>(easymotion-lineforward)
" 重复上一次操作, 类似repeat插件, 很强大
map <Leader><leader>. <Plug>(easymotion-repeat)

wincmd w
autocmd VimEnter * wincmd w
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值