airblade / vim-gitgutter

A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks.
MIT License
8.36k stars 296 forks source link

No signs are visible #29

Closed daGrevis closed 11 years ago

daGrevis commented 11 years ago

I just installed plugin, opened file in Git repo and editted it a little bit. I don't see any pluses, minuses or whatever. If I simply execute git diff, I can see teh changes. Syntastic do work too! There is no conf or anything for this plugin too, but plugin is installed because I can access those provided commands.

Any ideas?:(

ati commented 11 years ago

Same thing here. Vim 7.3, Mac OS X 10.7

I can place signs manually (:sign place ...), access plugin commands (e.g. ToggleGitGutter) but GitGutter doesn't work.

kearnh commented 11 years ago

Are you running Windows and/or have you configured git to show colored diffs? (I had both these problems) I fixed it by changing the line the s:run_diff function:

diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim
old mode 100644
new mode 100755
index d6b31a5..72bad36
--- a/plugin/gitgutter.vim
+++ b/plugin/gitgutter.vim
@@ -103,10 +103,10 @@ endfunction
 " Diff processing {{{

 function! s:run_diff()
-  let cmd = 'git diff --no-ext-diff -U0 ' . shellescape(s:current_file()) .
+  let cmd = 'git diff --no-ext-diff -U0 --no-color ' . shellescape(expand('%')) .
         \ ' | grep -e "^@@ "'
   let diff = system(s:command_in_directory_of_current_file(cmd))
   return diff
 endfunction
daGrevis commented 11 years ago

Tried it — no luck!

This is my .gitconfig:

[user]
    name = Raitis Stengrevics
    email = dagrevis@gmail.com
[core]
    editor = vim
[color]
    ui = true
    diff = always
    editor = vim
[alias]
    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset <%an>' --abbrev-commit --date=relative
    status = status -sb
    stat = status
    co = checkout
    new = !sh -c 'git checkout -b $0 && git push -u origin $0'
[rerere]
    enabled = 1
[merge]
    tool = vimdiff

This line is in my .zshenv, if it is relavant somehow.

alias diff='colordiff -u'

I'm using Arch Linux. Maybe plugin can't find my git or diff?

 % which git
/usr/bin/git
 % which diff
diff: aliased to colordiff -u
 % which colordiff
/usr/bin/colordiff

Thanks!

airblade commented 11 years ago

Thanks for posting your configs – very helpful.

I suspect the problem is related to your diff alias. Please could you remove it, relaunch your shell/vim, and try again?

daGrevis commented 11 years ago

Removed alias for diff. Now diff points to /usr/bin/diff.

Sorry, but it doesn't help.

Should I open vim in dir where .git is or I can open it in any place where Git repo exists?

airblade commented 11 years ago

You open vim anywhere at all, even outside your repo.

In Vim what does :echo &shell give you? If it's not /bin/bash then I know what the problem is and I'm working on the fix. If it is, then I'll have to keep thinking...

daGrevis commented 11 years ago

It is /bin/zsh indeed. :)

airblade commented 11 years ago

Glad we found the problem :)

It should work for you as of 00a8622.

ati commented 11 years ago

Doesn't work for me yet :/

:echo &shell
/bin/bash
03:41:32 ati@192 ~/.vim/bundle$ cat ~/.gitconfig 
[user]
    name = Alexander
    email = ati@undev.ru

[alias]
    lol = log --graph --decorate --pretty=oneline --abbrev-commit
    lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
    puls = pull origin spring-2012
[color]
    branch = auto
    diff = no
    interactive = auto
    status = auto
"Pathogen
set nocp
filetype off
" To disable a plugin, add it's bundle name to the following list
"let g:pathogen_disabled = ['syntastic']
call pathogen#infect()

syntax off
set number
set cursorline
filetype on
filetype plugin on
filetype indent on

set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set bs=2

set autoindent
set smartindent

set nohlsearch
set incsearch
set ignorecase
set smartcase

" This will set your path variable to current directory (from which you
" launched vim) and to all directories under current directory recursively.
" use find and sfind to open files
set path=$PWD/**

if has("gui_running")
"   set transparency=5
    set guioptions-=T
    colorscheme bclear
    set number
else
    set t_Co=256
    " colorscheme desert256
    " colorscheme railscasts
    " colorscheme xoria256
    colorscheme lucius
endif

" set shortmess=atI
set ruler
set scrolloff=3
set wildmenu
set wildmode=list:longest
set hidden
set pastetoggle=<F2>
set mouse=a
set mousemodel=extend
" MAC OS vim 7.3+
set clipboard=unnamed

" don't scan included files for autocompletion
set complete -=i

nnoremap ' `
nnoremap ` '
map <F1> <esc>
nnoremap <Tab> w

" taglist plugin settings
nnoremap <silent> <F5> :TagbarToggle<CR>
"let tlist_php_settings = 'php;c:class;f:function;c:constant'
"let Tlist_Exit_OnlyWindow = 1
"let Tlist_GainFocus_On_ToggleOpen = 1

" status highlighting from
" http://www.reddit.com/r/vim/comments/gexi6/a_smarter_statusline_code_in_comments/
" end of status highlighting code

"
" :autocmd BufRead *.php set tags=$HOME/ivacy-tags
autocmd BufRead,BufNewFile *.tpl source $VIMRUNTIME/ftplugin/html.vim

autocmd FileType html,eruby,mako let b:closetag_html_style=1
autocmd FileType html,xhtml,xml,htmldjango,jinjahtml,eruby,mako source ~/.vim/bundle/closetag/plugin/closetag.vim

"autocmd FileType smarty source $VIMRUNTIME/macros/matchit.vim
autocmd BufRead,BufNewFile *.rb set filetype=ruby
"
autocmd BufReadPost *
  \ if line("'\"") > 0 && line("'\"") <= line("$") |
  \   exe "normal g`\"" |
  \ endif

if strlen ( finddir ('~/.vim-tmp' )  ) == 0
    silent execute '!mkdir ~/.vim-tmp'
endif

set directory=~/.vim-tmp
"

highlight LineNr ctermbg=none ctermfg=65
highlight StatusLine ctermbg=59
highlight StatusLineNC ctermbg=236
iab <expr> hdts ':' . strftime('%A, %e %B %Y %H:%M') . ', ' . hostname()

let g:syntastic_enable_signs=1
airblade commented 11 years ago

Oh dear.

Does it work by any chance if you comment out let g:syntastic_enable_signs=1 at the end of your vimrc?

ati commented 11 years ago

Sorry -- now it shows signs after saving a file. Thank you, great job!

daGrevis commented 11 years ago

Awesome! That fixes the issue! :bow: