GithubHelp home page GithubHelp logo

airblade / vim-gitgutter Goto Github PK

View Code? Open in Web Editor NEW
8.3K 8.3K 297.0 1.37 MB

A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks.

License: MIT License

Shell 0.36% Vim Script 99.64%
diff git gitgutter neovim vim

vim-gitgutter's Introduction

vim-gitgutter

A Vim plugin which shows a git diff in the sign column. It shows which lines have been added, modified, or removed. You can also preview, stage, and undo individual hunks; and stage partial hunks. The plugin also provides a hunk text object.

The signs are always up to date and the plugin never saves your buffer.

The name "gitgutter" comes from the Sublime Text 3 plugin which inspired this in 2013.

Features:

  • Shows signs for added, modified, and removed lines.
  • Runs the diffs asynchronously where possible.
  • Ensures signs are always up to date.
  • Never saves the buffer.
  • Quick jumping between blocks of changed lines ("hunks").
  • Stage/undo/preview individual hunks.
  • Previews highlight intra-line changes.
  • Stage partial hunks.
  • Provides a hunk text object.
  • Diffs against index (default) or any commit.
  • Handles file moves / renames.
  • Heeds git's "assume unchanged" bit.
  • Allows folding all unchanged text.
  • Provides fold text showing whether folded lines have been changed.
  • Can load all hunk locations into quickfix list or the current window's location list.
  • Handles line endings correctly, even with repos that do CRLF conversion.
  • Handles clean/smudge filters.
  • Optional line highlighting.
  • Optional line number highlighting. (Only available in Neovim 0.3.2 or higher)
  • Fully customisable (signs, sign column, line (number) highlights, mappings, extra git-diff arguments, etc).
  • Can be toggled on/off, globally or per buffer.
  • Preserves signs from other plugins.
  • Does the right thing when viewing revisions with fugitive's :0Gclog.
  • Easy to integrate diff stats into status line; built-in integration with vim-airline.
  • Works with fish shell (in addition to the usual shells).

Constraints:

  • Supports git only. If you work with other version control systems, I recommend vim-signify.
  • Relies on the FocusGained event. If your terminal doesn't report focus events, either use something like Terminus or set let g:gitgutter_terminal_reports_focus=0. For tmux, set -g focus-events on in your tmux.conf.

Compatibility:

Compatible back to Vim 7.4, and probably 7.3.

Screenshot

screenshot

In the screenshot above you can see:

  • Lines 183-184 are new.
  • Lines 186-187 have been modified.
  • The preview for the modified lines highlights changed regions within the line.

Installation

First, install using your favourite package manager, or use Vim's built-in package support.

Vim:

mkdir -p ~/.vim/pack/airblade/start
cd ~/.vim/pack/airblade/start
git clone https://github.com/airblade/vim-gitgutter.git
vim -u NONE -c "helptags vim-gitgutter/doc" -c q

Neovim:

mkdir -p ~/.config/nvim/pack/airblade/start
cd ~/.config/nvim/pack/airblade/start
git clone https://github.com/airblade/vim-gitgutter.git
nvim -u NONE -c "helptags vim-gitgutter/doc" -c q

Second, ensure your updatetime and signcolumn options are set appropriately.

When you make a change to a file tracked by git, the diff markers should appear automatically after a short delay. The delay is governed by vim's updatetime option; the default value is 4000, i.e. 4 seconds, but I suggest reducing it to around 100ms (add set updatetime=100 to your vimrc). Note updatetime also controls the delay before vim writes its swap file (see :help updatetime).

The signcolumn option can have any value except 'off'.

Windows

There is a potential risk on Windows due to cmd.exe prioritising the current folder over folders in PATH. If you have a file named git.* (i.e. with any extension in PATHEXT) in your current folder, it will be executed instead of git whenever the plugin calls git.

You can avoid this risk by configuring the full path to your git executable. For example:

" This path probably won't work
let g:gitgutter_git_executable = 'C:\Program Files\Git\bin\git.exe'

Unfortunately I don't know the correct escaping for the path - if you do, please let me know!

Getting started

When you make a change to a file tracked by git, the diff markers should appear automatically after a short delay.

You can jump between hunks with [c and ]c. You can preview, stage, and undo hunks with <leader>hp, <leader>hs, and <leader>hu respectively.

You cannot unstage a staged hunk.

After updating the signs, the plugin fires the GitGutter User autocommand.

After staging a hunk or part of a hunk, the plugin fires the GitGutterStage User autocommand.

Activation

You can explicitly turn vim-gitgutter off and on (defaults to on):

  • turn off with :GitGutterDisable
  • turn on with :GitGutterEnable
  • toggle with :GitGutterToggle.

To toggle vim-gitgutter per buffer:

  • turn off with :GitGutterBufferDisable
  • turn on with :GitGutterBufferEnable
  • toggle with :GitGutterBufferToggle

You can turn the signs on and off (defaults to on):

  • turn on with :GitGutterSignsEnable
  • turn off with :GitGutterSignsDisable
  • toggle with :GitGutterSignsToggle.

And you can turn line highlighting on and off (defaults to off):

  • turn on with :GitGutterLineHighlightsEnable
  • turn off with :GitGutterLineHighlightsDisable
  • toggle with :GitGutterLineHighlightsToggle.

Note that if you have line highlighting on and signs off, you will have an empty sign column – more accurately, a sign column with invisible signs. This is because line highlighting requires signs and Vim/NeoVim always shows the sign column when there are signs even if the signs are invisible.

With Neovim 0.3.2 or higher, you can turn line number highlighting on and off (defaults to off):

  • turn on with :GitGutterLineNrHighlightsEnable
  • turn off with :GitGutterLineNrHighlightsDisable
  • toggle with :GitGutterLineNrHighlightsToggle.

The same caveat applies to line number highlighting as to line highlighting just above.

If you switch off both line highlighting and signs, you won't see the sign column.

