如何将所选文本作为 Vim 命令执行 [英] How to execute selected text as Vim commands

查看:31
本文介绍了如何将所选文本作为 Vim 命令执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我编写文档时,我发现自己确定了适合该文档的组织约定,并且我希望 Vim 在语法上突出显示该约定.但是制作 ftplugin 太全局"了,我希望语法着色与文档一起出现,所以如果我将它发送到没有该插件的地方,他们仍然可以获得着色.我发现你不能通过模式行来做,因为它只接受选项.

When I am writing documents, I find myself settling on an organization convention appropriate to that document, and I would like Vim to syntax highlight that convention. But making a ftplugin is too "global", I want the syntax coloring to come with the document, so if I send it somewhere without that plugin they can still get the coloring. I found that you can't do it through the modeline because that only accepts options.

现在我想知道是否有办法在可视模式(或其他)中选择一些文本并将其作为一系列 Vim 命令执行.

Right now I am trying to find out if there is a way to select some text in visual mode (or whatever) and have it executed as a series of Vim commands.

例如,在我有一个文档的底部:

For example, at the bottom of one document I have:

vim highlighting:
    syn match Comment "^>.*$"

如何选择该文本并说boom,执行它",而不必重新输入?

How can I select that text and say "boom, execute it" rather than having to retype it?

推荐答案

您可以选择行,拉出选择并使用

You can select the lines, yank the selection and execute it with

:@"

这篇关于如何将所选文本作为 Vim 命令执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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