Bash on Windows 10: where is .vimrc?

23,333

Solution 1

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

Solution 2

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

Solution 3

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

Share:
23,333
JTW
Author by

JTW

Full stack software developer with nearly a decade of experience in C#, ASP.NET MVC/Web API, web stack (HTML/CSS/JavaScript), SQL, NoSQL, Python, NodeJS, Azure and AWS.

Updated on July 15, 2020

Comments

  • JTW
    JTW almost 4 years

    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
    JTW about 7 years
    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!
  • christianbueno.1
    christianbueno.1 over 4 years
    if you use gitBash on windows-10, vimrc will be in C:\Program Files\Git\etc