Hot answers tagged

7

You can do this with the vim-gitgutter plugin. If you're not using git, then Signify has a similar feature. After installing vim-gitgutter, you can switch the highlighting on and off with the following commands: turn on with :GitGutterLineHighlightsEnable turn off with :GitGutterLineHighlightsDisable toggle with :GitGutterLineHighlightsToggle. Or, to ...


5

Here are two related approaches. Both use git-* scripts; if you put them on your PATH, you can invoke them as if they were subcommands of git. Use the contrib script git-jump The git-jump script provides a handy way to load diff hunks, grep results, or whitespace errors into an editor that supports quickfix formats. Since git jump diff forwards its ...


4

fugitive.vim now allows for staging a selection of a hunk with visual mode. Open the git summary with :Git (or :G) Expand the file which contains the lines you want to stage with > (or = to toggle). This will only show the changed hunks plus some extra lines of context above and below the changed lines. v to start visual mode and select the lines you ...


2

Plugin Fugitive v3.2 (Jan 2020) vim-fugitive has added new commands sine the OP raised this question which can do exactly what the OP has asked. Now you can call :Git difftool or the abbreviated version :G difft[tab complete] This loads all changesets into the quickfix list. If files have several changes, they occur several times in the quickfix list. ...


2

The easiest way would be to call git inside %{} like so: let &statusline = '%{substitute(system("git status -s"), "\n", " ", "g")}' Anything inside %{} get evaluated as an expression, and here we call git status -s with system() and replace newlines with a space, resulting in a statusline like: ## repl M db.go ?? ...


1

I think you are looking for :h :diffoff which removes diff options of the two buffers of a two-way diff. This is mapped to dq in Fugitive. You can go back to diff mode with Fugitive's Gdiffsplit. Besides, the default for Enter and o in Fugitive's status window is to open the current version of the file, while dd is supposed to show the two-way diff. I think ...


1

How about git-blame which puts the message in the status line?


1

Required background Vim's runtimepath and directories The runtimepath (:help 'runtimepath') is a list of directories searched for runtime files, such as documentation under doc, colorschemes under colors, and more. The runtimepath virtually always includes ~/.vim (for user settings), the vim runtime (shipped with vim), and ~/.vim/after (for overriding or ...


1

Vim currently supports assigning sign priorities (https://vimhelp.org/sign.txt.html#sign-priority). The plugins placing the signs need to use the newer sign APIs.


1

I found a solution. Put set autochdir in your .vimrc. vim-fugitive can't know where the repo of the current file is if it is outside of the .git folder.


Only top voted, non community-wiki answers of a minimum length are eligible