博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vim利器:vundle 管理器和NERDTree插件
阅读量:6899 次
发布时间:2019-06-27

本文共 4033 字,大约阅读时间需要 13 分钟。

vundle 和nerdtree

vundle git: https://github.com/VundleVim/Vundle.vim.git

nerdtree git : https://github.com/scrooloose/nerdtree.git

注意 :vundle 是一个插件管理器,我们知道,vim的插件都在~/.vim/bundle/目录下,只要你下载了vundle,你就可以,利用vundle去下载别的插件了,比如: nerdtree

Vundle

利用Vundle 安装NERDTree plugin

首先就是要安装Vundle

下载Vundle:

$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

vimrc中配置Vundle

  1. 下载完毕 Vundle后,紧跟着要做的就是,修改~/.vimrc文件,将Vundle配置到vim中;
  2. 如何配置Vundle 可以参考git帮助: https://github.com/muahao/Vundle.vim
  3. 这里需要注意的是vundle的语法

利用Vundle安装安装插件

  1. 打开一个vim, 运行:BundleInstall

  2. 或者在命令行运行 vim +BundleInstall +qall

  3. 安装完成后插件就能用了

vundle其它常用命令:

更新插件:BundleUpdate清除不再使用的插件:BundleClean,列出所有插件:BundleList查找插件:BundleSearch

nerdtree

NERDTree的作用就是列出当前路径的目录树,一般IDE都是有的。可以方便的浏览项目的总体的目录结构和创建删除重命名文件或文件名。

安装方法1:直接自己git clone

git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree

安装方法2: 利用vundle

970272-20170507154710726-1818789377.png

两种安装方法,都会在/.vim/bundle/目录下产生一个 nerdtree目录

[ahao.mah@jiangyi01.sqa.zmf /home/ahao.mah]$ll ~/.vim/bundle/total 20drwxr-xr-x 13 ahao.mah users 4096 May  7 14:36 command-tdrwxr-xr-x 10 ahao.mah users 4096 May  7 14:54 nerdtreedrwxr-xr-x  6 ahao.mah users 4096 May  7 14:37 sparkupdrwxr-xr-x  5 ahao.mah users 4096 May  7 14:36 vim-fugitivedrwxr-xr-x  8 ahao.mah users 4096 May  7 14:34 Vundle.vim

使用nerdtree

报错1: 脑残的执行source ~/.vimrc 后,会出现bash报错,其实原因是这样的,在 shell 里不能 source vim 配置文件,vimrc的语法又不是跟shell一样的。你改了.vimrc的内容,重新用vim打开一个文件vimrc就生效了,根本不用source,又不是shell脚本.

970272-20170507160932117-63947492.png

vim默认开启nerdtree:

在~/.vimrc中添加

autocmd vimenter * NERDTree

970272-20170507161158648-1322107579.png

vimrc配置

$cat   ~/.vimrcset nocompatible              " be iMproved, requiredfiletype off                  " required"---------------------------------------------------------------" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vim"---------------------------------------------------------------call vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, required" The following are examples of different formats supported." Keep Plugin commands between vundle#begin/end." plugin on GitHub repo" Plugin 'tpope/vim-fugitive'" plugin from http://vim-scripts.org/vim/scripts.html" Plugin 'L9'" Git plugin not hosted on GitHub Plugin 'git://git.wincent.com/command-t.git' Plugin 'git://github.com/scrooloose/nerdtree.git' Plugin 'git://github.com/Xuyuanp/nerdtree-git-plugin.git'" git repos on your local machine (i.e. when working on your own plugin)" Plugin 'file:///home/gmarik/path/to/plugin'" The sparkup vim script is in a subdirectory of this repo called vim." Pass the path to set the runtimepath properly." Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}" Install L9 and avoid a Naming conflict if you've already installed a" different version somewhere else." Plugin 'ascenator/L9', {'name': 'newL9'}" All of your Plugins must be added before the following linecall vundle#end()            " required"---------------------------------------------------------------" NERDTree config"  map 
:NERDTreeToggle
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType")" &&b:NERDTreeType == "primary") | q | endif"第一条是说使用F2键快速调出和隐藏它;"第二条是关闭vim时,如果打开的文件除了NERDTree没有其他文件时,它自动关闭,减少多次按:q!。"如果想打开vim时自动打开NERDTree,可以如下设定autocmd vimenter * NERDTree"---------------------------------------------------------------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

nerdtree-git-plugin

$git clone https://github.com/Xuyuanp/nerdtree-git-plugin.git ~/.vim/bundle/nerdtree-git-plugin

REF

转载于:https://www.cnblogs.com/muahao/p/6821021.html

你可能感兴趣的文章
python制作的食物买卖存量计算程序
查看>>
yum命令——Linux下只下载不安装
查看>>
黑马程序员——集合篇
查看>>
memcached笔记
查看>>
CentOS yum安装Oracle10g
查看>>
MDT 2013 从入门到精通之SQL New MDT Database
查看>>
无线基础
查看>>
Percona Monitoring Plugins for Zabbix 报错一例
查看>>
SylixOS上EtherCAT实现
查看>>
CursorLoader用法
查看>>
区分不同手机平台客户端
查看>>
js阿拉伯数字转成汉字
查看>>
编码转化
查看>>
手写hashmap
查看>>
js实现阶乘和裴波那契数列的几种方式(闭包、递归)
查看>>
在IDEA中实战Git
查看>>
.Net文档图像处理工具包GdPicture.NET发布v14,提供最先进的PDF和文档成像技术
查看>>
网络地址转换NAT原理及应用
查看>>
返回json对象
查看>>
什么是Docker Volume?
查看>>