使 Vim 便携 [英] Making Vim portable

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

问题描述

我正在学习使用 Vim,我想在我的 USB 上有一个便携式版本,以便在任何地方编辑我的代码.我知道有一个 Vim 的便携式版本,但是在我搜索那个版本时我发现了 这里 一个有趣的评论:><块引用>

我不推荐使用便携式 vim.它无需维护,只需在您的 vimrc 中添加几个选项,即可使 vim 变得可移植.

我很感兴趣.我很高兴在我的 USB 中有桌面版的 GVim,但没有提到这些行.有人知道他说的是哪些 vimrc 选项吗?

*PD:我的母语不是英语,所以如果有一些写作错误,请不要犹豫告诉我 :)

解决方案

似乎维护了 vim 的可移植版本,但我个人从未发现对它们的特殊需求:标准 Vim 对我来说足够可移植需要.

在你的 U 盘上创建一个目录(假设你创建它时它是 E:):

E:vim

添加两个文件夹:

E:vimvim73E:vimvimfiles

C:Program Filesvimvim73(或它安装的任何地方)的内容复制到 E:vimvim73 并获取你的 vim 配置文件(如果你有的话) 并将它们放在 E:vimvimfiles 中.将你的 vimrc 复制到 E:vim\_vimrc.

现在将 U 盘放入另一台 PC(假设它以 F: 的形式安装它).打开 Windows 资源管理器,导航到 F:vimvim73 并双击 gvim.exe.它将打开 Vim GUI 并加载您的配置.

<小时>

为了保持本地和可移植 vim 配置匹配,我建议将 vimfiles 目录置于版本控制之下(还允许您轻松尝试新插件,然后如果您不想,则恢复"以摆脱它们它们)并在 U 盘上结账,在 PC 上结账.如果您将 _vimrc 移动到 vimfilesvimrc 并将 _vimrc 替换为以下内容,它将通过所有插件和配置保持 vimrc 版本控制:

" _vimrc - 链接到 vimfiles 目录中的 vimrc运行时 vimrc

如果你有 _gvimrc,你也可以这样做.

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:

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.

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: I'm not a native English speaker, so If there are some writing errors, don't hesitate to tell me please :)

解决方案

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.

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

E:vim

Add two folders:

E:vimvim73
E:vimvimfiles

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

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


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 vimfilesvimrc 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

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

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

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