Comments (29)
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.
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.
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.
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.
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.
Hmm, when you edit a file which is being tracked by git, and you type :call GitGutter()
what happens?
from vim-gitgutter.
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.
from vim-gitgutter.
No errors means Vim has correctly loaded the GitGutter function.
Silly question but have you saved your uncommitted changes to disk?
from vim-gitgutter.
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.
Weird. Does :echo gitgutter_initialised
give you 1
?
from vim-gitgutter.
nope, get this error
E121: Undefined variable: gitgutter_initialised
E15: Invalid expression: gitgutter_initialised
Sorry about all this hassle :)
from vim-gitgutter.
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.
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.
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.
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.
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.
I don't think it concerns how the files are loaded. I using :e
mostly and that works fine for me.
from vim-gitgutter.
using git 1.8.1.4
git rev-parse > /dev/null 2>&1
echo $?
returns 0
Using zsh if that matters.
from vim-gitgutter.
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.
Thanks, really appreciated it :)
Here are my dotfiles, just in case
https://github.com/wayneashleyberry/dotfiles
from vim-gitgutter.
Works for me with zsh (on osx).
from vim-gitgutter.
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.
@tonio That's useful to know, thanks.
@wayneashleyberry My Vim's using 1.7.10
so yours should be ok.
from vim-gitgutter.
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.
That's probably a 1.8+ option?
from vim-gitgutter.
Possibly...
from vim-gitgutter.
yup, took it out - the plugin worked instantly :)
thanks for all the help!
from vim-gitgutter.
Great news!
from vim-gitgutter.
Related Issues (20)
- b:gitgutter_was_enabled error anytime you run `saveas newfile.txt` HOT 1
- Undefined variable: b:source_window when staging from a floating preview menu HOT 2
- g:gitgutter_close_preview_on_escape is broken when exists('*nvim_open_win') HOT 2
- vim-gitgutter clobbers v:shell_error via autocmd ShellCmdPost HOT 7
- File renames aren't handled properly HOT 13
- Error detected while processing CursorHold HOT 14
- g:gitgutter_diff_base () is invalid HOT 4
- Neovim Nightly Issue HOT 2
- Neovim now prefers extmarks to signs HOT 3
- errors when file path includes colons HOT 3
- Performance issues after base_path fix HOT 5
- Branch rename breaking installations? HOT 1
- g:gitgutter_diff_base () is invalid HOT 10
- Performance issues with big files in the repository HOT 3
- cursorline highlighting doesn't work with gitgutter HOT 3
- gutter colors not showing change on correct line HOT 1
- No hunks (file possibly recognized as binary file) HOT 5
- GitGutterLineHighlightsToggle doesn't update immediately on neovim HOT 3
- GG doesn't show file changes when in a worktree HOT 3
- key map expr needs more backslashes? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-gitgutter.