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

Not working #6

Closed
wayneashleyberry opened this issue Feb 25, 2013 · 29 comments
Closed

Not working #6

wayneashleyberry opened this issue Feb 25, 2013 · 29 comments

Comments

@wayneashleyberry
Copy link

Using MacVim 7.3.754 installed via Homebrew on OSX 10.8.2

I was already using pathogen with all my plugins, cloned this repo but it just didn't do anything.

Is there any way to test if the plugin's actually loaded?

The other plugins I have installed are,

  • commentary
  • ctrlp
  • fugitive
  • golden-ratio
  • nerdtree
  • powerline
  • unimpaired
@airblade
Copy link
Owner

If you fire up Vim and type :scriptnames, do you see vim-gitgutter listed? It should be.

Assuming it is, open up a file being tracked by git. Type :echo git and press tab after "git". You should get two completion options: GitGutter() and gitgutter_initialised.

@wayneashleyberry
Copy link
Author

Ah, the script is listed in :scriptnames but when I run :echo git I get the following error:

E121: Undefined variable: git
E15 Invalid expression: git

@airblade
Copy link
Owner

What happens if you do :!git?

It should give you the git help stuff you see when you type git in your shell.

@wayneashleyberry
Copy link
Author

Yeah, !git works.

Prints out the standard git stuff...

usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [-c name=value] [--help]
           <command> [<args>]

@airblade
Copy link
Owner

Hmm, when you edit a file which is being tracked by git, and you type :call GitGutter() what happens?

@wayneashleyberry
Copy link
Author

Absolutely nothing, no errors, no visual changes. I am definitely working on a file tracked by git, with uncommited changes as well...

@wayneashleyberry
Copy link
Author

Screen Shot 2013-02-25 at 6 25 10 PM

@airblade
Copy link
Owner

No errors means Vim has correctly loaded the GitGutter function.

Silly question but have you saved your uncommitted changes to disk?

@wayneashleyberry
Copy link
Author

I've tried everything, editing a file, deleting lines, saving, not saving. You can see the little red plus on my powerline there shows that git's "dirty"

@airblade
Copy link
Owner

Weird. Does :echo gitgutter_initialised give you 1?

@wayneashleyberry
Copy link
Author

nope, get this error

E121: Undefined variable: gitgutter_initialised
E15: Invalid expression: gitgutter_initialised

Sorry about all this hassle :)

@airblade
Copy link
Owner

No worries, I'm sorry for the hassle for you :)

The only way for GitGutter() to be defined but not g:gitgutter_initialised is for the plugin to think that at least one of the following is not true:

  • you are editing a file
  • the file is in a git repo
  • the file is tracked by git

Your screenshot shows that all three are true so somehow the plugin is getting confused.

@airblade
Copy link
Owner

What does echo strlen(expand("%:p")) > 0 give you? Should be 1.

And how about this:

call system("cd " . expand("%:p:h") . " && git rev-parse > /dev/null 2>&1")
echo v:shell_error

Should be 0.

And finally:

call system("cd " . expand("%:p:h") . " && git ls-files --error-unmatch > /dev/null 2>&1")
echo v:shell_error

Again, should be 0.

@wayneashleyberry
Copy link
Author

echo strlen(expand("%:p")) > 0 returns 1 as it should.

call system("cd " . expand("%:p:h") . " && git rev-parse > /dev/null 2>&1")
echo v:shell_error

returns 128

@wayneashleyberry
Copy link
Author

Could it have something to do with how ctrlp loads files?

I've tried using ctrlp or just regular :e to open files, same results.

And i'm double checking the folder i'm in with :pwd

@airblade
Copy link
Owner

Progress...this is causing the plugin to think the file you're editing isn't in a git repo.

Can you go to your shell, cd into the file's git repo, and run:

git rev-parse > /dev/null 2>&1
echo $?

Also, what version of git are you using?

@airblade
Copy link
Owner

I don't think it concerns how the files are loaded. I using :e mostly and that works fine for me.

@wayneashleyberry
Copy link
Author

using git 1.8.1.4

git rev-parse > /dev/null 2>&1
echo $?

returns 0

Using zsh if that matters.

Screen Shot 2013-02-25 at 6 50 25 PM

@airblade
Copy link
Owner

Those screenshots are very helpful BTW :)

So the shell is behaving as expected, returning a status code of 0. But when we execute the same command from Vim we get a status code of 128.

Perhaps it is something to do with zsh. I'm using bash and I haven't tested it on zsh. Let me do a little research into Vim/zsh and see if I find anything.

@wayneashleyberry
Copy link
Author

Thanks, really appreciated it :)

Here are my dotfiles, just in case

https://github.com/wayneashleyberry/dotfiles

@tonio
Copy link

tonio commented Feb 25, 2013

Works for me with zsh (on osx).

@wayneashleyberry
Copy link
Author

Would it matter if my vim and terminal are using different versions of git?

Seems vim's loading /usr/bin/git which is 1.7.10.2, but my terminal's using /usr/local/bin/git

@airblade
Copy link
Owner

@tonio That's useful to know, thanks.

@wayneashleyberry My Vim's using 1.7.10 so yours should be ok.

@wayneashleyberry
Copy link
Author

check this out though

:!git status
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 62 in /Users/wayne/.gitconfig

shell returned 128

the mentioned line 62 being:

[push]
    default = simple

@wayneashleyberry
Copy link
Author

That's probably a 1.8+ option?

@airblade
Copy link
Owner

Possibly...

@wayneashleyberry
Copy link
Author

yup, took it out - the plugin worked instantly :)

thanks for all the help!

@airblade
Copy link
Owner

Great news!

@acaire
Copy link

acaire commented Oct 10, 2014

Thanks @wayneashleyberry! I had the same not working issue - Thanks for the idea to run git status in vim - My issue was due to not having accepted the Xcode license.

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

4 participants