Bash on Windows 10: where is .vimrc?
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"
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
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, 2020Comments
-
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 about 7 yearsExcellent, 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 over 4 yearsif you use gitBash on windows-10, vimrc will be in
C:\Program Files\Git\etc