我的Vim配置

本文的Vim配置是在 spf13-vim 的基础上进行自定义修改
所需即所获:像 IDE 一样使用 vim
使用Vundle管理配置Vim基本插件

目前遇到的问题:
Vim中同时打开NERDTree(左边)和Tagbar时(右边),有一个会无法正常显示

使用 spf13-vim

https://github.com/spf13/spf13-vim

  • Mac OS上安装:
    //Requires Git 1.7+ and Vim 7.3+
    curl https://j.mp/spf13-vim3 -L > spf13-vim.sh && sh spf13-vim.sh
    
  • 更新版本:
    curl https://j.mp/spf13-vim3 -L -o - | sh
    

或者

cd $HOME/to/spf13-vim/
git pull
vim +BundleInstall! +BundleClean +q
  • 自定义的Vim配置修改放在 ~/.vimrc.local~/.gvimrc.local 文件中

  • 需要在spf13-vim.vimrc 之前加载的自定义配置放在 ~/.vimrc.before.local 文件中

  • Spf13-vim 使用 let mapleader = ","<Leader> 键映射为 ,

Vundle(Vim插件管理器)

Vundle = Vim bundle
https://github.com/VundleVim/Vundle.vim

  • 添加的新插件放在 ~/.vimrc.bundles.local 文件中

    echo Bundle \'spf13/vim-colors\' >> ~/.vimrc.bundles.local
    //安装
    vim +BundleInstall! +BundleClean +q
    
  • 删除已安装的插件放在 ~/.vimrc.local 文件中

    echo UnBundle \'AutoClose\' >> ~/.vimrc.bundles.local
    echo UnBundle \'scrooloose/syntastic\' >> ~/.vimrc.bundles.local
    

    然后在Vim中执行:BundleClean!

Vim插件配置

1. NERDTree(文件目录导航)

https://github.com/scrooloose/nerdtree

  • 打开/关闭的快捷键:F2
" <==== NERDTree Config ====>
" open a NERDTree automatically when vim starts up
"autocmd vimenter * NERDTree
" open NERDTree on startup, and have my cursor start in the other window
autocmd vimenter * wincmd p
" map a specific key or shortcut to open NERDTree
map <F2> :NERDTreeToggle<CR>
" close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" 设置NERDTree子窗口宽度
let NERDTreeWinSize=32
" 设置NERDTree子窗口位置
"let NERDTreeWinPos="right"
" 不显示隐藏文件
let NERDTreeShowHidden=0
" NERDTree子窗口中不显示冗余帮助信息
let NERDTreeMinimalUI=1

2. NERDCommenter(快速注释)

https://github.com/scrooloose/nerdcommenter

3. Tagbar(当前文件tag导航)

https://github.com/majutsushi/tagbar

  • 打开/关闭的快捷键:F8
" <==== Tagbar Config ====>
autocmd VimEnter * nested :TagbarOpen
nmap <F8> :TagbarToggle<CR>
" 设置标签子窗口的宽度
let tagbar_width=32
" 设置tagbar子窗口的位置出现在主编辑区的左边
"let tagbar_left=1
" tagbar子窗口中不显示冗余帮助信息
let g:tagbar_compact=1
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 真实有效的Vim配置记录(macOS) 以前在Ubuntu里配置了两次Vim,macOS中配置了一次,都没有配置成...
    染微言阅读 11,575评论 0 8
  • macvim配置 最终效果如下: 系统环境 macos10.12.4 homebrew1.2.1 python3....
    Like_eb56阅读 70,188评论 5 65
  • 主要是适配python开发. 都是些github star超高之作. 首先,用vundle来管理插件: ** gi...
    Edward_f0cus阅读 1,557评论 0 4
  • 常言道:工欲善其事,必先利其器 ,作为一个程序员,一个常用的工具就是编辑器,我选择一个能极大提高自己开发效率的编辑...
    Sam_Lau阅读 120,990评论 34 266
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,647评论 2 45