Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash on Windows 10: where is .vimrc?

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.

like image 621
JTW Avatar asked Mar 13 '17 19:03

JTW


2 Answers

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

like image 50
edi Avatar answered Sep 27 '22 22:09

edi


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

  • Learn Vimscript the Hard Way CH7
like image 29
Jim U Avatar answered Sep 27 '22 23:09

Jim U