为什么vim几乎每个命令都使用寄存器?

Dyl*_*ess 2 vim macvim

我喜欢组成具有语义含义的命令的简单性.就像,例如cib读起来像一句话change in brackets- 太棒了.

但为什么vim需要将旧内容复制到剪贴板中?我没有在那个命令中建议我想复制它,问题就更深了.

dw diw所有都复制到我的剪贴板/注册表.为什么?这似乎放弃了这些命令的语义价值,我想说这是意外的行为.

我使用这些命令是错误的,还是有某种方法可以完全禁用此功能?目前我做了一些像这样的重映射:

nnoremap dd "_dd

nnoremap cc "_cc

但我不想为非显式复制的每一种可能组合做到这一点.

Tan*_*ash 6

默认情况下,您所谈论的大多数命令都使用未命名的寄存器".听起来你正在处理剪贴板被覆盖所有这些事情,这可能是设置clipboardunnamed或的症状unnamed_plus.

set clipboard=如果输出set clipboard?是这两个选项之一,那么如果要回到标准,你可能会这样做.

                        *'clipboard'* *'cb'*
'clipboard' 'cb'    string  (default "autoselect,exclude:cons\|linux"
                          for X-windows, "" otherwise)
            global
            {not in Vi}
            {only in GUI versions or when the |+xterm_clipboard|
            feature is included}
    This option is a list of comma separated names.
    These names are recognized:

                        *clipboard-unnamed*
    unnamed     When included, Vim will use the clipboard register '*'
            for all yank, delete, change and put operations which
            would normally go to the unnamed register.  When a
            register is explicitly specified, it will always be
            used regardless of whether "unnamed" is in 'clipboard'
            or not.  The clipboard register can always be
            explicitly accessed using the "* notation.  Also see
            |gui-clipboard|.

                        *clipboard-unnamedplus*
    unnamedplus A variant of the "unnamed" flag which uses the
            clipboard register '+' (|quoteplus|) instead of
            register '*' for all yank, delete, change and put
            operations which would normally go to the unnamed
            register.  When "unnamed" is also included to the
            option, yank operations (but not delete, change or
            put) will additionally copy the text into register
            '*'.
            Only available with the |+X11| feature.
            Availability can be checked with:
                if has('unnamedplus')
Run Code Online (Sandbox Code Playgroud)