VIM 配置

我的VIM 配置

~/.vimrc

set nocp
set ru
syntax enable
syntax on  "语法高亮
set number  
set tabstop=4
set cursorline              " 突出显示当前行
set cursorcolumn    "突出显示当前列
set autoindent  "自动对齐
"set shiftwidth=4
filetype on  "自动识别文件格式;
set showmatch
set matchtime=5
set cindent
set showcmd " 命令行显示输入的命令
set showmode " 命令行显示vim当前模式
set hlsearch
"TagList设置
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1

"设置winmanager
"设置界面分割
"let g:winManagerWindowLayout = "BufExplorer,FileExplorer|TagList"
let g:winManagerWindowLayout = "TagList|NERDTree,BufExplorer"
"设置winmanager的宽度,默认为25
let g:winManagerWidth = 30
"定义打开关闭winmanager按键
nmap <silent> <F8> :WMToggle<cr>
"在进入vim时自动打开winmanager
let g:AutoOpenWinManager = 1
""""""""""""""""""""""""""""""
" miniBufexplorer Config
""""""""""""""""""""""""""""""
"方向键切换窗口
"let g:miniBufExplMapWindowNavArrows = 1
"let g:miniBufExplMapWindowNavVim = 1
"let g:miniBufExplMapCTabSwitchWindows = 1
"let g:miniBufExplMapCTabSwitchBufs = 1 
"let g:miniBufExplModSelTarget = 1
"解决FileExplorer窗口变小问题
"let g:miniBufExplForceSyntaxEnable = 1
"let g:miniBufExplorerMoreThanOne=2

"ctrlp 搜索配置
"改变CTLRP启动默认映射和默认的命令,vimrc中添加
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
"颜色的配置-molokai
colorscheme  molokai 
set t_Co=256
set background=dark
"let g:molokai_original = 0
"let g:rehash256 = 0

"-------NERD_tree------------
map <F3> :NERDTreeMirror<CR>
map <F3> :NERDTreeToggle<CR>
" 打开vim时,自动打开NERDTree
autocmd vimenter * NERDTree
"重新打开文件用于光标回到之前的位置
if has("autocmd")
   au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
   \| exe "normal g'\"" | endif
endif
"使能鼠标
"set mouse=a
" 自动切换到文件当前目录
set autochdir

"用于CPP的高亮
"cpp-enhanced-highlight
"高亮类,成员函数,标准库和模板
let g:cpp_class_scope_highlight = 1
let g:cpp_member_variable_highlight = 1
let g:cpp_concepts_highlight = 1
let g:cpp_experimental_simple_template_highlight = 1
let g:cpp_posix_standard = 1

"文件较大时使用下面的设置高亮模板速度较快,但会有一些小错误
"let g:cpp_experimental_template_highlight = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" cscope setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("cscope")
    set csprg=/usr/bin/cscope
    set csto=1
    set cst
    set nocsverb
    " add any database in current directory
    if filereadable("cscope.out")
        cs add cscope.out
    elseif $CSCOPE_DB != ""
        cs add $CSCOPE_DB
    endif
    set csverb
endif

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>
map  <F6> : cs find s <space>
map  <F7> : cs find g <space>
"git插件状态标志的设置
let g:NERDTreeIndicatorMapCustom = {
        \ "Modified"  : "★",
        \ "Staged"    : "S",
        \ "Untracked" : "■",
        \ "Renamed"   : "→",
        \ "Unmerged"  : "═",
        \ "Deleted"   : "¤",
        \ "Dirty"     : "×",
        \ "Clean"     : "√",
        \ "Unknown"   : "○"
        \ }
let g:NERDTreeShowIgnoredStatus=1
"airline插件设置
"let g:airline_theme="luna" 
"永久显示状态栏
set laststatus=2
"这个是安装字体后 必须设置此项" 
let g:airline_powerline_fonts = 1   
"打开tabline功能,方便查看Buffer和切换,这个功能比较不错"
"我还省去了minibufexpl插件,因为我习惯在1个Tab下用多个buffer"
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
"设置切换Buffer快捷键"
nnoremap <C-N> :bn<CR>
nnoremap <C-M> :bp<CR>
"Clang
map  <F2> : ClangFormat <space>

map <C-Down> <C-w>j
map <C-Up> <C-w>k
map <C-Left> <C-w>h
map <C-Right> <C-w>l
"""""""""""""""""""""""""""""""""""""""""""""""
" Seting clang-format
"""""""""""""""""""""""""""""""""""""""""""""""
"let g:clang_format#command = 'clang-format'
"nmap <F4> :ClangFormat<cr>
"autocmd FileType c ClangFormatAutoEnable
"let g:clang_format#detect_style_file = 1
"--------Tmux-------------------------
if exists('$TMUX')
  set term=screen-256color
endif
if exists('$ITERM_PROFILE')
  if exists('$TMUX')
    let &t_SI = "<Esc>[3 q"
    let &t_EI = "<Esc>[0 q"
  else
    let &t_SI = "<Esc>]50;CursorShape=1x7"
    let &t_EI = "<Esc>]50;CursorShape=0x7"
  endif
end
"Set map arros keysy in vim
if &term =~ '^screen' && exists('$TMUX')
    set mouse+=a
    " tmux knows the extended mouse mode
    set ttymouse=xterm2
    " tmux will send xterm-style keys when xterm-keys is on
    execute "set <xUp>=\e[1;*A"
    execute "set <xDown>=\e[1;*B"
    execute "set <xRight>=\e[1;*C"
    execute "set <xLeft>=\e[1;*D"
    execute "set <xHome>=\e[1;*H"
    execute "set <xEnd>=\e[1;*F"
    execute "set <Insert>=\e[2;*~"
    execute "set <Delete>=\e[3;*~"
    execute "set <PageUp>=\e[5;*~"
    execute "set <PageDown>=\e[6;*~"
    execute "set <xF1>=\e[1;*P"
    execute "set <xF2>=\e[1;*Q"
    execute "set <xF3>=\e[1;*R"
    execute "set <xF4>=\e[1;*S"
    execute "set <F5>=\e[15;*~"
    execute "set <F6>=\e[17;*~"
    execute "set <F7>=\e[18;*~"
    execute "set <F8>=\e[19;*~"
    execute "set <F9>=\e[20;*~"
    execute "set <F10>=\e[21;*~"
    execute "set <F11>=\e[23;*~"
    execute "set <F12>=\e[24;*~"
endif

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值