Windows系统下Vim的vimrc配置文件存放位置查询
Hey there! Let's break down exactly where your Vim configuration file lives on Windows—this is a super common question, so you're not alone in hunting for it.
First off, a quick key note: On Windows, Vim uses _vimrc (with an underscore at the start) instead of the .vimrc you might see referenced for Linux/macOS. Windows hides files starting with dots by default, so the underscore version is designed to be easier to work with here.
Common Locations for _vimrc
User-specific configuration (most common)
This is the file you'll want to edit for your personal settings. It lives in your user profile folder. You can quickly navigate there by opening File Explorer and typing%USERPROFILE%into the address bar. Look for_vimrchere—if it doesn't exist, you can just create a new text file named_vimrc(make sure it's not_vimrc.txt; disable "Hide extensions for known file types" in File Explorer if needed).
Example path:C:\Users\YourUsername\_vimrcSystem-wide configuration
If you want settings that apply to all users on the PC, check Vim's installation directory. Depending on your system, this might be:C:\Program Files\Vim\_vimrc(64-bit Vim on 64-bit Windows)C:\Program Files (x86)\Vim\_vimrc(32-bit Vim on 64-bit Windows)
Keep in mind you'll need admin rights to edit this file.
Can't Find It? Let Vim Tell You!
Open Vim (either the terminal version or gVim) and run this command:
:echo $MYVIMRC
Hit enter, and Vim will print the exact path of the configuration file it's currently using. If it returns an empty line, that means you haven't created a _vimrc yet—just make one in your user profile folder as mentioned above.
Also, note that there's a _gvimrc file too, which is for gVim's GUI-specific settings, but _vimrc is loaded by both terminal Vim and gVim, so it's the main one you'll want to customize.
Happy vimming!
内容的提问来源于stack exchange,提问作者Naveen kumar Vunnam




