Live data from Hacker News

Vim Git Gutter

github.com

111–119 of 119 posts

Re: Vim Git Gutter

#111

An aside question; what's the deal with "pathogen"? I've been using the "/bin/cp" command for years installing vim plugins and it's worked remarkably well; requiring just about 1 invocation on average... What problem does that thing solve?

I have 5 separate computers that I run vim on. Manually installing and updating is a huge pain. I keep my .vimrc in git to keep them all synchronized.

Why git? I store my .vim directory in dropbox and just have it symlinked into my home directory on each of my machines. I don't really see a need for version control, and I don't want to have to do anything to make sure a change on one machine is reflected on all the others.

Re: Vim Git Gutter

#112
post #90

I'm really impressed with this -- I would love to see this see functionality for other VCSes (subversion, etc) so that I could use it with my non-git projects. The vimscript looks pretty clean -- maybe I have a new weekend project ahead of me. edit: just a quick hack for a "vim svn gutter": https://github.com/prg318/vim-gitgutter The code is really clean and it would be fairly trivial to adopt this for use with any o…

svndiff ( http://www.vim.org/scripts/script.php?script_id=1881 ) works with SVN, Git and others. Both sign-diff ( http://www.vim.org/scripts/script.php?script_id=2712 ) and changesPlugin ( http://www.vim.org/scripts/script.php?script_id=3052 ) are VCS-agnostic: they show differences between the saved state and the current state.

Thank you! I wasn't aware that these plugins existed already. While I was getting excited to get my "vim -D" on to get the script in the OP to work with svn, I might just work one of these plugins into my workflow.

Thanks!

Re: Vim Git Gutter

#113
This works really quite well - great work, airblade! For reference, this is what I placed in my vimrc to get things how I like them:

  highlight clear signcolumn
  let g:gitgutter_enabled = 0
  nmap gu :GitGutterToggle

I prefer my buffers to start with it disabled by default and toggle as needed.

Re: Vim Git Gutter

#114

Is there any way to make it so that the gutter is always present? There's a bit of a noticeable jump to include it when I save a file, it's sort of annoying me. I tried let g:gitgutter_enabled = 1 but that does seem to work. I'll have a poke through the source.

I wish it could be made to stand on the right side of a vim buffer. This way it would still be present on demand but would not shift the whole buffer one column to the right.

Re: Vim Git Gutter

#115
post #98

Earlier quoted context omitted.

Alternatively, using `hi! link SignColumn LineNr` will ensure that styling the user has applied to the more commonly used line numbering column will match the sign column used by vim-gitgutter.

I hate it when plugins try to override my colorscheme, so I would highly discourage adding this to the plugin. To account for colorschemes that don't add colors for SignColumn without angering users, use the `default` keyword without the bang. Some other things to consider: The sign column and line numbers are separated by the fold column. The default colorscheme has SignColumn and FoldColumn the same (Cyan or DarkBl…

Sorry, I was mistaken--the sign column is placed between the fold column and the line numbers.

Re: Vim Git Gutter

#116
post #24

Seems to add noticeable latency (1+ seconds) to my save, each time. Vim is unresponsive during this time Is this expected? I save quite frequently, it's an unconscious reflex at this point.

Yes, the plugin runs the diff command when a document is saved/loaded. See the discussion here: http://news.ycombinator.com/item?id=5326654

Figured as much. I would argue for/request forking that "git diff" command and only processing its output in the VIM process, but for the moment I'll stick with my trusty ",gd" command:

  map gd :!cd %:p:h && GIT_PAGER='' git diff HEAD -- %:t

Re: Vim Git Gutter

#117
post #56
post #44

Eclipse pretty much does this out of the box. I guess so do IntelliJ and Visual Studio. You can also display the name of the last person to change a line in the same position (ie. svn/git blame), which is very useful to quickly find out who to talk to regarding a section of a file. The commit message is displayed on mouseover.

Also gotta love the ability to open commits in Github in IntelliJ and the other JetBrains IDE's. Great for sending a link to a line of code.

vim Fugitive does this as well. `:GBrowse` will open the current file on GitHub, with an optional line range.

Re: Vim Git Gutter

#118
post #112

Earlier quoted context omitted.

svndiff ( http://www.vim.org/scripts/script.php?script_id=1881 ) works with SVN, Git and others. Both sign-diff ( http://www.vim.org/scripts/script.php?script_id=2712 ) and changesPlugin ( http://www.vim.org/scripts/script.php?script_id=3052 ) are VCS-agnostic: they show differences between the saved state and the current state.

Thank you! I wasn't aware that these plugins existed already. While I was getting excited to get my "vim -D" on to get the script in the OP to work with svn, I might just work one of these plugins into my workflow. Thanks!

Here is an idea to keep your forking mojo going: "improve" the looks of svndiff to match the looks of git-gutter.
Post reply on HN