Windows + Gvim + 插件安装Vundle + YouCompleteMe

*****************************************************************

安装方法 +具体配置

××××××××××××××××××××××××××××××××××××××××××××

一、Vundle(插件管理器)

1.安装git
    创建curl.cmd文件,写入如下内容,拷贝到C:\Program Files\Git\cmd文件夹
    可在cmd中用 curl –version查看是否成功,成功显示版本信息
    应用git下载vundle,此处注意下载到gvim的安装目录中。
    在D:\softinstall\Vim目录下按下shift+鼠标右键,选择在此处打开命令窗口,进入cmd。
    输入命令:git clone https://github.com/VundleVim/Vundle.vim.git vimfiles/bundle/Vundle.vim
2. 拷贝vundle官方的配置到_vimrc中,删除原有的_vimrc内容,并修改路径:
    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#begin()
    改为
    set rtp+=$VIM/vimfiles/bundle/Vundle.vim/
    call vundle#begin('$VIM/vimfiles/bundle/')
    完整配置为(我只加了一个插件以便测试vundle是否配置正确):

    set nocompatible              " be iMproved, required
    filetype off                  " required
    
    " set the runtime path to include Vundle and initialize
    set rtp+=$VIM/vimfiles/bundle/Vundle.vim/
    call vundle#begin('$VIM/vimfiles/bundle/')
    " alternatively, pass a path where Vundle should install plugins
    "call vundle#begin('~/some/path/here')

    " let Vundle manage Vundle, required
    Plugin 'VundleVim/Vundle.vim'

    " plugin on GitHub repo
    Plugin 'altercation/vim-colors-solarized'

    " All of your Plugins must be added before the following line
    call vundle#end()            " required
    filetype plugin indent on    " required
    " To ignore plugin indent changes, instead use:
    "filetype plugin on
    "
    " Brief help
    " :PluginList       - lists configured plugins
    " :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
    " :PluginSearch foo - searches for foo; append `!` to refresh local cache
    " :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
    "
    " see :h vundle for more details or wiki for FAQ
    " Put your non-Plugin stuff after this line

3.安装插件
打开vim  运行:PluginInstall

PluginClean

*********************************************************************
二、安装 YouCompleteMe(vundle安装)
1.先安装cmake、llvm、microsoft(vs2012或vs2017)并配置环境变量
2.在_vimrc添加
    Plugin 'Valloric/YouCompleteMe'
    打开vim  运行:PluginInstall
3.安装完成后,cmd 进入YouCompleteMe安装目录,如:D:\softinstall\Vim\vimfiles\bundle\YouCompleteMe
    cmd
    d:
    cd softinstall\Vim\vimfiles\bundle\YouCompleteMe
    python python.py --all
    编译完成后,将 .ycm_extra_conf.py 文件复制到 D:\softinstall\Vim
    再设置_vimrc,添加
        "默认配置文件路径"
        let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
        "打开vim时不再询问是否加载ycm_extra_conf.py配置"
        let g:ycm_confirm_extra_conf=0
        set completeopt=longest,menu
        "python解释器路径"
        "let g:ycm_path_to_python_interpreter='D:\softinstall\Python37'
        "是否开启语义补全"
        let g:ycm_seed_identifiers_with_syntax=1
        "是否在注释中也开启补全"
        let g:ycm_complete_in_comments=1
        let g:ycm_collect_identifiers_from_comments_and_strings = 0
        "开始补全的字符数"
        let g:ycm_min_num_of_chars_for_completion=2
        "补全后自动关机预览窗口"
        let g:ycm_autoclose_preview_window_after_completion=1
        " 禁止缓存匹配项,每次都重新生成匹配项"
        let g:ycm_cache_omnifunc=0
        "字符串中也开启补全"
        let g:ycm_complete_in_strings = 1
        "离开插入模式后自动关闭预览窗口"
        autocmd InsertLeave * if pumvisible() == 0|pclose|endif
        "回车即选中当前项"
        inoremap <expr> <CR>       pumvisible() ? '<C-y>' : '\<CR>'     
    
    
