首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >来自q的vim映射!敬Q!

来自q的vim映射!敬Q!
EN

Ask Ubuntu用户
提问于 2015-05-20 11:41:40
回答 3查看 2K关注 0票数 3

我正试着画“Q”呢!到“Q!”在.vimrc?我试过以下几种方法,但不起作用。:Q命令!q!请提供任何缓解这一问题的建议。谢谢。

EN

回答 3

Ask Ubuntu用户

发布于 2015-05-20 11:50:38

你只要给

代码语言:javascript
复制
:command Q q

类似地,您也可以执行其他命令,例如,

代码语言:javascript
复制
:command WQ wq
:command W w
票数 3
EN

Ask Ubuntu用户

发布于 2017-09-12 10:12:54

这对我来说是完美的:

代码语言:javascript
复制
:command-bang Q q<bang>

来自vim的帮助(:h command-bang):

代码语言:javascript
复制
Special cases                           :command-bang :command-bar
                                        :command-register :command-buffer
There are some special cases as well:

        -bang       The command can take a ! modifier (like :q or :w)

代码语言:javascript
复制
Replacement text

The replacement text for a user defined command is scanned for special escape
sequences, using <...> notation.  Escape sequences are replaced with values
from the entered command line, and all other text is copied unchanged.  The
resulting string is executed as an Ex command. [...]

The valid escape sequences are
        [...]
        <bang>  (See the '-bang' attribute) Expands to a ! if the
                command was executed with a ! modifier, otherwise
                expands to nothing.
        [...]
票数 2
EN

Ask Ubuntu用户

发布于 2015-05-20 11:54:25

试一试:

代码语言:javascript
复制
:cmap Q! q!

将命令模式下的Q!映射到q!

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/626059

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档