让Vim在Windows下与Go一起工作

huangapple go评论83阅读模式
英文:

Getting Vim to work with Go under Windows

问题

如何配置在Windows下运行的Vim以便能够编辑Golang代码?我已经花了3个小时在这个主题上搜索不完整、自我引用的指南,结果让我感到沮丧。

好的,更多细节。我已经安装了Vim。文件夹结构如下:

Program Files (x86) -> Vim 
                           vim80
                               autoload
                               colors
                               ...
                           vimfiles

我困惑的一个例子是vim-plug的安装指南,在关于Powershell的部分,只是简单地说要执行以下命令:

md ~\vimfiles\autoload

这些文件夹相对于什么位置呢?我已经有一个现有的autoload文件夹,但它在vim80文件夹下面,所以我感到困惑。前面提到的文件夹结构是Vim安装程序创建的默认结构。

英文:

How do I configure Vim running under Windows to be able to edit Golang code? I have spent 3 hours trawling through incomplete, self referential guides on this subject and I grow weary with the resultant frustration.

Ok more details. I have Vim installed. The folder structure is:

Program Files (x86) -> Vim 
                           vim80
                               autoload
                               colors
                               ...
                           vimfiles

An example of my confusion is the fact that the installation guide to vim-plug, in the sections about Powershell, simply says to issue the line:

md ~\vimfiles\autoload

What are these folders relative to?
I have an existing autoload folder but it is under the vim80 folder, hence my confusion. The aforementioned folder structure is the default one created by the Vim installer.

答案1

得分: 1

在PowerShell中,~表示$HOME,默认情况下表示%USERPROFILE%

因此,~\vimfiles\autoload是由vim80/autoload使用的用户设置。

英文:

The ~ in powershell refers to $HOME wnich by default means %USERPROFILE%

So ~\vimfiles\autoload are user settings used by vim80/autoload.

答案2

得分: 0

以下是翻译好的内容:

~字符是由VonC所说的用户配置文件。

因此,您可以在用户目录下创建vimfiles文件夹:
C:\Users\username\vimfiles

这些文件夹将在vim安装位置Program files(x86)\Vim\vim80下的核心文件之后加载,但两个文件夹具有类似的目的。
如果多个用户在使用相同的vim安装,但具有不同的插件和不同的vimrc文件,建议使用用户目录。

请注意,这也适用于vimrc文件:
您可以将您的_vimrc.vimrc放置在C:\Users\username\中,vim会加载它。

英文:

The ~ characters is your Userprofile as said by VonC.

You can therefore create the vimfiles folder under your user directories:
C:\Users\username\vimfiles

These will be loaded after the core files under the vim installation location Program files(x86)\Vim\vim80 but both folders same a similar purpose.
Using the user directory is recommended if multiple users are using the same vim installation while having different plugins and a different vimrc.

Note that this also works with the vimrc file:
You can place your _vimrc or .vimrcin C:\Users\username\ and it will be loaded by vim.

huangapple
  • 本文由 发表于 2017年1月19日 06:23:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/41730544.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定