vim 中的 ':source file' 和 ':runtime file' 有什么区别? [英] What's the difference between ':source file' and ':runtime file' in vim?

查看:20
本文介绍了vim 中的 ':source file' 和 ':runtime file' 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在系统上的 /etc/vimrc 文件中看到了这个命令:

I saw this command in the /etc/vimrc file on my system:

runtime! vimrc_example.vim

来自文档:

:ru[ntime][!] {file} ..从每个目录中的 {file} 读取 Ex 命令给予通过运行时路径".

:ru[ntime][!] {file} .. Read Ex commands from {file} in each directory given by 'runtimepath'.

它是否与 :source {file} 等价?

推荐答案

:source 获取给定路径(相对或绝对)指定的文件

:source sources the file specified by the path given (relative or absolute)

:runtime 获取在 &runtimepath 中找到的与给定部分路径匹配的第一个文件(除非被撞!).

:runtime sources the first file (unless banged!) found in &runtimepath that matches the partial path given.

顺便说一句,与 :runtime 一起使用的路径名可以包含通配符(某种程度上是一种全局模式).这与正则表达式无关.

BTW, the pathnames used with :runtime can contain wildchars (somehow a glob-pattern). This has nothing to do with regexes.

这篇关于vim 中的 ':source file' 和 ':runtime file' 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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