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
0answers
30 views

NERDTree hide files in the .gitignore file

I am using vim (exact details at the bottom of the text) with NERDTree and nerdtree-git-plugin plugins. I don't want NERDTree to show files mentioned in the .gitignore file. I couldn't find any ...
3
votes
2answers
144 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 ...
1
vote
2answers
100 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 ...
0
votes
1answer
42 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 ...
2
votes
0answers
82 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 ...
1
vote
1answer
34 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 ...
1
vote
1answer
53 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 ...
1
vote
1answer
82 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 ...
0
votes
1answer
277 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 ...
2
votes
1answer
2k 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 ...
0
votes
1answer
197 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 ...
1
vote
1answer
209 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 ...
1
vote
1answer
238 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 ...
2
votes
1answer
212 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 ...
5
votes
1answer
692 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 ...
0
votes
2answers
123 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 ...
1
vote
1answer
72 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 ...
7
votes
2answers
913 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 ...
0
votes
2answers
352 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....
2
votes
2answers
2k 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 ...
3
votes
1answer
212 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! ...
0
votes
0answers
93 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 ...
0
votes
1answer
169 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' | \ ...
1
vote
1answer
1k 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) ...
1
vote
0answers
53 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 >>>>>...
0
votes
0answers
2k 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. ...
2
votes
1answer
154 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 ...
2
votes
1answer
100 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 ...
1
vote
1answer
579 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 ...
2
votes
1answer
127 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"...
1
vote
1answer
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 ...
1
vote
1answer
232 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 ...
2
votes
0answers
480 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 ...
1
vote
1answer
171 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 ...
1
vote
1answer
869 views

How to use pure Vim as git mergetool?

Whenever there are some git merge conflicts we would type git mergetool and git would automatically launch a merge tool for us to merge the conflicts. I have been using vimdiff for a long time as my ...
2
votes
1answer
1k views

Why "there was a problem with vi" when saving a git commit message with :wq after accidental :Wq?

When I have typed a commit message with vim and, in haste, typed :Wq instead of :wq I get an error: E492: Not an editor command: Wq from which I can (falsly?) recover, meaning the editor seems to ...
0
votes
1answer
369 views

How to compile vim for user only and use git to track it?

How can I compile vim for my user only so set source path to /home/user/ ? And how can I track changes with git. Basically I want to build and compile vim from source, and store it on my github repo....
1
vote
1answer
526 views

How to customize the color of an HTML output file generated from Git Bash?

I have used the following command in Git Bash to perform a 'vimdiff' for 2 XML files. vimdiff xml1.xml xml2.xml -c TOhtml -c 'w! result.html' -c 'qa!' The HTML file which is getting generated is ...
0
votes
1answer
1k views

Create a specific .vimrc for git commits usage?

There is probably an easy solution for this, but here it goes : whenever I do a git commit, an error appears (copied hereunder). Vim then starts, some of my .vimrc features are enabled, some are not. ...
1
vote
2answers
148 views

Commiting pathogen bundles?

Right now I am using Pathogen to manage bundles in my ~/.vim folder. I also have my public dotfiles repo which has all my configs, including my entire .vim folder. I don't use symlinks to do this, ...
10
votes
6answers
2k views

How to load list of files in commit into quickfix

Using git how can I load the list of files in the current commit into Quickfix window? Code Review didn't pass and I want to just fix them one by one.
0
votes
0answers
123 views

How fugitive-specific is the 'git' filetype?

When you run fugitive's :Gblame, it opens a buffer whose 'filetype' is fugitiveblame. You can hit q to close its window. You can also hit o to view the commit for the line your cursor is on in a ...
4
votes
1answer
3k views

Populate a git-commit-template with variables

I've followed this tutorial to set up a nice git-commit-template and use it with Vim. I would like to put this one step further and make possible to have in my template a preconfigured variable with ...
1
vote
1answer
156 views

Good approach for running basic git commits? [closed]

I've played with git in the past and I know it's good practice but I never used it because it was just too much of a hassle for my little pet, hobbyist projects. I'm looking to get back into git and ...
25
votes
5answers
9k views

Git Fugitive how to git add a visually selected chunk of code

I would like to know if i could select some code in visual mode and git add it ? I checked with fugitive.vim but i didn't find how to do it. Is it possible ? Or is there any other plugin to do it ?
7
votes
1answer
314 views

Open git tracked files inside editor

I'm trying to make a Vim command which opens all modified files tracked by Git. The following command works if there is only one modified file (and fails if the current working directory is not a git ...
4
votes
1answer
132 views

Who manages the vim-scripts project on Github, and how is it used?

I'm referring to this. Are there package managers that pull scripts from it by name? I ask because I notice that the version of my plugin contained in it is extremely old, and I'm wondering whether I ...
5
votes
2answers
305 views

Turn Vim's multiple undo history into git commits?

When refactoring I sometimes do too much at once—all little steps, but I forget to commit after each little change. Of course in many cases a commit after each change would be too much, but if each ...
1
vote
1answer
104 views

Git submodules for syntax files

I keep my VIM folder under git version control. I use git submodules and Pathogen to keep my VIM plugins updated. The folder structure is .vim/bundle/$PLUGIN Is it possible to use git submodules for ...
4
votes
1answer
5k views

Using vim diff to compare the working directory to the HEAD in git?

Is it possible to use vim diff to open and compare all the differences between HEAD and the files in the working directory?