三、GVim安装ctags和taglist插件
    由于taglist依赖于ctags,所以在linux 可以用 vundle安装,因为linux里安装有ctags包
    在windows里经测试,如果没有ctags,可以用手动安装 ctags和 taglist包
 
ctags的安装

    这个安装非常简单,在http://ctags.sourceforge.net/下载windows的版本ctags58.zip,
    然后解压出来,在Path里添加.exe所在的路径即可
    安装完成后用":ctags -R"可以在目录下生成tags文件,记录索引
    Ctrl+]可以实现跳转

taglist的安装

    下载安装包:http://www.vim.org/scripts/script.php?script_id=273
    解压出来有两个文件夹,其内个有一个文件:\doc\taglist.txt和\plugin\taglist.vim
    将两个文件分别拷贝到Vim\vim74下面的doc和plugin文件夹中
    用管理员身份打开gvim 运行":helptags C:...\Vim\vim74\doc "
    注意一定要用管理员身份,否则啥也不会发生(为这个折腾了很久,必须吐槽一下win7坑爹的权限设置)

    安装完成后":Tlist"可以看到taglist窗口

安装完手配置taglist 环境设置参数如下:

    "设定Linux系统中ctags程序的位置
    "set tags=tags;
    "set autochdir
    let Tlist_Show_One_File=1    "不同时显示多个文件的tag,只显示当前文件的
    let Tlist_Exit_OnlyWindow=1  "如果taglist窗口是最后一个窗口,则退出vim
    "let Tlist_Use_Right_Window = 1         "在右侧窗口中显示taglist窗口
    "let Tlist_Use_SingleClick= 1    " 缺省情况下,在双击一个tag时,才会跳到该tag定义的位置
    let Tlist_Auto_Open=1    "在启动VIM后,自动打开taglist窗口
    let Tlist_Process_File_Always=1  "taglist始终解析文件中的tag,不管taglist窗口有没有打开
    let Tlist_File_Fold_Auto_Close=1 "同时显示多个文件中的tag时,可使taglist只显示当前文件tag,其它文件的tag都被折叠起来

*************************************************************************


四、NERDTree

    代码资源管理器现在已经成为了各种各样IDE的标配,这可以大大提高管理源代码的效率。这样的功能VIM自然不能少,NERD Tree提供了非常丰富的功能,不仅可以以VIM的方式用键盘来操作目录树,同时也可以像Windows资源管理器一样用鼠标来操作。

1.在vundle添加代码

    Plugin 'git://github.com/scrooloose/nerdtree.git'

2.重启gvim,并执行 :PluginInstall

3.打开NERDTree (任选一种)
    可以将打开目录树的功能绑定到你所喜欢的快捷键上,比如: map <leader>e
    或者 运行 :NERDTreeToggle<CR>

    或者 在 vim默认开启nerdtree 在~/.vimrc中添加  autocmd vimenter * NERDTree
************************************************************************

五、WinManager
我们上面介绍了用于文件浏览的nerdtree以及浏览程序符号的taglist,这两个插件都会以窗口的形式出现在Vim的窗口中,那么如何合理的安排它们,这就是winmanager的作用。

 安装方法
       下载winmanager,下载地址:http://www.vim.org/scripts/script.php?script_id=95;
       存放路径,在Windows系统下路径为:vim安装路径\vimXX\,在Linux系统下安装路径为:/usr/share/vim/vimXX/;
       将下载的解压包解压,将包中的doc、plugin目录覆盖到存放路径下。
 .vimrc文件配置
    winmanager的配置:
    
" winmanager配置
    let g:NERDTree_title='NERD Tree'
    let g:winManagerWindowLayout='NERDTree|TagList'
    function! NERDTree_Start()
    exec 'NERDTree'
    endfunction

    function! NERDTree_IsValid()
        return 1
    endfunction" 绑定F2到winmanagernmap <silent> <F2> :WMToggle<CR>

taglist相关配置的修改:
    " 绑定F8快捷键
    " 使用winmanager时,不使用快捷键
    " nnoremap <silent> <F8> :TlistToggle<CR>

    " 启动Vim后,自动打开taglist窗口。
    " 使用winmanager时,将自动打开窗口关闭
    let Tlist_Auto_Open = 0
 
 
NERD tree相关配置的修改
    " 绑定F2到NERDTreeToggle
    " 使用winmanager时,不使用快捷键
    " map <F2> :NERDTreeToggle<CR>

 另外,在windows下使用时,打开winmanager时会出现一个空buff,如果想在打开时候自动关闭这个buff,这里有两种方法:     修改开关快捷键
    " 绑定F2到winmanager
    nmap <silent> <F2> :if IsWinManagerVisible() <BAR> WMToggle<CR> <BAR> else <BAR> WMToggle<CR>:q<CR> endif <CR>

修改winmanager.vim
    " toggle showing the explorer plugins.
    function! <SID>ToggleWindowsManager()
    if IsWinManagerVisible()
        call s:CloseWindowsManager()
    else
        call s:StartWindowsManager()
        " 增加启动时候关闭空buff代码
        exe 'q'
    end
    endfunction


***************************************************************************

六、安装 Solarized 配色方案
1.在.vimrc中加入
    Plugin 'Solarized'

2.重启gvim,并执行
    :PluginInstall
3.将solarized.vim文件放入.vim下的colors文件夹内(如果没有则自己创建,如果是插件安装就不用复制文件)
    mkdir ~/.vim/colors
    cd ~/.vim/bundle/Solarized/colors
    cp solarized.vim ~/.vim/colors
4.更改主题,在.vimrc中加入
    syntax on  "设置语法高亮
    colorscheme solarized
    set background=dark


**************************************************************************************************

七、CtrlP  (查找文件插件)
杀手级的VIM查找文件插件。它以简单符合直觉的输入方式,极快的响应速度,精确的准备度,带你在项目中自由穿越。它可以模糊查询定位,包括工程下的所有文件,已经打开的buffer,buffer中的tag以及最近访问的文件。
1.安装
    在vundle 添加
    Plugin 'kien/ctrlp.vim'
2.重启gvim,并执行 :PluginInstall
3.vim配置文件添加
    let g:ctrlp_map = '<c-p>'
    let g:ctrlp_cmd = 'CtrlP'
    "设置ctrlp的窗口位置
     let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:20'
    "在vim 命令下cd 切换目录,可以实现ctrlp 切换目录,下面两条命令
    let g:NERDTreeChDirMode = 2
    let g:ctrlp_working_path_mode = 'rw'

**************************************************************************************************

八、fzf.vim

与ctrlp一样,fzf.vim也是一个搜索工具但它支持的东西更多,除了常见的文件搜索,MRU,还支持标记,snippets和主题等。需要注意的一点是Vim 8.1之后才支持在GVim中使用,在7.4到8.1的版本中只有在终端下使用才没有问题。

1.安装
    在vundle 添加

    Plugin 'junegunn/fzf.vim'
    Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }

2.添加上面两行到~/.vimrc,

    "<Leader>f在当前目录搜索文件
    nnoremap <silent> <Leader>f :Files<CR>
    "<Leader>b切换Buffer中的文件 nnoremap <silent> <Leader>b :Buffers<CR> "<Leader>p在当前所有加载的Buffer中搜索包含目标词的所有行,:BLines只在当前Buffer中搜索
    nnoremap <silent> <Leader>p :Lines<CR>
    "<Leader>h在Vim打开的历史文件中搜索,相当于是在MRU中搜索,:History:命令历史查找 nnoremap <silent> <Leader>h :History<CR> "调用Rg进行搜索,包含隐藏文件
    "command! -bang -nargs=* Rg \ call fzf#vim#grep( \ 'rg --column --line-number --no-heading --color=always --smart-case --hidden '.shellescape(<q-args>), 1, \ <bang>0 ? fzf#vim#with_preview('up:60%') \ : fzf#vim#with_preview('right:50%:hidden', '?'), \ <bang>0)

3.然后再:PluginInstall

***************************************************************************************************

九、Taglist

