我的.vimrc文件在哪里?

本文翻译自:Where is my .vimrc file?

I have been using Vim , and I would really like to save my settings. 我一直在使用Vim ,我真的很想保存我的设置。 The problem I am having is that I cannot find my .vimrc file, and it is not in the standard /home/user/.vimrc location. 我遇到的问题是我找不到我的.vimrc文件,并且它不在标准的/home/user/.vimrc位置。 How might I find this file? 我如何找到该文件?


#1楼

参考:https://stackoom.com/question/jpAH/我的-vimrc文件在哪里


#2楼

You need to create it. 您需要创建它。 In most installations I've used it hasn't been created by default. 在大多数安装中,我使用过的不是默认情况下创建的。

You usually create it as ~/.vimrc . 您通常将其创建为~/.vimrc


#3楼

:scriptnames list all the .vim files that Vim loaded for you, including your .vimrc file. :scriptnames列出Vim为您加载的所有.vim文件,包括您的.vimrc文件。

:e $MYVIMRC open & edit the current .vimrc that you are using, then use Ctrl + G to view the path in status bar. :e $MYVIMRC打开和编辑您正在使用,然后使用Ctrl + G以查看状态栏中的路径当前的.vimrc。


#4楼

Here are a few more tips: 这里有一些提示:

  • In Arch Linux the global one is at /etc/vimrc . Arch Linux中 ,全局目录位于/etc/vimrc There are some comments in there with helpful details. 那里有一些注释,其中包含有用的详细信息。

  • Since the filename starts with a . 由于文件名以开头. , it's hidden unless you use ls -a to show ALL files. ,除非您使用ls -a显示所有文件,否则它是隐藏的。

  • Typing :version while in Vim will show you a bunch of interesting information including the file location. 在Vim中输入:version会显示很多有趣的信息,包括文件位置。

  • If you're not sure what ~/.vimrc means look at this question . 如果您不确定~/.vimrc是什么意思,请查看此问题


#5楼

:echo($MYVIMRC)

will give you the location of your .vimrc file. 将为您提供.vimrc文件的位置。

:e $MYVIMRC

will open it. 将其打开。


#6楼

作为附加信息,主要在macOS中,.vimrc文件位于目录中:

/usr/share/vim/.vimrc
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值