美文网首页
我的Vim配置

我的Vim配置

作者: sylcrq | 来源:发表于2016-07-09 19:06 被阅读488次

本文的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

    install VIM VIM官网下载安装包我是安装再D盘 基础配置 vim所有配置都在_vimrc里配置。例默认...

  • vim c++ 代码自动格式化配置

    安装 vim 插件 auto-format 安装 Artistic Style 配置 vim 配置文件 .vim...

  • vim配置python相关插件

    配置vim插件管理工具配置vim-pathogen配置vimogen 配置常用插件YouCompleteMeneo...

  • vim 空格改为4个

    如果要修改全局Vim的配置 vim /etc/vim/vimrc 但是不建议这么做,可以只修改当前用户的Vim配置...

  • vim终极配置

    这是我的vim配置:my vim config.linux 下的vim 与 windows 下的gvim 通用。 ...

  • vim简单操作与配置

    vim 编辑器之神Emacs 神的编辑器 vim配置 ~/.vimrc 配置文件 vimplugin 管理vim插...

  • 【vim】极简完美配置b-vim(二)vimrc 文件说明

    目录 【vim】极简完美配置b-vim(一)安装教程及目录说明 【vim】极简完美配置b-vim(二)vimrc ...

  • 【vim】极简完美配置b-vim(一)安装教程及目录说明

    目录 【vim】极简完美配置b-vim(一)安装教程及目录说明 【vim】极简完美配置b-vim(二)vimrc ...

  • vin学习笔记

    vim学习 vim配置 主要配置使用Python3 vim主要快捷键 vim的模式,命令行模式,插入模式,视图模式...

  • vim

    vim编辑器之神 配置vimrc配置 在shell中可以通过 vim ~/.vimrc 或者 vim /etc/v...

网友评论

      本文标题:我的Vim配置

      本文链接:https://www.haomeiwen.com/subject/wshndttx.html