I know that by typing @@
I execute the last @ command. But can anyone explain what @@
is in the code below (found in the vim help files)?:
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
It appears to be a register, but it isn't in the list at :help registers
. From reading the code I'd guess it is the default register for yanking/deleting? Is this documented anywhere? All my searches just yield the @@
idiom that executes the last @ command.
:help @r
gives me
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.
So, @@ will have the value of the text deleted with a d
, c
, s
or x
command,
or the the text yanked with a y
command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With