In older Vims (pre 8.1.0614 / Neovim 0.4.0) vim-gitgutter will suppress the signs when a file has more than 500 changes, to avoid slowing down the UI. As soon as the number of changes falls below the limit vim-gitgutter will show the signs again. You can configure the threshold with:

let g:gitgutter_max_signs = 500  " default value (Vim < 8.1.0614, Neovim < 0.4.0)
let g:gitgutter_max_signs = -1   " default value (otherwise)

You can also remove the limit by setting g:gitgutter_max_signs = -1.

Hunks

You can jump between hunks:

  • jump to next hunk (change): ]c
  • jump to previous hunk (change): [c.

Both of those take a preceding count.

To set your own mappings for these, for example ]h and [h:

nmap ]h <Plug>(GitGutterNextHunk)
nmap [h <Plug>(GitGutterPrevHunk)

When you jump between hunks, a message like Hunk 4 of 11 is shown on the command line. If you want to turn the message off, you can use:

let g:gitgutter_show_msg_on_hunk_jumping = 0

You can load all your hunks into the quickfix list with :GitGutterQuickFix. Note this ignores any unsaved changes in your buffers. If the option g:gitgutter_use_location_list is set, this command will load hunks into the current window's location list instead. Use :copen (or :lopen) to open the quickfix / location list or add a custom command like this:

command! Gqf GitGutterQuickFix | copen

You can stage or undo an individual hunk when your cursor is in it:

  • stage the hunk with <Leader>hs or
  • undo it with <Leader>hu.

To stage part of an additions-only hunk by:

  • either visually selecting the part you want and staging with your mapping, e.g. <Leader>hs;
  • or using a range with the GitGutterStageHunk command, e.g. :42,45GitGutterStageHunk.

To stage part of any hunk:

  • preview the hunk, e.g. <Leader>hp;
  • move to the preview window, e.g. :wincmd P;
  • delete the lines you do not want to stage;
  • stage the remaining lines: either write (:w) the window or stage via <Leader>hs or :GitGutterStageHunk.

Note the above workflow is not possible if you have opted in to preview hunks with Vim's popup windows.

See the FAQ if you want to unstage staged changes.

The . command will work with both these if you install repeat.vim.

To set your own mappings for these, for example if you prefer g-based maps:

nmap ghs <Plug>(GitGutterStageHunk)
nmap ghu <Plug>(GitGutterUndoHunk)

And you can preview a hunk's changes with <Leader>hp. The location of the preview window is configured with g:gitgutter_preview_win_location (default 'bo'). You can of course change this mapping, e.g:

nmap ghp <Plug>(GitGutterPreviewHunk)

A hunk text object is provided which works in visual and operator-pending modes.

  • ic operates on all lines in the current hunk.
  • ac operates on all lines in the current hunk and any trailing empty lines.

To re-map these, for example to ih and ah:

omap ih <Plug>(GitGutterTextObjectInnerPending)
omap ah <Plug>(GitGutterTextObjectOuterPending)
xmap ih <Plug>(GitGutterTextObjectInnerVisual)
xmap ah <Plug>(GitGutterTextObjectOuterVisual)

If you don't want vim-gitgutter to set up any mappings at all, use this:

let g:gitgutter_map_keys = 0

Finally, you can force vim-gitgutter to update its signs across all visible buffers with :GitGutterAll.

See the customisation section below for how to change the defaults.

Vimdiff

Use the GitGutterDiffOrig command to open a vimdiff view of the current buffer, respecting g:gitgutter_diff_relative_to and :gitgutter_diff_base.

Folding

Use the GitGutterFold command to fold all unchanged lines, leaving just the hunks visible. Use zr to unfold 3 lines of context above and below a hunk.

Execute GitGutterFold a second time to restore the previous view.

Use gitgutter#fold#foldtext() to augment the default foldtext() with an indicator of whether the folded lines have been changed.

set foldtext=gitgutter#fold#foldtext()

For a closed fold with changed lines:

Default foldtext():         +-- 45 lines: abcdef
gitgutter#fold#foldtext():  +-- 45 lines (*): abcdef

You can use gitgutter#fold#is_changed() in your own foldtext expression to find out whether the folded lines have been changed.

Status line

Call the GitGutterGetHunkSummary() function from your status line to get a list of counts of added, modified, and removed lines in the current buffer. For example:

" Your vimrc
function! GitStatus()
  let [a,m,r] = GitGutterGetHunkSummary()
  return printf('+%d ~%d -%d', a, m, r)
endfunction
set statusline+=%{GitStatus()}

Customisation

You can customise:

  • The sign column's colours
  • Whether or not the sign column is shown when there aren't any signs (defaults to no)
  • How to handle non-gitgutter signs
  • The signs' colours and symbols
  • Line highlights
  • Line number highlights (only in Neovim 0.3.2 or higher)
  • The diff syntax colours used in the preview window
  • The intra-line diff highlights used in the preview window
  • Whether the diff is relative to the index (default) or working tree.
  • The base of the diff
  • Extra arguments for git when running git diff
  • Extra arguments for git diff
  • Key mappings
  • Whether vim-gitgutter is on initially (defaults to on)
  • Whether signs are shown (defaults to yes)
  • Whether line highlighting is on initially (defaults to off)
  • Whether line number highlighting is on initially (defaults to off)
  • Whether vim-gitgutter runs asynchronously (defaults to yes)
  • Whether to clobber or preserve non-gitgutter signs
  • The priority of gitgutter's signs.
  • Whether to use a floating/popup window for hunk previews
  • The appearance of a floating/popup window for hunk previews
  • Whether to populate the quickfix list or a location list with all hunks

Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme.

Sign column

Set the SignColumn highlight group to change the sign column's colour. For example:

" vim-gitgutter used to do this by default:
highlight! link SignColumn LineNr

" or you could do this:
highlight SignColumn guibg=whatever ctermbg=whatever

By default the sign column will appear when there are signs to show and disappear when there aren't. To always have the sign column, add to your vimrc:

" Vim 7.4.2201
set signcolumn=yes

GitGutter can preserve or ignore non-gitgutter signs. For Vim v8.1.0614 and later you can set gitgutter's signs' priorities with g:gitgutter_sign_priority, so gitgutter defaults to clobbering other signs. For Neovim v0.4.0 and later you can set an expanding sign column so gitgutter again defaults to clobbering other signs. Otherwise, gitgutter defaults to preserving other signs. You can configure this with:

let g:gitgutter_sign_allow_clobber = 1

Signs' colours and symbols

If you or your colourscheme has defined GitGutter* highlight groups, the plugin will use them for the signs' colours.

If you want the background colours to match the sign column, but don't want to update the GitGutter* groups yourself, you can get the plugin to do it:

let g:gitgutter_set_sign_backgrounds = 1

If no GitGutter* highlight groups exist, the plugin will check the Diff* highlight groups. If their foreground colours differ the plugin will use them; if not, these colours will be used:

highlight GitGutterAdd    guifg=#009900 ctermfg=2
highlight GitGutterChange guifg=#bbbb00 ctermfg=3
highlight GitGutterDelete guifg=#ff2222 ctermfg=1

To customise the symbols, add the following to your ~/.vimrc:

let g:gitgutter_sign_added = 'xx'
let g:gitgutter_sign_modified = 'yy'
let g:gitgutter_sign_removed = 'zz'
let g:gitgutter_sign_removed_first_line = '^^'
let g:gitgutter_sign_removed_above_and_below = '{'
let g:gitgutter_sign_modified_removed = 'ww'

Line highlights

Similarly to the signs' colours, set up the following highlight groups in your colorscheme or ~/.vimrc:

GitGutterAddLine          " default: links to DiffAdd
GitGutterChangeLine       " default: links to DiffChange
GitGutterDeleteLine       " default: links to DiffDelete
GitGutterChangeDeleteLine " default: links to GitGutterChangeLine, i.e. DiffChange

For example, in some colorschemes the DiffText highlight group is easier to read than DiffChange. You could use it like this:

highlight link GitGutterChangeLine DiffText

Line number highlights

NOTE: This feature requires Neovim 0.3.2 or higher.

Similarly to the signs' colours, set up the following highlight groups in your colorscheme or ~/.vimrc:

GitGutterAddLineNr          " default: links to CursorLineNr
GitGutterChangeLineNr       " default: links to CursorLineNr
GitGutterDeleteLineNr       " default: links to CursorLineNr
GitGutterChangeDeleteLineNr " default: links to GitGutterChangeLineNr

Maybe you think CursorLineNr is a bit annoying. For example, you could use Underlined for this:

highlight link GitGutterChangeLineNr Underlined

The diff syntax colours used in the preview window

To change the diff syntax colours used in the preview window, set up the diff* highlight groups in your colorscheme or ~/.vimrc:

diffAdded   " if not set: use GitGutterAdd's foreground colour
diffChanged " if not set: use GitGutterChange's foreground colour
diffRemoved " if not set: use GitGutterDelete's foreground colour

Note the diff* highlight groups are used in any buffer whose 'syntax' is diff.

The intra-line diff highlights used in the preview window

To change the intra-line diff highlights used in the preview window, set up the following highlight groups in your colorscheme or ~/.vimrc:

GitGutterAddIntraLine    " default: gui=reverse cterm=reverse
GitGutterDeleteIntraLine " default: gui=reverse cterm=reverse

For example, to use DiffAdd for intra-line added regions:

highlight link GitGutterAddIntraLine DiffAdd

Whether the diff is relative to the index or working tree

By default diffs are relative to the index. How you can make them relative to the working tree:

let g:gitgutter_diff_relative_to = 'working_tree'

The base of the diff

By default buffers are diffed against the index. However you can diff against any commit by setting:

let g:gitgutter_diff_base = '<commit SHA>'

If you are looking at a previous version of a file with Fugitive (e.g. via :0Gclog), gitgutter sets the diff base to the parent of the current revision.

This setting is ignored when the diffs are relative to the working tree.

Extra arguments for git when running git diff

If you want to pass extra arguments to git when running git diff, do so like this:

let g:gitgutter_git_args = '--git-dir-""'

Extra arguments for git diff

If you want to pass extra arguments to git diff, for example to ignore whitespace, do so like this:

let g:gitgutter_diff_args = '-w'

Key mappings

To disable all key mappings:

let g:gitgutter_map_keys = 0

See above for configuring maps for hunk-jumping and staging/undoing.

Use a custom grep command

If you use an alternative to grep, you can tell vim-gitgutter to use it here.

" Default:
let g:gitgutter_grep = 'grep'

To turn off vim-gitgutter by default

Add let g:gitgutter_enabled = 0 to your ~/.vimrc.

To turn off signs by default

Add let g:gitgutter_signs = 0 to your ~/.vimrc.

To turn on line highlighting by default

Add let g:gitgutter_highlight_lines = 1 to your ~/.vimrc.

To turn on line number highlighting by default

Add let g:gitgutter_highlight_linenrs = 1 to your ~/.vimrc.

To turn off asynchronous updates

By default diffs are run asynchronously. To run diffs synchronously instead:

let g:gitgutter_async = 0

To use floating/popup windows for hunk previews

Add let g:gitgutter_preview_win_floating = 1 to your ~/.vimrc. Note that on Vim this prevents you staging (partial) hunks via the preview window.

The appearance of a floating/popup window for hunk previews

Either set g:gitgutter_floating_window_options to a dictionary of the options you want. This dictionary is passed directly to popup_create() (Vim) / nvim_open_win() (Neovim).

Or if you just want to override one or two of the defaults, you can do that with a file in an after/ directory. For example:

" ~/.vim/after/vim-gitgutter/overrides.vim
let g:gitgutter_floating_window_options['border'] = 'single'

To load all hunks into the current window's location list instead of the quickfix list

Add let g:gitgutter_use_location_list = 1 to your ~/.vimrc.

Extensions

Operate on every line in a hunk

You can map an operator to do whatever you want to every line in a hunk.

Let's say, for example, you want to remove trailing whitespace.

function! CleanUp(...)
  if a:0  " opfunc
    let [first, last] = [line("'["), line("']")]
  else
    let [first, last] = [line("'<"), line("'>")]
  endif
  for lnum in range(first, last)
    let line = getline(lnum)

    " clean up the text, e.g.:
    let line = substitute(line, '\s\+$', '', '')

    call setline(lnum, line)
  endfor
endfunction

nmap <silent> <Leader>x :set opfunc=CleanUp<CR>g@

Then place your cursor in a hunk and type \xic (assuming a leader of \).

Alternatively you could place your cursor in a hunk, type vic to select it, then :call CleanUp().

Operate on every changed line in a file

You can write a command to do whatever you want to every changed line in a file.

function! GlobalChangedLines(ex_cmd)
  for hunk in GitGutterGetHunks()
    for lnum in range(hunk[2], hunk[2]+hunk[3]-1)
      let cursor = getcurpos()
      silent! execute lnum.a:ex_cmd
      call setpos('.', cursor)
    endfor
  endfor
endfunction

command -nargs=1 Glines call GlobalChangedLines(<q-args>)

Let's say, for example, you want to remove trailing whitespace from all changed lines:

:Glines s/\s\+$//

Cycle through hunks in current buffer

This is like :GitGutterNextHunk but when it gets to the last hunk in the buffer it cycles around to the first.

function! GitGutterNextHunkCycle()
  let line = line('.')
  silent! GitGutterNextHunk
  if line('.') == line
    1
    GitGutterNextHunk
  endif
endfunction

Cycle through hunks in all buffers

You can use :GitGutterQuickFix to load all hunks into the quickfix list or the current window's location list.

Alternatively, given that]c and [c jump from one hunk to the next in the current buffer, you can use this code to jump to the next hunk no matter which buffer it's in.

function! NextHunkAllBuffers()
  let line = line('.')
  GitGutterNextHunk
  if line('.') != line
    return
  endif

  let bufnr = bufnr('')
  while 1
    bnext
    if bufnr('') == bufnr
      return
    endif
    if !empty(GitGutterGetHunks())
      1
      GitGutterNextHunk
      return
    endif
  endwhile
endfunction

function! PrevHunkAllBuffers()
  let line = line('.')
  GitGutterPrevHunk
  if line('.') != line
    return
  endif

  let bufnr = bufnr('')
  while 1
    bprevious
    if bufnr('') == bufnr
      return
    endif
    if !empty(GitGutterGetHunks())
      normal! G
      GitGutterPrevHunk
      return
    endif
  endwhile
endfunction

nmap <silent> ]c :call NextHunkAllBuffers()<CR>
nmap <silent> [c :call PrevHunkAllBuffers()<CR>

FAQ

How can I turn off realtime updates?

Add this to your vim configuration (in an /after/plugin directory):

" .vim/after/plugin/gitgutter.vim
autocmd! gitgutter CursorHold,CursorHoldI

I turned off realtime updates, how can I have signs updated when I save a file?

If you really want to update the signs when you save a file, add this to your vimrc:

autocmd BufWritePost * GitGutter

Why can't I unstage staged changes?

This plugin is for showing changes between the buffer and the index (and staging/undoing those changes). Unstaging a staged hunk would require showing changes between the index and HEAD, which is out of scope.

Why are the colours in the sign column weird?

Your colorscheme is configuring the SignColumn highlight group weirdly. Please see the section above on customising the sign column.

What happens if I also use another plugin which uses signs (e.g. Syntastic)?

You can configure whether GitGutter preserves or clobbers other signs using g:gitgutter_sign_allow_clobber. Set to 1 to clobber other signs (default on Vim >= 8.1.0614 and NeoVim >= 0.4.0) or 0 to preserve them.

Troubleshooting

When no signs are showing at all

Here are some things you can check:

  • Try adding let g:gitgutter_grep='' to your vimrc. If it works, the problem is grep producing non-plain output; e.g. ANSI escape codes or colours.
  • Verify :echo system("git --version") succeeds.
  • Verify your git config is compatible with the version of git returned by the command above.
  • Verify your Vim supports signs (:echo has('signs') should give 1).
  • Verify your file is being tracked by git and has unstaged changes. Check whether the plugin thinks git knows about your file: :echo b:gitgutter.path should show the path to the file in the repo.
  • Execute :sign place group=gitgutter; you should see a list of signs.
    • If the signs are listed: this is a colorscheme / highlight problem. Compare :highlight GitGutterAdd with :highlight SignColumn.
    • If no signs are listed: the call to git-diff is probably failing. Add let g:gitgutter_log=1 to your vimrc, restart, reproduce the problem, and look at the gitgutter.log file in the plugin's directory.

When the whole file is marked as added

  • If you use zsh, and you set CDPATH, make sure CDPATH doesn't include the current directory.

When signs take a few seconds to appear

  • Try reducing updatetime, e.g. set updatetime=100. Note this also controls the delay before vim writes its swap file.

When signs don't update after focusing Vim

  • Your terminal probably isn't reporting focus events. Either try installing Terminus or set let g:gitgutter_terminal_reports_focus=0. For tmux, try set -g focus-events on in your tmux.conf.

Shameless Plug

If this plugin has helped you, or you'd like to learn more about Vim, why not check out this screencast I wrote for PeepCode:

This was one of PeepCode's all-time top three bestsellers and is now available at Pluralsight.

Intellectual Property

Copyright Andrew Stewart, AirBlade Software Ltd. Released under the MIT licence.

vim-gitgutter's People

Contributors

0mp avatar airblade avatar atcold avatar bling avatar blueyed avatar caojoshua avatar delphinus avatar elyscape avatar geneotech avatar h3xx avatar jaxbot avatar jbylsma avatar jssjr avatar ku1ik avatar mantoni avatar marbu avatar mhinz avatar nkouevda avatar obcat avatar qlem avatar rcr avatar rdamen avatar redbeard0531 avatar sudo-nice avatar sunaku avatar swnakamura avatar tlarrieu avatar vincentcordobes avatar wellle avatar wywong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-gitgutter's Issues

Errors using Italian language, disappear with LC_ALL="C"

I got these errors running latest GitGutter with my system set in the Italian language. Funny, these go away if I export LC_ALL="C", so I can't post them in English

--- Segni ---
Segni per include/const.h:
    linea=237 id=153, nome=GitGutterDummy

linea    8:
E684: indice lista fuori intervallo: 1
Errore/i eseguendo function GitGutter..<SNR>22_find_other_signs:
linea    8:
E116: Argomenti non validi per la funzione: str2nr(matches[1])
Errore/i eseguendo function GitGutter..<SNR>22_find_other_signs:
linea    8:
E15: Espressione non valida: str2nr(matches[1])
Errore/i eseguendo function GitGutter..<SNR>22_find_other_signs:
linea    9:
E121: Variabile non definita: line_number
Errore/i eseguendo function GitGutter..<SNR>22_find_other_signs:
linea    9:
E116: Argomenti non validi per la funzione: addPremi INVIO o un comando per proseguire

Translation:

Markers for include/const.h:
    line=237 id=153, nome=GitGutterDummy

line     8:
E684: list index out of range: 1
Errors executing function GitGutter..<SNR>22_find_other_signs:
line     8:
E116: Wrong arguments for function: str2nr(matches[1])
Errors executing function GitGutter..<SNR>22_find_other_signs:
line     8:
E15: Invalid expression: str2nr(matches[1])
Errors executing function GitGutter..<SNR>22_find_other_signs:
line     9:
E121: Undefined variable: line_number
Errors executing function GitGutter..<SNR>22_find_other_signs:
linea    9:
E116: Invalid arguments for function: add

Slow performance with many buffers open

When I first open Vim and start using it, everything works fine. But after opening many buffers (like I always do), vim-gitgutter starts to take a noticeable amount of time. With a few tabs/splits open, there's only a quick flickering of the cursor as it goes from buffer to buffer, not much of a problem at all. But when it gets to around a dozen buffers or more, it can take 3-5 seconds and totally kills my productivity (I switch application tabs a lot).

Not sure what could be done about this. I do think that it appears to be calculating buffers that were opened previously but aren't currently open in a tab/window.

FYI I'm using MacVim 7.3 (65). Thanks!

Error when using the plugin

Error detected while processing function GitGutter..<SNR>18_parse_diff:
line    5:
E684: list index out of range: 1
E116: Invalid arguments for function str2nr(matches[1])
E15: Invalid expression: str2nr(matches[1])
line    6:
E684: list index out of range: 2
E15: Invalid expression: (matches[2] == '') ? 1 : str2nr(matches[2])
line    7:
E684: list index out of range: 3
E116: Invalid arguments for function str2nr(matches[3])
E15: Invalid expression: str2nr(matches[3])
line    8:
E684: list index out of range: 4
E15: Invalid expression: (matches[4] == '') ? 1 : str2nr(matches[4])
line    9:
E121: Undefined variable: from_line
E116: Invalid arguments for function add
line    5:
E684: list index out of range: 1
E116: Invalid arguments for function str2nr(matches[1])
E15: Invalid expression: str2nr(matches[1])
line    6:
E684: list index out of range: 2
E15: Invalid expression: (matches[2] == '') ? 1 : str2nr(matches[2])
line    7:
E684: list index out of range: 3
E116: Invalid arguments for function str2nr(matches[3])
E15: Invalid expression: str2nr(matches[3])
line    8:
E684: list index out of range: 4
E15: Invalid expression: (matches[4] == '') ? 1 : str2nr(matches[4])
line    9:
E121: Undefined variable: from_line
E116: Invalid arguments for function add

characters to indicate removal immediately before change or addition

I propose these signs for wherever removal precedes addition or change:

±

The former could be yellow (green + red), the latter... cyan? These symbols could default to + and ~ for users who can't display the unicode versions, and maybe be allowed to show through a global var.

Does not show changes for files outside current git directory

Say I have two git repositories, side by side:

~/repo-one
~/repo-two

If I cd into ~/repo-one then start editing any of its files with vim, the plugin works great (thanks by the way, I love it!).

If, while still inside the ~/repo-one directory I open a file that resides within the ~/repo-two directory, no changes are displayed. cd-ing into the ~/repo-two directory and opening said file from there works fine.

No signs are visible

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?:(

Keep the gutter always expanded

Is it possible to keep the GitGutter always expanded?

I noticed that it is collapsed (not shown) when the buffer has no changes.

I want my buffers to have the same width gutter on the left at all times.

Re-check files after gaining focus

If I modify a file and write it, I see the signs in the sign column. Then, if I tab out, commit, and tab back in to Vim, they are still there. I have to write again to get them to correctly disappear. I think they should disappear automatically, optimally once the commit is registered, but more likely when you give focus to Vim again. Does this sound feasible?

Error detected while processing function GitGutter..<SNR>58_init..<SNR>58_define_signs..<SNR>58_define_sign_line_highlights..Pl#Statusline:

Error detected while processing function GitGutter..58_init..58_define_signs..58_define_sign_line_highlights..Pl#Statusline:
line   18:
E684: list index out of range: 0
E15: Invalid expression: g:Pl#THEME[a:statusline].mode_statuslines[mode]
let g:syntastic_auto_loc_list=1
let g:syntastic_enable_balloons = 1
let g:syntastic_check_on_open=0
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 26 2013 13:43:09)
MacOS X (unix) version
Included patches: 1-266
Compiled by [email protected]
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
+mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg +path_extra -perl
 +persistent_undo +postscript +printer +profile +python -python3 +quickfix
+reltime +rightleft +ruby +scrollbind +signs +smartindent -sniff +startuptime
+statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white
-tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands
+vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore
+wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard
-xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/Cellar/vim/7.3.266/share/vim"
Compilation: cc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX -no-cpp-precomp  -g -O2 -D_FORTIFY_SOURCE=1
Linking: cc   -L.     -L/usr/local/lib -o vim       -lm  -lncurses -liconv -framework Cocoa     -framework Python   -lruby -lobjc

Plugin error on start when user's default shell is set to /bin/tcsh

After installation, editing a file under version control will result in the following error message:

Error detected while processing function GitGutter..<SNR>21_is_active..<SNR>21_is_in_a_git_repo:
line    2:
E484: Can't open file /var/folders/16/9vmrqw0n1pq9g2gqg9bb60_80000gn/T/vjiD4SE/1

how I debugged issue not knowing vimscript
I narrowed it down by examining the shell commands by added the following line to the function s:command_in_directory_of_current_file after line 85

    echo a:cmd

It showed that the following command was raising the error

git rev-parse > /dev/null 2>&1

I figured the problem was that my shell was set to tcsh, which was probably not tested. Sure enough, the following command reported /bin/tcsh.

:set shell

A simple work around is to simply set the default shell that VIM should use by adding this line to your .vimrc

set shell=/bin/sh

Suggestions for a proper bug fix

I would submit a pull request, but I've never tinkered with vimscript before. But one of these options might work:

  • set the shell variable inside the plugin
  • change the way you are redirecting stdout and stderr to work on tcsh

Suggestions for me:

  • change to zsh

Error when launching vim: GitGutter..Error detected while processing function GitGutter..<SNR>10_init..<SNR>10_define_signs:

Getting the following when trying to open a file tracked in git.

Error detected while processing function GitGutter..10_init..10_define_signs:
line 7:
E319: Sorry, the command is not available in this version: sign define GitGutterLineAdded text=+ texthl=lineAdded linehl=NONE
line 8:
E319: Sorry, the command is not available in this version: sign define GitGutterLineModified text=~ texthl=lineModified linehl=NONE
line 9:
E319: Sorry, the command is not available in this version: sign define GitGutterLineRemoved text=_ texthl=lineRemoved linehl=NONE
line 10:
E319: Sorry, the command is not available in this version: sign define GitGutterLineModifiedRemoved text=~_ texthl=lineModified linehl=NONE
Error detected while processing function GitGutter..10_find_other_signs:
line 2:

All lines are highlighted.

Great plugin.

On my work machine all lines of (it seems) all files in a git repository have the green '+' symbol. It worked fine on my home machine.

Details: Ubuntu 10.04, not sure what else is relevant, my home directory is exported from /export

I have looked in the source and running the command you use to get the diff "git show HEAD:file.py | diff - file.py" manually gives the correct output.

Signs disappear on write

Current Behavior:

When I first open a file I see the diff signs in the gutter. When I write my file with :w the gutter flickers on and off then stays off. I can reenable it with :GitGutterEnable.

Expected Behavior:

Diff signs stay visible after writing the file

I am using gvim on Windows XP.

Here is my vimrc if it can help diagnose the issue: http://pastebin.com/xF1MHhcW

I am also using the following plugins through pathogen:

  • python-mode
  • superman
  • vim-fugitive
  • vim-surround

Let me know if I can provide any more information to help diagnose this.

Errors thrown when returning to an empty buffer

Here's how I found this bug:

  1. Open a new tab (no actual file opened here yet)
  2. Switch applications
  3. Come back to Vim
  4. Below errors are thrown:
Error detected while processing function GitGutterAll..GitGutter..<SNR>17_clear_signs:
line    3:
E158: Invalid buffer name: /Users/richtaur/dev/lost_decade/turkey12/
Press ENTER or type command to continue
Error detected while processing function GitGutterAll..GitGutter..<SNR>17_clear_signs:

FYI using MacVim 7.3 (65).

Thanks! Loving this plugin :-)

No signs column.

ret

echo g:gitgutter_enabled 1
echo &shell /bin/bash

set nocompatible                  " Must come first because it changes other options.

silent! call pathogen#runtime_append_all_bundles()
silent! call pathogen#helptags()

syntax enable                     " Turn on syntax highlighting.
filetype plugin indent on         " Turn on file type detection.

set nocompatible
set encoding=utf-8
set fileencodings=utf-8,latin2
set autowrite

set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab
set sta " a <Tab> in an indent inserts 'shiftwidth' spaces

set ai " Automatically set the indent of a new line (local to buffer)
set si " smartindent  (local to buffer)

set hlsearch    " highlight search
set incsearch   " incremental search, search as you type
set ignorecase  " Ignore case when searching 
set smartcase   " Ignore case when searching lowercase

set t_Co=256

set showcmd
set ch=2

set nowrap
set linebreak  " Wrap at word

autocmd BufEnter * lcd %:p:h

au BufRead,BufNewFile,BufFilePost *.json,*.js set filetype=javascript
au BufRead,BufNewFile,BufFilePost *.coffee    set filetype=coffee
au BufRead,BufNewFile,BufFilePost *.less      set filetype=less

autocmd FileType html set filetype=xhtml
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType c set omnifunc=ccomplete#Complete
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete

set backspace=indent,eol,start
set number
set ruler
set matchpairs+=<:>

highlight NonText guifg=#e5e5e5
highlight SpecialKey guifg=#e5e5e5

if has("autocmd")
  autocmd bufwritepost .vimrc source $MYVIMRC
endif

highlight clear SignColumn

I had tried also with

set nocompatible                  " Must come first because it changes other options.

silent! call pathogen#runtime_append_all_bundles()
silent! call pathogen#helptags()

syntax enable                     " Turn on syntax highlighting.
#~ $ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 26 2012 16:45:16)
#~ $ git --version
git version 1.7.10.4

I have no idea what is wrong...

Make column an optional feature

I'm not quite sure if I'm just overlooking an option to do what I want :). But personally I'd prefer to use let g:gitgutter_highlight_lines = 1 instead of using the column. Would it be possible to make the column an optional feature?

explain in README that this is for change-tracking, not diff-viewing

I was confused when I read the description in the README on the project page. I thought from the description that this project only applies when opening files that have been output from calling git diff. That is, I thought that when you open a file containing something like

@@ -1,5 +1,5 @@
 first
-seocnd
+second
 third

this plugin would just move the first column of each hunk to the left of the line numbers, to make it a bit easier to read the contents of the file.

After reading this comment tree on Hacker News, I realized that this plugin does something very different. It continually diffs the file you are working on with the file as it exists in the last commit, using git diff. It then shows those line-level changes in the sidebar.

So rather than just being a viewer for one type of file, this plugin helps you keep track of what work you’ve done in the current file since you’ve last committed. The README should make this clear.

conflict with system clipboard (set clipboard=unnamedplus)

After installing vim-gitgutter ( via http://vim.spf13.com/ ) I ran into a bug where copying into system clipboard (setting clipboard=unnamedplus) (Ubuntu 12.04) no longer worked. After debugging the problem I noticed that if I disable gitgutter, it works fine. The problem existed also with all other plugins disabled (in .vimrc.bundles) and only gitgutter enabled.

Although the selected text were not copied to system clipboard, it was copied to the register associated with system clipboard (the +-register).

My vim-gitgutter version:
commit 3f9cf5a
Date: Fri Mar 8 13:29:38 2013 +0100

Tested with vim 7.3 patches: 1-429,

Add 'count' option to next/prev hunk command

Congrats first, awesome work! I thought a week a ago how cool would it be to see the changed lines 👍

My Feature Request/Question:
I added some mappings to easily jump between hunks:

map ]h   :GitGutterNextHunk<CR>
map [h   :GitGutterPrevHunk<CR>

Is it possible to add 'count' to this? So I can jump 3 hunks down by pressing 3]h?

Which git

Would it be possible to add an option to define which git executable to use?

