英文:
Install vim-go in linux?
问题
我现在是你的中文翻译助手,以下是翻译好的内容:
我目前在Linux/Vim方面只是一个初学者。我正在尝试开始学习Go语言。我想安装vim-go插件,但遇到了问题。我按照这篇文章的指导进行操作。
我在~/.bashrc
文件的末尾添加了以下内容:
export GOPATH=~/gocode
export PATH=$PATH:$GOPATH/bin
并创建了~/gocode
目录。
然后我创建了~/.vim/bundle
和~/.vim/autoload
目录。我将pathogen.vim
下载到了autoload目录中。我将vim-go的GitHub仓库克隆到了bundle目录中,这样就创建了一个vim-go
目录。
我创建了~/.vimrc
文件,并添加了以下内容:
call pathogen#infect()
syntax enable
filetype plugin on
set number
let g:go_disable_autoinstall = 0
我在Vim控制台中执行了以下命令(在安装了Hg之后成功执行):
:GoInstallBinaries
顺便提一下,我不使用vundle,而且说实话,我甚至不知道它是什么:)。
到目前为止,这个插件似乎还没有起作用。当我输入:help vim-go
时,出现了以下错误:E149: Sorry, no help for vim-go
。
我该怎么办?
英文:
I would best be described as a dabbler at this point in linux/vim. I'm trying to get started with go. Trying to install the vim-go plugin and i'm having issues. Following the following [post][1].
I added the following to the end of my ~/.bashrc
file:
export GOPATH=~/gocode
export PATH=$PATH:$GOPATH/bin
and created the following directory ~/gocode
So i created my ~/.vim/bundle
& ~/.vim/autoload
directories. I downloaded pathogen.vim
to the autoload directory. I cloned the github repository for vim-go into the bundle directory which created a vim-go
directory.
I created my ~/.vimrc file and added the following:
call pathogen#infect()
syntax enable
filetype plugin on
set number
let g:go_disable_autoinstall = 0
I executed the following from the vim console (which worked after installing Hg):
:GoInstallBinaries
FYI, i don't use vundle and to be honest don't even know what it is :).
So far the plugin doesn't seem to be working. When i type :help vim-go
i get the following error: E149: Sorry, no help for vim-go
What am i do
[1]: http://obahua.com/setup-vim-for-go-development/ "post"
答案1
得分: 2
使用手动安装方法(将vim-go/复制到~/.vim目录)后,我能够使其正常工作,但前提是我有以下的~/.vimrc文件,并且按照说明安装了Go二进制文件。
set nocompatible
set shell=/bin/sh
syntax on
filetype plugin on
let g:go_disable_autoinstall = 0
这是在一个没有其他vim插件、之前没有~/.vim目录或~/.vimrc文件的Ubuntu 14.04桌面上完成的。坦率地说,官方的安装说明和许多教程都假设了太多的东西,在新安装的Ubuntu上并不实用。
然而,“help vim-go”对我仍然不起作用。我尝试了从~/.vim目录中运行以下命令,使其工作:https://stackoverflow.com/questions/4180590/vim-helptag-generation
英文:
Using the manual install method (copying vim-go/ to ~/.vim) I was able to get it working but only once I had the following ~/.vimrc file, and of course the Go binaries installed as per the instructions.
set nocompatible
set shell=/bin/sh
syntax on
filetype plugin on
let g:go_disable_autoinstall = 0
This was done on an Ubuntu 14.04 desktop with no other vim plugins or prior ~/.vim directory or ~/.vimrc. Frankly the official install instructions and many of the tutorials out there assume to much to be useful on a fresh install of Ubuntu.
However "help vim-go" was still not working for me. Tried the following command from within the ~/.vim directory and got that working: https://stackoverflow.com/questions/4180590/vim-helptag-generation
答案2
得分: 2
将以下内容翻译为中文:
将以下内容放入你的 .vimrc 文件中:
set nocompatible
execute pathogen#infect()
syntax on
filetype on
filetype plugin on
filetype plugin indent on
进入你的 .zshrc 或 .bashrc 文件,并添加以下内容:
export GOPATH="$HOME/gocode/"
export PATH=$PATH:~/gocode/bin
在终端中执行以下命令:
source .zshrc
或者
source .bashrc
现在进入以下目录:
cd ~/.vim/bundle
如果你使用 pathogen,执行以下命令:
git clone https://github.com/fatih/vim-go.git
在 vim 中执行以下命令:
:GoInstallBinaries
尝试以下命令之一:
:GoFmt
:GoLint
英文:
solution put that in you .vimrc :
set nocompatible
execute pathogen#infect()
syntax on
filetype on
filetype plugin on
filetype plugin indent on
go in your .zshrc ou .bashrc and put :
export GOPATH="$HOME/gocode/"
export PATH=$PATH:~/gocode/bin
and in terminal do :
source .zshrc
or
source .bashrc
and now go to
cd ~/.vim/bundle
and do if youuse pathogen :
git clone https://github.com/fatih/vim-go.git
in vim do :
:GoInstallBinaries
test one of this commands :
:GoFmt
:GoLint
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论