【问题标题】:How do I change the default save location in Vim?如何更改 Vim 中的默认保存位置?
【发布时间】:2014-01-02 16:49:26
【问题描述】:

目前是C:\Windows\System32,这是非常不切实际的。我知道您可以使用:cd [directory] 更改当前目录,但是有什么方法可以更改新文件的默认保存位置而无需一直更改目录?

【问题讨论】:

  • 可以设置TEMPDIRTMPDIR,或者切换到Linux!
  • 最后一个选项永远是对的。 @BasileStarynkevitch

标签: windows vim directory


【解决方案1】:

我不在 Windows,所以我找不到确切的菜单名称等,但如果我没记错的话,最简单的方法是:

  1. 找到您的 gVim 应用程序
  2. 右键点击
  3. 选择Properties
  4. 在其中一个选项卡中更改启动位置。通常设置它的位置是您的主目录。

【讨论】:

  • 实际上最新版本的 Vim 安装程序(截至 7.4.077)将创建 Vim 快捷方式以指向用户目录作为启动目录,而不是不可写的位置。因此,这被确认为安装程序的问题并已修复。
  • 我不认为他暗示他在使用 gVim。
【解决方案2】:

您可以使用 :cd 命令更改 Vim 的当前工作目录。 见

 :help :cd 

.

If you want Vim to always start in a particular directory, you can 
put the :cd command in your ~/_vimrc file.



If you want Vim to use 
the parent directory of the file you are editing as its current 
working directory, you can put this setting in your ~/_vimrc file:

.

 set autochdir 

:help 'autochdir' 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-16
    • 2017-04-24
    • 2014-12-18
    • 1970-01-01
    • 2015-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多