Vim doesn't use $PATH from my zshrc or bash_profile so it's using an old version.

Maybe something like

let g:gitgutter_git_binary = "/usr/local/bin/git"

I need to use the homebrew git and I'd rather not hack the plugin :)

Not working

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

Saving file de-colours Powerline

I have an interesting issue with vim-gitgutter and Powerline. When I load up vim with only vim-gitgutter everything works perfectly. When I load up vim with both vim-gitgutter and Powerline, when I save the file my vim status bar (and the vim-gitgutter signs) colours/format are lost. I am not sure why this is the case, but I've tried it in both vim and MacVim.

Pre-Save:
Screen Shot 2013-03-06 at 11 49 54 PM

Post-Save:
Screen Shot 2013-03-06 at 11 50 11 PM

Way to turn it off and on

Just thought it would be nice. Because I don't use this feature until I'm ready to commit, and it's just to know what to put in the commit message and details.

If you could implement this I would be grateful. 😄

Kind of "freeze" on Windows 7

I installed it the pathogen way.
But vim kept flickering, I couldn't type anything. After the plugin removed, vim works as before again.

So is Windows supported?

Git:
git version 1.8.1.msysgit.1

Gvim:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 27 2010 17:59:02)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-46
Compiled by Bram@KIBAALE
Big version with GUI. Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff
+digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi
+file_in_path +find_in_path +float +folding -footer +gettext/dyn -hangul_input
+iconv/dyn +insert_expand +jumplist +keymap +langmap +libcall +linebreak
+lispindent +listcmds +localmap -lua +menu +mksession +modify_fname +mouse
+mouseshape +multi_byte_ime/dyn +multi_lang -mzscheme +netbeans_intg +ole
-osfiletype +path_extra +perl/dyn +persistent_undo -postscript +printer
-profile +python/dyn +python3/dyn +quickfix +reltime +rightleft +ruby/dyn
+scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop
+syntax +tag_binary +tag_old_static -tag_any_white +tcl/dyn -tgetent
-termresponse +textobjects +title +toolbar +user_commands +vertsplit
+virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu
+windows +writebackup -xfontset -xim -xterm_save +xpm_w32
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME_vimrc"
2nd user vimrc file: "$VIM_vimrc"
user exrc file: "$HOME_exrc"
2nd user exrc file: "$VIM_exrc"
system gvimrc file: "$VIM\gvimrc"
user gvimrc file: "$HOME_gvimrc"
2nd user gvimrc file: "$VIM_gvimrc"
system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_CSCOPE
-DFEAT_NETBEANS_INTG -DFEAT_XPM_W32 -DWINVER=0x0400 -D_WIN32_WINNT=0x0400
/Fo.\ObjGOLYHTR/ /Ox /GL -DNDEBUG /Zl /MT -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME
-DFEAT_GUI_W32 -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL
-DDYNAMIC_TCL_DLL="tcl83.dll" -DDYNAMIC_TCL_VER="8.3" -DFEAT_PYTHON -DDYNAMIC_PYTHON
-DDYNAMIC_PYTHON_DLL="python27.dll" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3
-DDYNAMIC_PYTHON3_DLL="python31.dll" -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL="perl51
2.dll" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=191 -DDYNAMIC_RUBY_DLL="msvcrt-ruby191
.dll" -DFEAT_BIG /Fd.\ObjGOLYHTR/ /Zi
Linking: link /RELEASE /nologo /subsystem:windows /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib
shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib /machine:i386 /nodefaultlib gdi32.lib version.lib winspool.lib
comctl32.lib advapi32.lib shell32.lib /machine:i386 /nodefaultlib libcmt.lib oleaut32.lib user32.lib
/nodefaultlib:python27.lib /nodefaultlib:python31.lib e:\tcl\lib\tclstub83.lib WSock32.lib e:\xpm\lib\libXpm.lib
/PDB:gvim.pdb -debug

