Questions tagged [git]

Questions about the integration of the Git revision control system in Vim or about the synchronisation of Vim files via Git repositories.

Filter by
Sorted by
Tagged with
0 votes
1 answer
272 views

Use LspConfig root_dir in Neogit cwd

I'm trying to setup Neogit to open in my workspace directory instead of cwd. The problem is that I use multi root workspaces, so I usually set my cwd to be workspace1/... My initial try was to use ...
Gustaw's user avatar
  • 1
0 votes
0 answers
117 views

fzf.vim - How to search git branch command with git log preview?

I'm trying to create neovim fzf command FzfGBranches to use git branch -a as query, and use git log --oneline as fzf preview: command! -bang -nargs=0 FzfGBranches \ call fzf#vim#grep( ...
linrongbin's user avatar
0 votes
1 answer
129 views

How to configure git config to use MacVim and zsh to use Vim bundled in MacVim?

The following is an excerpt of my .gitconfig [core] editor = mvim autocrlf = false pager = less -FX commentchar = "#" [diff] tool = vimdiff guitool = vimdiff [merge] ...
Barzi2001's user avatar
  • 528
2 votes
1 answer
432 views

Show git branch icon in lightline

Here is my code from .vimrc but is not showing any icon near the branch name I'm using Plug 'itchyny/lightline.vim' " Lightline UI Plug 'tpope/vim-fugitive' " Git wrapper for Vim Plug '...
Mafsi's user avatar
  • 225
0 votes
1 answer
111 views

Working with multiple git branches of Neovim config

I am working with multiple NVim configs through multiple git branches but it appears to be broken like it doesn't update the config after I switch branch and restart Neovim. Restarting my computer ...
samuelnihoul's user avatar
0 votes
1 answer
712 views

How to recover file changes discarded with fugitive_X in the fugitive summary buffer?

In the fugitive summary buffer, the powerful X command does as explained in :help fugitive_X: Discard the change under the cursor. This uses checkout or clean under the hood. A command is echoed ...
Paul Rougieux's user avatar
0 votes
1 answer
47 views

Automatically `git add` after conflicts are resolved in vim

Coming from Spacemacs, one of the things that I miss is that files are automatically git added after all conflicts are resolved. Wondering if there's a way to do that in vim.
Carl Dong's user avatar
1 vote
2 answers
779 views

No syntax highlighting in git commit with nvim

