MAC MacVim及Vundle安装

来源:互联网 发布:pdf.js 缓存问题 编辑:程序博客网 时间:2024/05/21 06:45

安装MacVim:

方法一:

使用brew安装MacVim。

在shell下执行以下语句安装brew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

系统返回

==> Installation successful!

时表示brew安装成功。

再执行以下语句安装MacVim(同时安装cscope和lua)

$ brew install macvim --with-cscope --with-lua

方法二:

从GitHub下载MacVim,当前最新版为MacVim-7.4.dmg,下载完成后双击dmg文件安装。

MacVim下载地址:https://github.com/macvim-dev/macvim/releases

安装Vim的插件管理工具Vundle:

Bundle主页:https://github.com/VundleVim/Vundle.vim

主页有其详细的安装使用说明

shell下执行

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



配置MacVim:

Vim的配置文件有:vimrc,gvimrc和exrc三个。这些配置文件的所在位置由vim的安装目录和操作系统决定。因为MacVim也是Vim的一个版本,故MacVim与Vim的配置方法一样。

vimrc

vimrc是Vim的最主要配置文件,其有两个版本:全局版本(global)和用户版本(personal)。全局版本的vimrc文件在Vim的安装目录中,Mac OS系统中其所在目录为/usr/share/vim/vimrc。

用户版本的vimrc文件在当前用户的主目录下,Mac OS系统中用户版本的vimrc文件目录为/user/用户名/.vimrc。(注:Mac下默认是没有用户版本的vimrc,所以如果需要可以自己创建一个)

使用中只需修改用户版本的vimrc文件,因为用户版本的设置总是会覆盖全局版本中的设置。

gvimrc

gvimrc是gvim的配置文件,与vimrc相似,并且是放在同一个目录下的,也分为全局版本和用户版本。我们要用的是vim所以不需要修改这个文件。

exrc

exrc是用于vim或ex向后兼容的,也于vimrc放于同一目录,同样也分为全局版本和用户版本。只有在我们想用vi的兼容模式来使用vim时才会用到这个文件。

将一下代码复制到vimrc文件里以启用Vundle。

set nocompatible              " be iMproved, requiredfiletype off                  " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, requiredPlugin 'VundleVim/Vundle.vim'" The following are examples of different formats supported." Keep Plugin commands between vundle#begin/end." plugin on GitHub repoPlugin 'tpope/vim-fugitive'" plugin from http://vim-scripts.org/vim/scripts.htmlPlugin 'L9'" Git plugin not hosted on GitHubPlugin 'git://git.wincent.com/command-t.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/'}" Avoid a name conflict with L9Plugin 'user/L9', {'name': 'newL9'}" All of your Plugins must be added before the following linecall vundle#end()            " requiredfiletype 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

重启MacVim。

插件安装:

在MacVim里运行:PluginInstall

MacVim> PluginInstall

在shell下执行

$ vim +PluginInstall +qall




0 0
原创粉丝点击