Git Product home page Git Product logo

Comments (29)

acaire avatar acaire commented on May 18, 2024 1

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.

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

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.

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

What happens if you do :!git?

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

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

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

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

No errors means Vim has correctly loaded the GitGutter function.

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

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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"

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

Weird. Does :echo gitgutter_initialised give you 1?

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

nope, get this error

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

Sorry about all this hassle :)

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

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.

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

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.

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

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?

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

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

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

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.

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

Thanks, really appreciated it :)

Here are my dotfiles, just in case

https://github.com/wayneashleyberry/dotfiles

from vim-gitgutter.

tonio avatar tonio commented on May 18, 2024

Works for me with zsh (on osx).

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

@tonio That's useful to know, thanks.

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

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

That's probably a 1.8+ option?

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

Possibly...

from vim-gitgutter.

wayneashleyberry avatar wayneashleyberry commented on May 18, 2024

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

thanks for all the help!

from vim-gitgutter.

airblade avatar airblade commented on May 18, 2024

Great news!

from vim-gitgutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.