10

Where is .vimrc located when using Bash on Windows? I'm trying to add settings to make Bash on Windows suitable for vim use and to allow performing git diff/merge, etc. with custom settings, i.e., ignore whitespace.

JTW
  • 3,546
  • 8
  • 35
  • 49

3 Answers3

27

Use vim --version | grep vimrc to find it.

For me its

  • System wide file: "/etc/vimrc"
  • User file: "$HOME/.vimrc"
  • Second user file: "~/.vim/vimrc"

see stackoverflow link

Community
  • 1
  • 1
edi
  • 917
  • 7
  • 17
  • Excellent, I didn't realize that the vim --version command provided so much additional info. One strange thing though: on my machine, there isn't actually a .vimrc file in those locations. I simply created one after navigating to the directory though, so all looks good now. Thanks! – JTW Mar 13 '17 at 19:54
  • 1
    if you use gitBash on windows-10, vimrc will be in `C:\Program Files\Git\etc` – christianbueno.1 Sep 05 '19 at 16:17
8

This will edit your vimrc in the current window

:e $MYVIMRC

This will reload your vimrc after you've saved your changes

:source $MYVIMRC

This will configure two shortcuts that edit and reload your vimrc

Pressing \e in normal mode will edit your vimrc in a split window. Pressing \s will reload vimrc to apply your changes

let mapleader="\\"
nnoremap <leader>e :vsplit $MYVIMRC<cr>
nnoremap <leader>s :source $MYVIMRC<cr>

Reference

Jim U
  • 3,318
  • 1
  • 14
  • 24
1

just type cd ~ and then you will enter your HOME directary ,and .vimrc is there