zoukankan      html  css  js  c++  java
  • vim-3-插件管理

    Vim之所以强大, 很大原因就是他丰富的插件. 插件多了, 管理插件就是个问题, 我以前用的是pathogen, 但是换了环境, 还要带着一个十几兆的插件包, 还是不方便.

    后来发现了vundle(https://github.com/gmarik/Vundle.vim), 插件管理不再是问题了.

    Linux下的安装配置

    1. 首先要安装 Git 和 Curl, apt-get install git, apt-get install curl.
    2. 在终端下运行: 
        $ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
    3. 配置 .vimrc, 把下面这段放到 .vimrc里:
    set nocompatible              " be iMproved, required
    filetype off                  " required
    
    " set the runtime path to include Vundle and initialize
    set 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
    Plugin 'gmarik/Vundle.vim'
    
    " 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'
    " 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 L9
    Plugin 'user/L9', {'name': 'newL9'}
    
    " All of your Plugins must be added before the following line
    call vundle#end()            " required
    filetype plugin indent on    " required
    " To ignore plugin indent changes, instead use:
    "filetype plugin on
    "
    " Brief help
    " :PluginList          - list configured plugins
    " :PluginInstall(!)    - install (update) plugins
    " :PluginSearch(!) foo - search (or refresh cache first) for foo
    " :PluginClean(!)      - confirm (or auto-approve) removal of unused plugins
    "
    " see :h vundle for more details or wiki for FAQ
    " Put your non-Plugin stuff after this line

    怎样配置插件? 上面这段配置中也说的很清楚了, 有如下几种情况:

        1. 使用插件在github上的名称, 如: Plugin 'tpope/vim-fugitive'
        2. 使用插件的git库的地址, 如: Plugin 'git://git.wincent.com/command-t.git'
        3. 使用插件在vim-script(http://vim-scripts.org/vim/scripts.html)上的名称, 如: Plugin 'L9'
        4. 其他方式就不说了...
     
    4. 安装/卸载/升级插件: 打开vim, 运行命令: 
        PluginInstall  (安装), 
        PluginUpdate  (升级),
    至于卸载, 把相应的插件名字在 .vimrc 中删除再运行PluginInstall即可.

    Windows下的安装配置

    1. 安装 msysGit, 然后把 Git安装目录/cmd 加入到环境变量 PATH 中. 加入之后, 可能需要重启一下电脑才行, 否则最后执行安装插件命令时, 会提示 git 不是内部命令的错误.
    2. 把下面这段拷贝到 Git安装目录/cmd/curl.cmd 文件中(自己新建个)
    1 @rem Do not use "echo off" to not affect any child calls.
    2 @setlocal
    3 @rem Get the abolute path to the parent directory, which is assumed to be the
    4 @rem Git installation root.
    5 @for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
    6 @set PATH=%git_install_root%in;%git_install_root%mingwin;%PATH%
    7 @if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
    8 @if not exist "%HOME%" @set HOME=%USERPROFILE%
    9 @curl.exe %*

    这两步做完之后, 在 cmd 窗口里输入 git --version 回车, 然后 curl --version, 如果这两个命令都有输出, 说明 Git 和 Curl 配好了.

    此外, 还需要一个配置: 把 Gvim 安装目录添加到环境变量中, 需要新建一个环境变量(如: $VIM = D:/.../Vim).
    3. 然后到 Gvim 安装目录中, 右键, git bash, 然后执行下面的命令:
        git clone https://github.com/gmarik/Vundle.vim.git vimfiles/bundle/Vundle.vim
    4. 编辑 _vimrc, 这一步和在 Linux 中的差不多, 注意一点:
    把如下代码, 
    set rtp+=~/.vim/bundle/Vundle.vim/
    call vundle#begin()

    替换成

    set rtp+=~/vimfiles/bundle/Vundle.vim/
    let path='~/vimfiles/bundle'
    call vundle#begin(path)

    剩下的就和 Linux 中的一样了.

     
    PS: 最后还有一点. 主题插件好像还得自己手动放到 color 目录中...
     
     
     



  • 相关阅读:
    能量最小化初探,graphcuts能量最小化调用
    【设计】B 端产品设计
    【产品分析】关于字节跳动的神话与现实
    【UI】数据表格设计
    【设计】交互文档结构
    【作品集】UX作品集
    【产品方法论】需求是怎么来的
    【ML】人脸识别
    【ML】DL的参数量计算
    【网站部署】flask
  • 原文地址:https://www.cnblogs.com/gaoxiaoyuan/p/3831981.html
Copyright © 2011-2022 走看看