使Vim便携 [英] Making Vim portable

查看:211
本文介绍了使Vim便携的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习使用Vim,我想在USB上安装一个可移植的版本,以便在任何地方编辑我的代码.我知道有一个 Vim的便携式版本,但是当我搜索该版本时,我发现此处一条有趣的评论:

I am learning to use Vim and I want to have a portable version on my USB to edit my code here everywhere. I knew there are a portable version of Vim, but while i was searching for that version I found here an interesting comment:

我不建议使用便携式vim.它无需维护,只需在 vimrc中添加一些选项即可将vim移植起来.

I wouldn’t reccomend using portable vim. It is unmaintained, and vim can be made portable by just adding a few options in your vimrc.

我很感兴趣.我很高兴USB上有GVim的桌面版本,但未提及这些行.有人知道他在谈论哪些vimrc选项吗?

I got intrigued. I would be glad to have the desktop version of GVim in my USB, but those lines aren't mentioned. Someone knows which vimrc options he is talking about?

* PD:我不是英语母语人士,所以如果有一些书写错误,请随时告诉我:)

*PD: I'm not a native English speaker, so If there are some writing errors, don't hesitate to tell me please :)

推荐答案

似乎可以维护一些可移植的vim版本,但就我个人而言,我从未发现过对它们的特殊需求:标准的Vim对于我来说已经足够可移植了.需求.

There are portable versions of vim that seem to be maintained, but personally I've never found a particular need for them: the standard Vim is portable enough for my needs.

在USB记忆棒上创建目录(假设创建时为E:):

Create a directory on your USB stick (let's assume that it's E: when you're creating it):

E:\vim

添加两个文件夹:

E:\vim\vim73
E:\vim\vimfiles

C:\Program Files\vim\vim73的内容(或其安装位置)复制到E:\vim\vim73,并获取vim配置文件(如果有的话)并将其放入E:\vim\vimfiles.将您的vimrc复制到E:\vim\_vimrc.

Copy the contents of C:\Program Files\vim\vim73 (or wherever it's installed) into E:\vim\vim73 and take your vim configuration files (if you have any) and put them in E:\vim\vimfiles. Copy your vimrc to E:\vim\_vimrc.

现在将USB记忆棒放在另一台PC中(假设它将其安装为F:).打开Windows资源管理器,导航到F:\vim\vim73并双击gvim.exe.它将打开Vim GUI并加载您的配置.

Now put the USB stick in another PC (let's assume it mounts it as F:). Open Windows Explorer, navigate to F:\vim\vim73 and double click on gvim.exe. It will open the Vim GUI and load your configuration.

为使本地和便携式vim配置保持匹配,我建议将vimfiles目录置于版本控制下(还可以让您轻松尝试新插件,然后在不需要时还原"以摆脱它们.它们),然后在USB记忆棒上签出,在PC上签出另一个.如果将_vimrc移至vimfiles\vimrc并用以下内容替换_vimrc,它将使vimrc版本受所有插件和配置的控制:

To keep the local and portable vim configurations matching, I'd recommend sticking the vimfiles directory under version control (also allows you to easily try out new plugins and then 'revert' to get rid of them if you don't want them) and having a checkout on the USB stick and another one on the PC. If you move your _vimrc to vimfiles\vimrc and replace your _vimrc with the following, it will keep vimrc version controlled with all the plugins and configuration:

" _vimrc - Links to the vimrc in the vimfiles directory
runtime vimrc

如果有的话,也可以对_gvimrc做同样的事情.

You can do the same with _gvimrc if you have one.

这篇关于使Vim便携的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