would love to see this working on Windows

Allow user to define diff cmd args

It might be nice to pass args such as --ignore-space-change. I suppose this could either be raw args to pass on, or specific options that get interpreted into command line args to customize the behavior of the diff cmd.

Slow buffer switch

Hi,

This plugin is awesome, thanks for making it!

Unfortunately it appears that it checks the git status every time the user changes buffer. For this reason changing splits is noticeably slowed down. I see the following alternatives solutions for this issue:

  1. load the diff only when a file is opened or saved
  2. load the diff asynchronously
  3. load the diff only when then file is saved
  4. cache the diff for each buffer

I'm not proficient with VimL so takes my suggestions with a grain of salt. I personally think that 1 or 2 (or a combination of both) would be ideal.

Disable on startup

Hi, great plugin!

I'd like to start Vim with Git Gutter disabled (and enable it by toggling it on). I add the following to my ~/.vimrc:

let s:gitgutter_enabled = 0

I start Vim, no errors. I toggle Git Gutter, and here's the error:

:call ToggleGitGutter()
Error detected while processing function ToggleGitGutter..DisableGitGutter..<SNR>28_clear_signs:                                                                                                                                              
line    1:                                                                                                                                                                                                                                    
E121: Undefined variable: s:sign_ids
E116: Invalid arguments for function has_key(s:sign_ids, a:file_name)
E15: Invalid expression: has_key(s:sign_ids, a:file_name)

