Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation on OS X #2

Open
jaytaylor opened this issue Sep 3, 2013 · 35 comments
Open

Installation on OS X #2

jaytaylor opened this issue Sep 3, 2013 · 35 comments

Comments

@jaytaylor
Copy link

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

@volgar1x
Copy link
Owner

volgar1x commented Sep 3, 2013

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?

@jaytaylor
Copy link
Author

: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.

@volgar1x
Copy link
Owner

volgar1x commented Sep 3, 2013

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.

@jaytaylor
Copy link
Author

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 notifications@github.com 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.

@volgar1x
Copy link
Owner

volgar1x commented Sep 3, 2013

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

@macb
Copy link
Contributor

macb commented Sep 12, 2013

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.

@macb
Copy link
Contributor

macb commented Sep 12, 2013

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)

@JohnAmican
Copy link

@SeanBr nice job, gave a solution an hour before I went looking for it!

@JohnAmican
Copy link

Also FYI things start breaking if there are spaces in folder names. I'll open up an issue about it later.

@volgar1x
Copy link
Owner

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.

@oguzbilgic
Copy link

I get the same You are not in a go package error on both OS X and ubuntu 13.

@volgar1x
Copy link
Owner

Can you please execute the commands that I previously wrote?

@bilby91
Copy link

bilby91 commented Sep 28, 2013

I'm having the same issue, already executed both commands and no luck.

@volgar1x
Copy link
Owner

What is exactly the output ?

@bilby91
Copy link

bilby91 commented Sep 28, 2013

: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 ...] 

@volgar1x
Copy link
Owner

Have you install coreutils and make the greadlink redirection to readlink ?

@bilby91
Copy link

bilby91 commented Sep 28, 2013

Yes, installed coreutils through brew and made the symlink.

@volgar1x
Copy link
Owner

Try readlink -f . in a Terminal and tell me the output

@bilby91
Copy link

bilby91 commented Sep 28, 2013

Same output

readlink: illegal option -- f
usage: readlink [-n] [file ...] 

@volgar1x
Copy link
Owner

vim-gocode needs some OS X integration, wait until someone patch this problem or make it yourself (I don't own a Mac)

@bilby91
Copy link

bilby91 commented Sep 28, 2013

Can your provide me any orientation on where the issue could be.

Thanks for the help either way!

@volgar1x
Copy link
Owner

You can look here https://github.com/Blackrush/vim-gocode/blob/master/ftplugin/go/pkg.vim#L10 as a first step

@macb
Copy link
Contributor

macb commented Sep 29, 2013

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.

@bilby91
Copy link

bilby91 commented Sep 29, 2013

which brew
/usr/local/bin/brew

which readlink
/usr/bin/readlink

@macb
Copy link
Contributor

macb commented Sep 29, 2013

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

@bilby91
Copy link

bilby91 commented Sep 29, 2013

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.

@volgar1x
Copy link
Owner

What does output, in VIM, :!go env GOPATH ?

@bilby91
Copy link

bilby91 commented Sep 30, 2013

It shows me the correct GOPATH.

@ghost
Copy link

ghost commented Nov 6, 2013

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.

@volgar1x
Copy link
Owner

volgar1x commented Nov 6, 2013

does function ReadLink has to be edited to include OS specific behavior ?

@pengux
Copy link

pengux commented Nov 25, 2013

I followed the instructions to install on Mac OS X, but when I try completion with CTRL X + CTRL O, it gives the following error:

Omni completion (^O^N^P) Pattern not found

What am I missing?

@volgar1x
Copy link
Owner

Have you installed gocode ? Do you have it in your PATH ?

@pengux
Copy link

pengux commented Nov 25, 2013

Ah sorry. So I just did a "go build" in gocode folder and copied the generated binary to /usr/local/bin. Is it correct?

@volgar1x
Copy link
Owner

A simple go get github.com/nsf/gocode worked perfectly for me

UPDATE

f93b0a7 adds some instruction

@cynipe
Copy link

cynipe commented Feb 9, 2014

this is why readlink does not work properly: http://superuser.com/questions/31353/path-in-vim-doesnt-match-terminal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants