“g"有什么功能?在 vim 中提供命令 [英] What functionality does the "g?" command provide in vim
问题描述
作为一名初级程序员,我最近一直在 vimgolf 上练习 vim,看到命令g?"被有效地用于将多行 'Ivm' 转换为 'Vim'.我知道这会将每个字母向右移动 13 次,但不明白这将如何证明是有用的,除非在这样的特殊情况下.
As a beginner programmer I've been practicing vim on vimgolf recently and saw that the command "g?" was used effectively to switch many lines of 'Ivm' to become 'Vim'. I understand that this shifts each alphabetical letter 13 times to the right but do not understand how this would prove useful except in unique circumstances like these.
推荐答案
g?
命令(输入 :help g?
以获得简要文档)实现了 rot13
算法,将字母表中的每个字母向前或向后旋转 13 位.
The g?
command (type :help g?
for brief documentation) implements the rot13
algorithm, which rotates each letter 13 places forward or backward in the alphabet.
我不确定它在今天的使用有多普遍,但在 Usenet 上它曾经是一种编码剧透的常用方法.例如,如果我正在写一篇文章,它给出了不是每个人都看过的某些内容的结尾,我可能会使用 rot13
对文章的部分内容进行弱加密.这足以避免意外阅读(除非您已经进行了大量练习),但如果您使用具有内置 rot13
功能的新闻阅读器,则很容易阅读——如他们中的大多数都这样做.
I'm not sure how commonly it's used today, but on Usenet it used to be a common way to encode spoilers. For example, if I'm writing a post that gives away the ending of something that not everyone has seen, I might use rot13
to weakly encrypt part of the article. It's enough to make it impossible to read accidentally (unless you've had a lot of practice), but easy to read if you're using a newsreader that has a built-in rot13
function -- as most of them do.
例如:
假设这是一个剧透.用 rot13 过滤读取.
Pretend this is a spoiler. Filter with rot13 to read it.
会变成
Cergraq guvf vf n fcbvyre.Svygre jvgu ebg13 gb ernq vg.
Cergraq guvf vf n fcbvyre. Svygre jvgu ebg13 gb ernq vg.
不想看剧透的可以无视.如果我真的想阅读它,我可以很容易地解密它.
If I don't want to read the spoiler, I can ignore it. If I do want to read it, I can decrypt it easily enough.
这篇关于“g"有什么功能?在 vim 中提供命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!