Thoughts?

Customize sign characters

It would be nice to have an option to customize the signs.

I've found the signs for deleted lines on https://github.com/akiomik/git-gutter-vim more appropriate, but vim-gitgutter has nicer features. :)

The current delete sign makes me think that the modification is in a different line, git-gutter-vim solves this by marking one line before and after the deletion.

I think the sign definition is here:
https://github.com/akiomik/git-gutter-vim/blob/master/autoload/gitgutter.vim#L36

Display change sign on new line

$mkdir gitgutter-test
$cd gitgutter-test
$git init
$cat test.txt
this is
a
test
file

then modify test.txt with:

  1. change line2 a to b
  2. add new empty line to b

then it display ~ on new empty line.
QQ 20130304151449

Toggle update signs across all buffers on FocusGained.

With a number of buffers open (7) even in a moderate sized git repository (1000 commits) on a relatively fast system (SSD), vim has a noticeable pause (15 seconds) while all the buffers get updated when clicking on gvim.

Is it possible to make update across all buffers on focus a configurable option?

Add way to revert current line/hunk to HEAD

It would be very nice if there was 'u' like functionality in vim-gitgutter that would revert the current line and/or the current hunk back to HEAD, essentially undoing the working change for that hunk/line.

Integration with Syntastic

I'm testing this plugin and I think it's awesome!

Years ago I used to use Netbeans and it shows this kind of diff. I've tested some options for vim, but not sucessfully... And this one just works, congratulations!

But I'm also using https://github.com/scrooloose/syntastic and vim-gitgutter overwrites syntastic signs.

gitgutter disappears when quickfix window is open, with python-mode plugin

Hello, using python-mode plugin https://github.com/klen/python-mode if you have the quick fix window open, the gitgutter will disappear. If you reload the file it will be back, until you save (which refreshes the quickfix window).

Doing a :GitGutterToggle during this does nothing, and doing a :GitGutterEnable, gives:

Quickfix
Error detected while processing function GitGutterEnable:
line 2:
E119: Not enough arguments for function: GitGutter

Undefined s:sign_ids variable.

Hi.

I have problem. I have up-to-date version from git. After ToggleGitGutter i'm getting:

An error was detected while processing function ToggleGitGutter..DisableGitGutter..<
SNR>12_clear_signs:
line    1:
E121: Undefined variable: s:sign_ids
E116: Too many arguments for function has_key(s:sign_ids, a:file_name)
E15: Improper expression: has_key(s:sign_ids, a:file_name)

Ofcourse i run toggle after EnableGitGutter. I have git version 1.7.10.4, pathogen version Version: 2.2

specify in README that it requires +signs support

Might be obvious, but it would be helpful to note in the README that the plugin will not work without +signs support (i.e. the vim distro on most if not all versions of OSX), with a suggestion to install MacVim.

don't use index

Hi,

I personally never use the git index, instead I use a tool to bypass the index when doing diffs etc.
As such I was a bit surprised when gitgutter showed me less changes than I made to the file. Turns out that the file got added to the index so half my changes became invisible to gitgutter.

I fixed this locally with the following change;
hunk plugin/gitgutter.vim 197

  • let cmd = 'git diff --no-ext-diff --no-color -U0 ' . g:gitgutter_diff_args . ' ' .
  • let cmd = 'git diff-index -M HEAD --no-ext-diff --no-color -U0 ' . g:gitgutter_diff_args . ' ' .

Maybe you want to apply this patch and make sure that other people don't get surprised like me :)

signs column always there

Hey guys, just installed this after seeing a friend use it. It seems to work ok except for the fact that the signs column is always there from the moment I open file. If I alter and save the file it displays the additions and what not just fine, but even when there are no changes, it always shows the signs bar.

Why have the bar show up if there is nothing to display?

Infinite spawning of vimruner and git on Windows

When opening a file and gaining focus to the gVim window, it starts to loop spawn vimruner.exe and git.exe processes.
Also the task manager shows a large number of corresponding conhost.exe processes.

Configuration:

  • Windows 7 x64 SP1
  • GVim 7.3-p744
  • Git-1.8.1.2-preview20130201
  • Pathogen (master)
  • Fugitive (master)

Error thrown when saving to a network path on Windows

Following error is thrown when you open/save a file on a network path on Windows 7 64-bit:

Error detected while processing function GitGutter..<SNR>60_is_active..<SNR>60_is_in_a_git_repo:
line 2:
E484: Can't open file C:\Users\ljani\AppData\Local\Temp\VIoEE6D.tmp

Steps to reproduce:

  1. Navigate to \localhost\c$ or \othercomputer\somefolder\
  2. Create file test.txt
  3. The error is first displayed when you open the file
  4. Do :w and the error is shown again

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.