vim - 什么是vim的@@变量?

标签 vim

我知道通过键入@@可以执行最后一个@命令。但是谁能解释下面的代码(在vim帮助文件中找到)中的@@是什么?

function! CountSpaces(type, ...)
  let sel_save = &selection
  let reg_save = @@

  if a:0
    silent exe "normal! `<" . a:type . "`>y"
  elseif a:type == 'line'
    silent exe "normal! '[V']y"
  elseif a:type == 'block'
    silent exe "normal! `[\<C-V>`]y"
  else
    silent exe "normal! `[v`]y"
  endif

  echomsg strlen(substitute(@@, '[^ ]', '', 'g'))

  let &selection = sel_save
  let @@ = reg_save
endfunction

它似乎是一个寄存器,但不在:help registers的列表中。通过阅读代码,我猜想它是取消/删除的默认寄存器?这在任何地方都有记录吗?我所有的搜索都只是生成执行最后一个@命令的@@惯用法。

最佳答案

:help @r给了我

register                        *expr-register* *@r*
--------
@r          contents of register 'r'

The result is the contents of the named register, as a single string.
Newlines are inserted where required.  To get the contents of the unnamed
register use @" or @@.  See |registers| for an explanation of the available
registers.

因此,@@将使用dcsx命令删除文本的值,
或使用y命令拉紧的文本。

关于vim - 什么是vim的@@变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4455102/

相关文章:

linux - vim - 为什么搜索会找到它但不会搜索和替换? (此转义特殊字符模式)

VIM 撤消 : Why does the cursor jump to the wrong position when undoing `undojoin` ?

vim - vim 上有 cit、dit、yit(更改、删除、猛拉标签内)...是否有类似 pit(粘贴到标签内?)

vim - IdeaVim 在 PhpStorm 中同时编辑多行

vim - 在 Vintage 中切换模式时更改 sublime text 3 的外观

gzip - 如何在 Gvim 中打开 gzip 文本文件而不解压?

shell - fzf,stdin出现问题,并从rust :调用程序

vim - 在 Vim 中隐藏制表符

c++ - ctag 忽略 C++ 中的类

Vim:处理函数 <SNR>37_MRU_LoadList 时检测到错误: