我如何“来源" .vimrc文件中的某些内容? [英] How do I "source" something in my .vimrc file?

查看:206
本文介绍了我如何“来源" .vimrc文件中的某些内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在扩展我的vim-foo,并且遇到了几个插件(

I've been working on expanding my vim-foo lately and I've run across a couple of plugins (autotag.vim for example) that require them to be "sourced" in my .vimrc file. What exactly does this mean and how do I do it?

推荐答案

为文件提供源正在执行"该文件.本质上,文件的每一行都被视为命令.其来源与按顺序键入每个命令的方式相同.您可以使用命令:source(通常缩写为:so)来获取源代码.

Sourcing a file is 'executing' it. Essentially, each line of the file is considered a command. Sourcing it is the same as typing each command in order. You source with the command :source (usually shortened to :so).

因此,如果您获取myStuff.vim

:so myStuff.vim

,如果myStuff.vim包含这些行

set xx iI just intersted this<C-]>
set yy bbbb4dw

就像您在Vim中键入这些命令一样

It's the same as if you typed those commands into Vim

:set xx iI just intersted this<C-]>
:set yy bbbb4dw

默认情况下,唯一来源的文件是.vimrc(在Windows中为_vimrc),因此您可以在此处保留每次用来设置Vim的所有命令.

The only file sourced by default is the .vimrc(_vimrc on windows) so that's a place you can keep all the commands you use to set up Vim every time.

有趣的是,由于源文件只是一系列命令,而采购是命令,因此您可以从源文件中获取文件.因此,您每次使用的插件都可以在启动Vim时获得,方法是在.vimrc中添加一行这样的

Where it gets interesting is the fact that since a sourced file is just a series of commands, and sourcing is a command, you can source files from your source files. So plugins you use every time could be sourced when you start up Vim by adding a line to your .vimrc like this

 so myPlugin.vim

这篇关于我如何“来源" .vimrc文件中的某些内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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