Vim settings file on Windows

后端 未结 3 441
一向
一向 2021-01-31 02:45

I can\'t believe I am typing a question for a simple thing like this but here we are. I can\'t for the life of me figure out what the exact name for the settings file is for vim

相关标签:
3条回答
  • 2021-01-31 03:26

    On Windows systems, the best way to find the value of $HOME is from within Vim, as follows. These commands are useful to see what directories your Vim is using:

    :version
    :echo expand('~')
    :echo $HOME
    :echo $VIM
    :echo $VIMRUNTIME
    

    Note the system vimrc file and user vimrc file paths displayed by the :version command. The system vimrc file can be created by an administrator to customize Vim for all users. In addition, each user can have his or her own user vimrc.

    0 讨论(0)
  • 2021-01-31 03:38

    Why not just edit the vimrc file in vim itself and figure it out its name?. Using the following command.

    :e $MYVIMRC
    

    As ghiscoding mentions in a comment, you may need to run Vim as an administrator to be able to save your changes.

    0 讨论(0)
  • 2021-01-31 03:40

    my _vimrc/_gvimrc is stored at C:/Users/<ME>/_vimrc and is working fine.

    It's generally a good idea to keep personal settings separate from installation files.

    To get more information about the search paths for your configuration files, type :he vimrc-intro.

    And be careful: the docs say

    For MS-DOS and MS-Windows you can use one of these:
    $HOME/_vimrc
    $VIM/_vimrc

    While this is absolutely true, it could be a bit surprising that $VIM does not expand to e.g. C:/Program Files/vim/<your_version> (this is what $VIMRUNTIME holds) but only to C:/Program Files/vim/.

    This said, C:/Program Files/vim/_vimrc should be read during startup.

    0 讨论(0)
提交回复
热议问题