Windows 10 上的 Bash:.vimrc 在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42772115/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 15:52:54  来源:igfitidea点击:

Bash on Windows 10: where is .vimrc?

gitbashvimwindows-10windows-subsystem-for-linux

提问by JTW

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.

在 Windows 上使用 Bash 时 .vimrc 在哪里?我正在尝试添加设置以使 Windows 上的 Bash 适合 vim 使用,并允许使用自定义设置执行 git diff/merge 等,即忽略空格。

回答by edi

Use vim --version | grep vimrcto find it.

使用vim --version | grep vimrc找到它。

For me its

对我来说

  • System wide file: "/etc/vimrc"
  • User file: "$HOME/.vimrc"
  • Second user file: "~/.vim/vimrc"
  • 系统范围的文件:“/etc/vimrc”
  • 用户文件:"$HOME/.vimrc"
  • 第二个用户文件:"~/.vim/vimrc"

see stackoverflow link

stackoverflow链接

回答by Jim U

Edit your vimrc:

编辑你的 vimrc:

:e $MYVIMRC

Reload your vimrc after saving changes:

保存更改后重新加载 vimrc:

:source $MYVIMRC

OMG Shortcuts!

OMG 捷径!

use \ein normal mode whenever you want to edit your vimrc and \sto reload it

\e每当您想编辑 vimrc 并\s重新加载它时,请在正常模式下使用

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

reference: Learn Vimscript the Hard Way CH7

参考:学习 Vimscript 的艰难方式 CH7

回答by u7512030

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

只需输入 cd ~ 然后您将进入您的 HOME 目录,.vimrc 就在那里