想必使用过Visual Studio和Source Insight的人都非常喜爱这样一个功能:左边有一个Symbol窗口,它列出了当前文件中的宏、全局变量、函数、类等信息,鼠标点击时就会跳到相应的源代码所在的位置,非常便捷。Taglist就是实现这个功能的插件。可以说symbol窗口是程序员不可缺少的功能,当年有很多人热衷于借助taglist、ctags和cscope,将VIM打造成一个非常强大的Linux下的IDE,所以一直以来,taglist在VIM官方网站的scripts排列榜中一直高居 榜首 ,成为VIM使用者的必备插件。

--help: 最常见的做法也是将它绑定到一个快捷键上,比如: map <silent> <F9> :TlistToggle<CR>

1.安装

Plugin 'taglist.vim'

2.添加上面两行到~/.vimrc,

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'
“ Settings for tagslist
“让taglist窗口出现在Vim的左边边
let Tlist_Use_Left_Window = 1
“当同时显示多个文件中的tag时,设置为1,可使taglist只显示当前文件tag,其它文件的tag都被折叠起来。
let Tlist_File_Fold_Auto_Close = 1
“只显示一个文件中的tag,默认为显示多个
let Tlist_Show_One_File = 1
“Tag的排序规则,以名字排序。默认是以在文件中出现的顺序排序
let Tlist_Sort_Type =’name’
“Taglist窗口打开时,立刻切换为有焦点状态
let Tlist_GainFocus_On_ToggleOpen = 1
“如果taglist窗口是最后一个窗口,则退出vim
let Tlist_Exit_OnlyWindow = 1
“设置窗体宽度为32,可以根据自己喜好设置
let Tlist_WinWidth = 32
 “这里比较重要了,设置ctags的位置,不是指向MacOS自带的那个,而是我们用homebrew安装的那个
let Tlist_Ctags_Cmd ='/usr/bin/ctags'
“热键设置,我设置成Leader+t来呼出和关闭Taglist
map <F2> :TlistToggle<CR>
3.然后再:PluginInstall

******************************************************************

十、Tagbar

看起来Tagbar和上面介绍的Taglist很相似,它们都是展示当前文件Symbol的插件,但是两者有一定的区别,大家可以从上图的对比中得知,两者的关注点不同。总的来说Tagbar对面向对象的支持更好,它会自动根据文件修改的时间来重新排列Symbol的列表。它们以不同的纬度展示了当前文件的Symbol。

--help: 同Taglist一样,可以这样绑定它的快捷键, nmap <silent> <F4> :TagbarToggle<CR>

Plugin 'taglbar.vim'

nmap <silent> <F4> :TagbarToggle<CR>  
let g:tagbar_ctags_bin = 'ctags'  
let g:tagbar_width = 60

3.然后再:PluginInstall

****************************************************************************

 

Plugin 'scrooloose/nerdcommenter'  "代码注释
" nerdcommenter'  代码注释插件配置
let g:NERDSpaceDelims=1

Plugin 'vim-airline/vim-airline'

 

_vimrc具体配置

" Vim with all enhancements
source $VIMRUNTIME/vimrc_example.vim

" Use the internal diff if available.
" Otherwise use the special 'diffexpr' for Windows.
if &diffopt !~# 'internal'
  set diffexpr=MyDiff()
endif
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg1 = substitute(arg1, '!', '\!', 'g')
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg2 = substitute(arg2, '!', '\!', 'g')
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let arg3 = substitute(arg3, '!', '\!', 'g')
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      if empty(&shellxquote)
        let l:shxq_sav = ''
        set shellxquote&
      endif
      let cmd = '"' . $VIMRUNTIME . '\diff"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  let cmd = substitute(cmd, '!', '\!', 'g')
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  if exists('l:shxq_sav')
    let &shellxquote=l:shxq_sav
  endif
endfunction

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize

set rtp+=$VIM/vimfiles/bundle/Vundle.vim/
call vundle#begin('$VIM/vimfiles/bundle/')
Plugin 'VundleVim/Vundle.vim'
Plugin'davidhalter/jedi-vim'

