vim - vim and git

git

gitignore

Vim creates temporary files throughout the project. One way to stop that is by using the following settings:

set nobackup       "no backup files
set nowritebackup  "only in case you don't want a backup file while editing
set noswapfile     "no swap files

Instead of changing Vim settings, just add the following lines to the project’s gitignore files

*~
*.swp
*.swo

If Vim does not recognize Git

Symptom : If there is an error when Vim is starting up due to the call plug#begin(), it indicates that Vim may not be recognizing Git appropriately. This might show up when using PlugInstall command or any other plugin manager.

Do you have git installed on your system? What does :echo executable(‘git’) say?

If it says 0, then add these to the vimrc file:

(for 32 bit machines)

if has('win32')
    let $PATH .= ';' . 'C:/Program Files (x86)/Git/bin'
endif

(for 64 bit machines)

if has('win64')
    let $PATH .= ';' . 'C:/Program Files/Git/bin/'
endif

If the plugin managing tools have trouble connecting to git when working in a corporate environment:

Unable to resolve unable to get local issuer certificate using git on Windows with self-signed certificate

Open Git Bash and run the command if you want to completely disable SSL verification.

git config --global http.sslVerify false

Note: This solution may open you to attacks like man-in-the-middle attacks. Therefore turn on verification again as soon as possible:

git config --global http.sslVerify true

Links to this note