Neobundle 管理Vim插件

来源:互联网 发布:php零基础上手怎么样 编辑:程序博客网 时间:2024/05/16 01:39

Neobundle 管理Vim插件

今天逛微博的时候,看到一款nginx语法高亮的vim插件,正好我没安装过插件,就想着学习下如何安装vim插件。

Neobundle

NeoBundle是一个Vim的插件管理器,当我们有很多插件的时候,管理插件将会很难麻烦,使用插件管理器则让管理变得方便,因为它会把插件下载到~/.vim/bundle/目录下面。

安装并初始化

cd ~ //进入家目录curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh | sh

执行完毕,在家目录中出现.vim文件夹,则说明安装成功

这里写图片描述

初始化NeoBundle,需要配置~/.vimrc文件,如果不存在自行创建,写入以下内容

" Note: Skip initialization for vim-tiny or vim-small.if 0 | endifif &compatible  set nocompatible               " Be iMprovedendif" Required:set runtimepath+=~/.vim/bundle/neobundle.vim/" Required:call neobundle#begin(expand('~/.vim/bundle/'))" Let NeoBundle manage NeoBundle" Required:NeoBundleFetch 'Shougo/neobundle.vim'" My Bundles here:" Refer to |:NeoBundle-examples|." Note: You don't set neobundle setting in .gvimrc!call neobundle#end()" Required:filetype plugin indent on" If there are uninstalled bundles found on startup," this will conveniently prompt you to install them.NeoBundleCheck

上述配置是NeoBundle的Github示例配置,它的作用是让本身像其管理的插件一样,可以自动升级,同时启动vim时检查未安装的插件。

安装插件

语法 : NeoBundle ‘[项目维护者]/[项目名称].git’
如安装nerdtree插件,只需要在~/.vimrc中添加如下配置

NeoBundle 'scrooloose/nerdtree.git' //文件导航插件
NeoBundle 'chr4/nginx.vim'  //nginx.conf语法高亮插件

保存.vimrc文件,在vim中执行NeoBundleUpdate执行更新检查

:NeoBundleUpdate

注意事项

有时候会提示找不到源,无法自动下载,这个时候可以手动下载

curl -k https://github.com/[项目维护者]/[插件路径] > ~/.vim/bundle/[插件路径]

其他命令

:NeoBundleList  //查看已经插件安装列表

一键安装脚本

写了一个简单的脚本来安装NeoBundle插件,方便自己用在其他服务器上。
如果你不想自己折腾,那可以直接使用这个脚本一键安装NeoBundle
配置默认安装NERDTree插件,airline插件。设置F5快速打开文件夹导航树,F6退出,Tab键切换顶部同时打开的tab.

0 0
原创粉丝点击