Ok I must have missed something vital here. Can someone please tell me what the difference between using "a and @a is? All I know is that @ is used together with let and e.g. echo and ” is used when pasting. However I find no sources that explains the difference and what the prefix mean.
Note: all of the following information (and much more) can be found using
:help ", and
"ad, &c.: use register
ain a put from or delete to.
@a: replay the contents of register
aas a sequence of normal commands
:let @a = 'string': assign a string to register a.
Now, there is likely some confusion because
" are occasionally interchangeable:
p: put from register
", this is called the "unnamed register," but in fact it has at least two names,
@": replay the contents of register
"as a normal command (this is rarely done).
@@: replay the previously used
Then, there are the
let and expression usages:
:let @" = 'string':
let @@ = 'string': assign a string to register
:echo @": echo the value of register
:echo @: also echo the value of register
:echo ": syntax error.
Finally, you can execute registers as an ex command (i.e., cmdline mode),
:@a: execute contents of register
aas an ex command.
:@:: execute the previous command line
:@@: execute the previous