Is there any possible way to give an arbitrary name for a register in vim. I am able to use "[a-z]p while pasting. But, I would like to know, if there is anyway by which we can use arbitrary names for a register. for eg. something like "foop, where the name of the register is foo
No, but you can copy any register contents to a Vim variable, and then use these as "virtual registers".
" Copy the default register. :let foo = @" " Use it; from normal mode: "=foo<CR>p :put =foo
No, you cannot do this with registers. It is vi-compatible, which makes registers use a single character (otherwise, the command-syntax would be different). According to the documentation:
There are nine types of registers: *registers* *E354* 1. The unnamed register "" 2. 10 numbered registers "0 to "9 3. The small delete register "- 4. 26 named registers "a to "z or "A to "Z 5. four read-only registers ":, "., "% and "# 6. the expression register "= 7. The selection and drop registers "*, "+ and "~ 8. The black hole register "_ 9. Last search pattern register "/
If you want to hold chunks of text in something with a longer name, you could investigate these features:
Abbreviations are used in Insert mode, Replace mode and Command-line mode. If you enter a word that is an abbreviation, it is replaced with the word it stands for. This can be used to save typing for often used long words. And you can use it to automatically correct obvious spelling errors.
Key mapping is used to change the meaning of typed keys. The most common use is to define a sequence commands for a function key.