Plugin 'ctags.vim'        "taglist依赖于ctags(windows必须手功安装两软件)
Plugin 'Solarized'    "配色方案
"目录列表,可能需要手动安装winmanager,同时管理nerdtree和taglist
Plugin 'junegunn/fzf.vim'    "junegunn/fzf 文件搜索
Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plugin 'taglist.vim'
Plugin 'scrooloose/nerdcommenter'  "代码注释
Plugin 'vim-airline/vim-airline' "状态栏增强插件
Plugin 'Valloric/YouCompleteMe'     "代码补全
Plugin 'maralla/completor.vim'  "代码补全YouCompleteMe就是依赖它
Plugin 'vim-scripts/indentpython.vim'     "python代码缩进
Plugin 'vim-syntastic/syntastic' "语法检查
Plugin 'nvie/vim-flake8'    "flake8代码风格
Plugin 'jistr/vim-nerdtree-tabs' "使用tab键
Plugin 'Yggdroot/indentLine' "缩进指示线
Plugin 'jiangmiao/auto-pairs'  "自动补全括号
Plugin 'tpope/vim-fugitive' "Git集成
Plugin 'kien/ctrlp.vim'     "超级搜索
Plugin 'scrooloose/nerdtree'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} "Powerline状态栏
Plugin 'jnurmine/Zenburn'    "配色方案
Plugin 'altercation/vim-colors-solarized'    "配色方案
Plugin 'tmhedberg/SimpylFold'
Plugin 'taglbar.vim'


" All of your Plugins must be added before the following line
call vundle#end()            " required

 

"设置文件的代码形式
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,chinese,cp936

 "vim的菜单乱码解决
source $VIMRUNTIME/delmenu.vim  
source $VIMRUNTIME/menu.vim     

"vim提示信息乱码的解决
language messages zh_CN.utf-8

"默认配置文件路径"
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
"打开vim时不再询问是否加载ycm_extra_conf.py配置"
let g:ycm_confirm_extra_conf=0
set completeopt=longest,menu
"python解释器路径"
"let g:ycm_path_to_python_interpreter='D:\softinstall\Python37'
"是否开启语义补全"
let g:ycm_seed_identifiers_with_syntax=1
"是否在注释中也开启补全"
let g:ycm_complete_in_comments=1
let g:ycm_collect_identifiers_from_comments_and_strings = 0
"开始补全的字符数"
let g:ycm_min_num_of_chars_for_completion=2
"补全后自动关机预览窗口"
let g:ycm_autoclose_preview_window_after_completion=1
" 禁止缓存匹配项,每次都重新生成匹配项"
let g:ycm_cache_omnifunc=0
"字符串中也开启补全"
let g:ycm_complete_in_strings = 1
"离开插入模式后自动关闭预览窗口"
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
"回车即选中当前项"
inoremap <expr> <CR>       pumvisible() ? '<C-y>' : '\<CR>'     

set expandtab
set ts=4
set shiftwidth=4
set nu
if has('mouse')
set mouse-=a
endif

syntax on  "设置语法高亮

set clipboard=unnamed  "系统剪贴板
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree  "隐藏.pyc文件
let python_highlight_all=1
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/    "标示不必要的空白字符

"支持PEP8风格的缩进
au BufNewFile,BufRead *.py
\ set tabstop=4
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=79
\ set expandtab
\ set autoindent
\ set fileformat=unix

"对于全栈开发,你可以设置针对每种文件类型设置au命令
au BufNewFile,BufRead *.js, *.html, *.css
\ set tabstop=2
\ set softtabstop=2
\ set shiftwidth=2
"希望看到折叠代码的文档字符串
let g:SimpylFold_docstring_preview=1

" Enable folding提供对方法(methods)或类(classes)进行折叠的手段,只显示类或方法的定义部分,而不是全部的代码
set foldmethod=indent
set foldlevel=99

"但是你必须手动输入za来折叠(和取消折叠)。使用空格键会是更好的选择
" Enable folding with the spacebar
nnoremap <space> za

"Ctrl-j 切换到下方的分割窗口 - Ctrl-k 切换到上方的分割窗口 - Ctrl-l 切换到右侧的分割窗口 - Ctrl-h 切换到左侧的分割窗口
"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

