vim-gocode
vim-gocode copied to clipboard
Installation on OS X
The install lists pathogen as "todo". Is it not yet ready?
When I try to run :CurPkg
, I get:
You are not in a go package
You successfully installed vim-gocode through pathogen, it seems to be a bug at first sight. Can you run the command
:echo ReadLink(g:gocode_path)
And then
:echo ReadLink(@%)
And tell me the output?
:echo ReadLink(g:gocode_path)
E121: Undefined variable: g:gocode_path E116: Invalid arguments for function ReadLink(g:gocode_path) E15: Invalid expression: ReadLink(g:gocode_path)
:echo ReadLink(@%)
readlink: illegal option -- f usage: readlink [-n] [file ...]
Other miscellaneous info: this is on a MacBook Air with a fresh install of OS-X 10.8.4 and a case-sensitive filesystem.
I haven't tested this plugin on other system than Linux. Could you please edit the ReadLink function inside vim-gocode/ftplugin/go/pkg.vim to make it works (ie get the full path) on your OS ? Other question : have you installed Go? VIM can't echo any g:gocode_path variable which is a sign that 'go env GOPATH' didn't work.
I will update the readlink fn. go is definitely installed with good GOPATH and GOROOT env vars.
Hopefully together we can get this to be compatible with Mac.
Best, Jay
On Sep 2, 2013, at 11:15 PM, Blackrush [email protected] wrote:
I haven't tested this plugin on other system than Linux. Could you please edit the ReadLink function inside vim-gocode/ftplugin/go/pkg.vim to make it works (ie get the full path) on your OS ? Other question : have you installed Go? VIM can't echo any g:gocode_path variable which is a sign that 'go env GOPATH' didn't work.
— Reply to this email directly or view it on GitHub.
I found a good starting point to use readlink on OS X : http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
Might I recommend making a note that it currently doesn't work on osx? Spent a while beating myself over the head until I checked the issues.
Also, as a solution for future mac users:
brew install coreutils ln /usr/local/bin/greadlink /usr/local/bin/readlink
maybe re-source profile. (I had to get which readlink to return the correct path)
@seanbr nice job, gave a solution an hour before I went looking for it!
Also FYI things start breaking if there are spaces in folder names. I'll open up an issue about it later.
I renamed this issue "Installation on OS X", created a wiki article and linked it in the README. Tell me if I have done anything wrong.
I get the same You are not in a go package
error on both OS X and ubuntu 13.
Can you please execute the commands that I previously wrote?
I'm having the same issue, already executed both commands and no luck.
What is exactly the output ?
:echo ReadLink(g:gocode_path)
E121: Undefined variable: g:gocode_path
E116: Invalid arguments for function ReadLink(g:gocode_path)
E15: Invalid expression: ReadLink(g:gocode_path)
:echo ReadLink(@%)
readlink: illegal option -- f
usage: readlink [-n] [file ...]
Have you install coreutils
and make the greadlink
redirection to readlink
?
Yes, installed coreutils through brew and made the symlink.
Try readlink -f .
in a Terminal and tell me the output
Same output
readlink: illegal option -- f
usage: readlink [-n] [file ...]
vim-gocode needs some OS X integration, wait until someone patch this problem or make it yourself (I don't own a Mac)
Can your provide me any orientation on where the issue could be.
Thanks for the help either way!
You can look here https://github.com/Blackrush/vim-gocode/blob/master/ftplugin/go/pkg.vim#L10 as a first step
what is the output of:
which brew which readlink
It seems to me that you are using osx's readlink still. I've installed vim-gocode 3 times now on seperate OSX installs and after doing the 'brew install coreutils' and linking greadlink into my path (ahead of osx readlink) it's been perfect.
My guess is your brew bin path (most likely /usr/local/bin) is at the end of your path.
which brew
/usr/local/bin/brew
which readlink
/usr/bin/readlink
Yep, that's your issue. You need to make sure your home brew path /usr/local/bin is the first entry into your path. This way anything that replaces an osx default will be used instead of the osx one.
Do this by editing your bash profile, bash rc, or system profile to something that contains:
export PATH=/usr/local/bin:$PATH
I changed my .zshrc file to fix the problem with the order of paths. Now my output is correct.
which readlink
/usr/local/bin/readlink
I'm still having the same issue. Can it be an issue with my GOPATH being setup'd incorrectly? It seems correct to me.
What does output, in VIM, :!go env GOPATH
?
It shows me the correct GOPATH.
I solved the problem by installing brew install coreutils
and replacing readlink -f
with greadlink -f
in -> https://github.com/Blackrush/vim-gocode/blob/master/ftplugin/go/pkg.vim#L10
Previously I tried ln -s /usr/local/bin/greadlink /usr/local/bin/readlink
but it didn't worked for me.
does function ReadLink
has to be edited to include OS specific behavior ?