1. 程式人生 > >安裝VIM8和vim-go插件

安裝VIM8和vim-go插件

org user tor vim插件 mrc eve 源碼 yum href

安裝VIM8

下載源碼,編譯安裝,默認會安裝到/usr/local/bin下:

git clone https://github.com/vim/vim.git
cd vim/src
make
make install

如果make過程中報有關terminal的錯誤,並提示安裝ncurses,則yum安裝ncurses-devel後重新make和make install:

yum install ncurses-devel

安裝vim-go插件

執行如下命令安裝plug.vim插件管理器和vim-go插件:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
git clone https://github.com/fatih/vim-go.git ~/.vim/plugged/vim-go

然後在~/.vimrc裏添加如下配置:

call plug#begin()
Plug ‘fatih/vim-go‘
call plug#end()

再然後執行vim命令,然後在vim裏輸入如下命令安裝vim-go的依賴,然後退出vim即可:

:GoInstallBinaries

現在再打開go代碼文件,就可以看到效果了。更復雜的用法詳見vim-go插件文檔。

參考資料

  • VIM
    • https://www.vim.org/download.php
    • https://github.com/vim/vim/blob/master/src/INSTALL
  • plug.vim
    • https://github.com/junegunn/vim-plug
  • vim-go
    • https://github.com/fatih/vim-go
    • https://github.com/fatih/vim-go-tutorial

安裝VIM8和vim-go插件