I have installed nvim using scoop on two Windows 11 systems. The installation works fine on my laptop (Surface Laptop 3). On my desktop, when I run git commit with nvim set as my editor, the terminal (...
Tom's user avatar
  • 111
2 votes
0 answers
255 views

vim-fugitive support for diff --color-words

I use vim and git primarily for editing prose documents in LaTeX or Markdown, not for coding. For this reason, my go-to git diff command is git wdiff, where the relevant part of .gitconfig reads ...
Alex Roberts's user avatar
4 votes
1 answer
374 views

git config does not set vimdiff layout properly

I'm trying to configure vimdiff as a git merge tool, so my global git config contains the following lines: [merge] tool = vimdiff conflictstyle = diff3 prompt = true [mergetool "...
gigoQ's user avatar
  • 43
3 votes
2 answers
229 views

visualize Vim undo history

Is there for Vim what Gource is for Git, to visualize Vim undo history? I'm familiar with Gundo, which display diffs of undo history, but it's not really a visualizer like Gource for Git repos.
Geremia's user avatar
  • 956
0 votes
1 answer
306 views

How to use Git submodules to install a plugin?

I just switched to Nvim from Vim, and came to this community. So, hello all! I'm doing very primitive config for Nvim and I'm trying to manage my plug-ins using git submodules. First of all, I'm ...
ttoh's user avatar
  • 11
1 vote
0 answers
110 views

Any vim plugins to integrate git status for each file in file window explorer?

is there any vim plugins could show git status for each file in file window explorer? Please notice that I am not asking integrate git status in statusline, but in file explorer like nerdtree/defx, ...
linrongbin's user avatar
2 votes
1 answer
349 views

How can I view a diff for a single file from a diff file with multiple files?

I have a diff file generated by git diff HEAD~2 > alldiff. Is it possible to view the diff for any one file using alldiff? For example, somecmd alldiff file1withchanges will use alldiff to show ...
Atul's user avatar
  • 21
0 votes
0 answers
662 views

Review two branches

description I like the fugitive :Git to review uncommitted code. I would like to do same between branches + uncommitted code. Basically to locally review MR or PR. From fugitive there are :Gclog and :...
mickro's user avatar
  • 101
0 votes
1 answer
178 views

Vim Inside Docker Container Doesn't Recognise Plugins via Vim 8's Own Plugin System

I'm trying to move my development environment into a Docker container to better manage my dependencies. Hence, I need Vim inside that container as well: git clone https://github.com/vim/vim.git &&...
Can Sürmeli's user avatar
3 votes
1 answer
936 views

GitLens-like issue linking in vim

In VSCode, GitLens allows you to hover over a line and get a link to the PR containing the most recent change for that line. Basically with a single click you can open up the PR which often contains ...
adamgy's user avatar
  • 93
3 votes
3 answers
895 views

Call plugin-defined function in .vimrc

I use tpope/vim-fugitive and airblade/vim-gitgutter and I want to selectively enable gitgutter only in git repositories. Since vim-fugitive provides FugitiveIsGitDir which returns 0 or 1, this could ...
Alexandru Dinu's user avatar
1 vote
2 answers
439 views

How can I detect if the vim I'm running on is the Git for Windows vim? [duplicate]

I have a shared .vimrc that I use across platforms. It works fine in most circumstances, but looks terrible when I run git commit from the command line. I want to make my color scheme not load when ...
Sean McMillan's user avatar
0 votes
2 answers
156 views

How to write a command that uses sends the output of an arbitrary git command to fzf?

I've been messing around a bit with fzf and I'd like to be able to run a command that does something like take the output of diff -w -M origin/main...HEAD --name-only and make the contents available ...
oalders's user avatar
  • 155
3 votes
2 answers
675 views

How to fuzzy search a git repository for content that once existed?

I love fzf.vim for file content searching within vim. But how could I use that to search for content that was once in a git repository's files? This stackoverflow question has basically two ...
TamaMcGlinn's user avatar
1 vote
1 answer
111 views

How to find files which contain given fragment?

FZF (fuzzy finder) is very convenient to find files by filename. However, I sometimes only know a function name or a part of the name. Is there a way to get FZF-like search, which would filter files ...
niekas's user avatar
  • 1,555
2 votes
1 answer
169 views

How to use different rules for highlighting trailing whitespace inside a gitcommit diff?

In my ~/.vimrc, I have: highlight TrailingWhitespace ctermbg=blue autocmd BufReadPost * syn match TrailingWhitespace /\s\+\%#\@<!$/ This highlights trailing spaces, except when I am still typing ...
Flux's user avatar
  • 1,031
3 votes
1 answer
619 views

Can vimdiff for git diffs be started in tab of current process?

Let's say I have a file buffer open and a :terminal split open in 1 tab page. I'd like to create a new tab where I run vimdiff but have my git diff showing. I'm trying to get git difftool HEAD~1 to ...
425nesp's user avatar
  • 576
0 votes
1 answer
1k views

Vim Fugitive not loading

I have recently been trying to separate my neovim config into multiple files. After moving everything involving vim-fugitive and vim-gitgutter into a separate file, git-gutter is not loading and I ...
destroyer449's user avatar
3 votes
1 answer
5k views

How to get Vim to show git status in the statusline?

I want to show the git status in the vim statusline, but I can't find any advice on how to do that. The output of git status -s would be fine, or alternatively a single field readout indicating ...
Philip's user avatar
  • 33
0 votes
1 answer
1k views

Fugitive: jump from diff to the current version

When exploring a commit using :Gedit HEAD, when I click o or Enter into the change, it shows me a vimdiff of the two file versions of the change. From there I often need to jump to the current version ...
Vicente Bolea's user avatar
2 votes
1 answer
791 views

GitGutter sign not working

I have airblade/vim-gitgutter installed via Vundle. Somehow even with minimal .vimrc vim-gitgutter signs aren't working. My minimal .vimrc is given below, is there any problem there? Any help will be ...
mahbubweb's user avatar
  • 602
2 votes
1 answer
2k views

Is there a Vim plugin similar to Git History Diff?

I like the extension Git History Diff in Visual Studio Code, looks something like this: I am looking for something similar for Vim. I've looked at Fugitive and other Vim plugins, but they are awkward ...
Fred's user avatar
  • 133
2 votes
1 answer
441 views

Edit in .vimrc but it's not updated in .git

So I was editing my ~/.vimrc file from the home directory and saved it, but when I went to check whether it had been updated in the vimrc file (for git) which is located at /.vim/vimrc, it did not ...
Tuan Duc Vu's user avatar
5 votes
1 answer
2k views

IDE-like inline diff highlighting in Vim

I enjoy using Vim and like it better than IDEs on most points. One common IDE feature that I miss, though, is inline diff highlighting: In this example changed lines are highlighted in blue and ...
August Janse's user avatar
0 votes
2 answers
202 views

don't capture stderr for git grep as grepprg

I'm trying to use git grep as my grepprg, but I keep getting spurious files such as ~/fatal: Not a git repository (or any of the parent directories): .git. Is there a way to configure vim to correctly ...
Greg Nisbet's user avatar
  • 1,839
1 vote
1 answer
403 views

Why is the commit message inside parentheses wrapped so strangely?

I sometimes need to do some remarks in parentheses in my commit message's detailed part. But when the parenthesized text comes to the rightmost column and is line-broken, the next line for some reason ...
Ruslan's user avatar
  • 475
10 votes
2 answers
2k views

How to break-up gutter fights?

There a number of types of plugins use the Vim gutter to display Git status, syntax correctness, linting and code formatting. But how can conflicts be managed when multiple plugins want to update the ...
Mark Stosberg's user avatar
0 votes
2 answers
707 views

Is it possible to use vim-fugitive outside of the repository (in local mounted directory)

I have a git repository: ~/home/foo/repo I mounted core to another directory: mount --bind ~/home/foo/repo ~/home/bar Now I want to edit my code with vim and use vim-fugitive. vim ~/home/bar/myCode....
Kfir's user avatar
  • 11
2 votes
2 answers
3k views

Review: git branch in statusline

Note: this is an educational exercise. For those wanting a ready-made solution, use vim-gitbranch. I am learning vimscript, and the code below is part of my .vimrc used to display the current git ...
Flux's user avatar
  • 1,031
3 votes
1 answer
315 views

shared vimrc on two machines; only run command for one of them

I use git to share my vimrc across multiple machines. But now I have some commands which I only want on one machine. Namely, this line: au! redhat BufReadPost (derived from this very helpful answer! ...
Simon Alford's user avatar
1 vote
0 answers
173 views

Vim "Follows" Hard links

I have a git repository that contains my vimrc file and a couple of other utilities, called myvimrcgit. I then hard link my vimrc to ~/.vimrc, so that they point to the same inodes. Now, when I go to ...
SalmonKiller's user avatar
1 vote
1 answer
291 views

Always move cursor to top of gitcommit buffer

I have the following autocmd in my vimrc. augroup line_return au! au BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ execute 'normal! g`"zvzz' | \ ...
Jezen Thomas's user avatar
1 vote
1 answer
2k views

`vimdiff` nor `nvim -d` are working as an external diff tool for git

First line says output is not a terminal. The rest of the output looks like term codes aren't being processed. I use st, with $TERM = st-256color. I just tried it on termite ($TERM = xterm-termite) ...
Pie's user avatar
  • 175
1 vote
0 answers
54 views

Folding for git merge candidates is (at least to me) backwards

When viewing a merge candidate created by git you will have something like . . . Some stuff not in conflict <<<<<< HEAD Some stuff ====== Something different >>>>>...
Nero gris's user avatar
  • 161
0 votes
1 answer
3k views

Vim Airline no GitBranch name [doing echo fugitive#head() shows correct branch]

I have Fugitive vim and Airline vim installed via Vundle. I installed them as follow: Plugin 'https://github.com/tpope/vim-fugitive.git' Plugin 'vim-airline/vim-airline' Airline status works fine. ...
mle0312's user avatar
  • 341
2 votes
1 answer
245 views

Retrieving failed fugitive commit message

I PGP sign my commit messages, and every once in a while GPG will fail for whatever reason (invalid cache, incorrect pin, etc), and my fugitive buffer will close, loosing all my changes. It doesn't ...
bronzehedwick's user avatar
2 votes
1 answer
145 views

file name completion in .gitignore

I often "unignore" files in .gitignore, like this: * !.gitignore !file.txt !dir !dir/* Can I modify the pattern for which insert mode file name completion would work? In this case, instead of ./ I'd ...
Bart's user avatar
  • 305
1 vote
1 answer
765 views

diffpatch using the output of git diff directly

I guess many of you are like me, and even if they have been using ViM for years, still learn new features regularly. The last that I learned was :diffp[atch] patch/name Now, I want to combine it ...
clem steredenn's user avatar
2 votes
1 answer
211 views

How to load commits in a certain date range with fugitive?

I am able to do git log --pretty=format:"%h" --after="2018-06-7" --until="2018-06-10", in the shell, but if I try to do it in vim with fugitive like this: :Glog --after="2018-6-7" --until="2018-06-10"...
Anton Daneyko's user avatar
1 vote
1 answer
2k views

Visualize git commit diff similarly to mergetool

I've been thinking of ways to visualize git commits with vim. I would like to be able to: run a command from the terminal such as: vimdiff -c <commit id>. vim opens with two windows on a ...
Funkatic's user avatar
  • 113
1 vote
1 answer
278 views

Saving .swp/.un~ files to subdirectories

Is there any way to save these files to automatically created subdirs? Google gave me no answers. The reason is simple- I work on several computers which I keep synced via git, so having these files ...
Dude For realsies's user avatar
1 vote
0 answers
594 views

Why does Git think Vi quit in error?

Is there anything wrong with opening up a new vim tab (for scratch work) while authoring a git commit? Update: This Seems to Be a Quirk With Vi vs. Vim On further inspection prompted by @muru's ...
mxxk's user avatar
  • 227
1 vote
1 answer
251 views

Vim (Spacevim); :!git push == permission denied (publickey)

I have operating system: Windows 7. Git bash works fine for me, and it uses the public key id_rsa.pub. I can run git commands fine through window's command prompt as well - and it too uses the public ...
Vimler's user avatar
  • 11