"设定Linux系统中ctags程序的位置
"set tags=tags;
"set autochdir
let Tlist_Show_One_File=1    "不同时显示多个文件的tag,只显示当前文件的
let Tlist_Exit_OnlyWindow=1  "如果taglist窗口是最后一个窗口,则退出vim
"let Tlist_Use_Right_Window = 1         "在右侧窗口中显示taglist窗口
"let Tlist_Use_SingleClick= 1    " 缺省情况下,在双击一个tag时,才会跳到该tag定义的位置
let Tlist_Auto_Open=1    "在启动VIM后,自动打开taglist窗口
let Tlist_Process_File_Always=1  "taglist始终解析文件中的tag,不管taglist窗口有没有打开
let Tlist_File_Fold_Auto_Close=1 "同时显示多个文件中的tag时,可使taglist只显示当前文件tag,其它文件的tag都被折叠起来

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'
" Settings for tagslist
"让taglist窗口出现在Vim的左边边
let Tlist_Use_Left_Window = 1
"当同时显示多个文件中的tag时,设置为1,可使taglist只显示当前文件tag,其它文件的tag都被折叠起来。
let Tlist_File_Fold_Auto_Close = 1
"只显示一个文件中的tag,默认为显示多个
let Tlist_Show_One_File = 1
"Tag的排序规则,以名字排序。默认是以在文件中出现的顺序排序
"let Tlist_Sort_Type =’name’
"Taglist窗口打开时,立刻切换为有焦点状态
let Tlist_GainFocus_On_ToggleOpen = 1
"如果taglist窗口是最后一个窗口,则退出vim
let Tlist_Exit_OnlyWindow = 1
"设置窗体宽度为32,可以根据自己喜好设置
let Tlist_WinWidth = 32
"这里比较重要了,设置ctags的位置,不是指向MacOS自带的那个,而是我们用homebrew安装的那个
let Tlist_Ctags_Cmd ='/usr/bin/ctags'
"热键设置,我设置成Leader+t来呼出和关闭Taglist
map <F2> :TlistToggle<CR>


"在 vim默认开启nerdtree
autocmd vimenter * NERDTree

" winmanager配置
let g:NERDTree_title='NERD Tree'
let g:winManagerWindowLayout='NERDTree|TagList'
function! NERDTree_Start()
    exec 'NERDTree'
endfunction

function! NERDTree_IsValid()
    return 1
endfunction" 绑定F2到winmanagernmap <silent> <F2> :WMToggle<CR>

nmap <silent> <F2> :if IsWinManagerVisible() <BAR> WMToggle<CR> <BAR> else <BAR> WMToggle<CR>:q<CR> endif <CR>

colorscheme solarized
set background=dark

let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
"设置ctrlp的窗口位置
"let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:20'
"在vim 命令下cd 切换目录,可以实现ctrlp 切换目录,下面两条命令
let g:NERDTreeChDirMode = 2
let g:ctrlp_working_path_mode = 'rw'

"<Leader>f在当前目录搜索文件
nnoremap <silent> <Leader>f :Files<CR>
"<Leader>b切换Buffer中的文件 nnoremap <silent> <Leader>b :Buffers<CR> "<Leader>p在当前所有加载的Buffer中搜索包含目标词的所有行,:BLines只在当前Buffer中搜索
nnoremap <silent> <Leader>p :Lines<CR>
"<Leader>h在Vim打开的历史文件中搜索,相当于是在MRU中搜索,:History:命令历史查找 nnoremap <silent> <Leader>h :History<CR> "调用Rg进行搜索,包含隐藏文件
"command! -bang -nargs=* Rg \ call fzf#vim#grep( \ 'rg --column --line-number --no-heading --color=always --smart-case --hidden '.shellescape(<q-args>), 1, \ <bang>0 ? fzf#vim#with_preview('up:60%') \ : fzf#vim#with_preview('right:50%:hidden', '?'), \ <bang>0)

"Plugin 'taglbar.vim'
nmap <silent> <F4> :TagbarToggle<CR>  
"let g:tagbar_ctags_bin = 'ctags'  
let g:tagbar_width = 60

let g:NERDSpaceDelims=1

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值