【问题标题】:Is there an equivalent to o-<esc>-p in Vim?Vim 中是否有与 o-<esc>-p 等价的功能?
【发布时间】:2009-06-23 23:23:16
【问题描述】:

当我拉出一整行并按下 p 时,由于换行符,Vim 会创建一个新行来放置被拉出的文本。但是,如果我拉出一行的一部分,有没有办法将拉出的文本放在新行中?我目前正在执行 o ESC p。这是唯一的方法吗?

【问题讨论】:

    标签: vim keyboard-shortcuts copy-paste


    【解决方案1】:

    这是你从 Vim 帮助中得到的答案:

    :[line]pu[t] [x]        Put the text [from register x] after [line] (default
                            current line).  This always works |linewise|, thus
                            this command can be used to put a yanked block as new
                            lines.
                            The cursor is left on the first non-blank in the last
                            new line.
                            The register can also be '=' followed by an optional
                            expression.  The expression continues until the end of
                            the command.  You need to escape the '|' and '"'
                            characters to prevent them from terminating the
                            command.  Example: >
                                    :put ='path' . \",/test\"
    <                       If there is no expression after '=', Vim uses the
                            previous expression.  You can see it with ":dis =".
    
    :[line]pu[t]! [x]       Put the text [from register x] before [line] (default
                            current line).
    

    但是colon-p-u-enter 无论如何都是更多的击键=/

    【讨论】:

    • 好答案,如果经常使用,这当然可以绑定到另一个键序列以减少击键。
    • 虽然按键次数多了,但也省去了插入模式的进出,这通常至少有省时的样子(你不必伸手去按ESC kbd>).
    【解决方案2】:

    有 o(c-r)0,因为您在插入模式下始终可以从寄存器粘贴,但前提是您希望在粘贴后保持插入模式

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-28
      • 2011-12-02
      • 1970-01-01
      • 2011-02-03
      • 2010-10-03
      • 2011-11-27
      相关资源
      最近更新 更多