

Registers in VIM-NEOVIM
source link: https://allsyed.com/posts/registers-in-vim-neovim/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Unnamed "
Vim uses unnamed register as the default register. It is often used for all
delete, change, copy or cut operations. It also points to the last used
register unless last used register is Black hole register.
Whenever you use y/Y
or p/P
commands , you are using unnamed
register.It is still surprising to see name for an unnamed register.It can
be explicitly accessed using ""
in normal mode or "
in insert mode
Numbered 0 to 9
Vim gradually fills up these registers as you keep using delete and copy(yank) commands. This means that with each successive deletion or change, Vim shifts the previous contents of reg 1 into reg 2, 2 into 3, and so forth, losing the previous contents of reg 9.
reg 0 contains most recently yanked text
reg 1 contains most recently deleted text
Small delete -
This register contains text from commands that delete less than one line, except when the command specifies a register
Named a to z / A to Z
These registers are like your treasury. They will only be filled or used when you specifically order VIM. Text can be easily appended to these registers.You use small-caps to overwrite previous text if any, and Upper case to append to existing text.
Read-only : , . and %
We have 3 Read-Only regs,you can only use them on 3 variants of one
command.How co-incidental .p
, P
, :put
are the only privileged
commands known to have access rights to read-only register.
.
dot
Anyone who have used VIM for more than a week know what I am talking about. dot repeats last insert operation.:
colon
Stores most recent command line command. If you are curious to see its contents, use<c-r>:
in normal mode.one more trick,use@:
to repeat last command.%
Percentile
A very unusual feature that I missed in every editor I used other than VIM.
Alternate buffer #
This comes in play when you have more than one file open in VIM.Stores
name of the alternate file for the current window.It will change how the
<c-^>
command works. This register is writable in VIM but read-only in
NEOVIM.
Expression =
I call this one the poor mans repl that is bundled with VIM, again a
feature that I miss in other editors and IDE's I use.This is not really a
register that stores text, but is a way to use an expression in commands
which use a register.This is one of those register with its own special
history.It is a little tricky to use. To access it hit =
after
<c-r>
in insert mode or "
in normal mode, doing so will drop me on
command line,I now have all the power command line has to offer.
Selection and drop *, + , ~
Stores and retrieves the selected text from the GUI.
"/
Holds text copied to system clipboard, if you VIM installation has this feature enabled."+
This is synonymous with*
under windows but distinct in Unix(x-11) based systems."~
People familiar with *nix based systems may think of this one as home directory for current user.It is read-only register, strange right.I wonder why it is not included in Read-only registers list.Register stores the dropped text from the last drag 'n' drop operation. When something has been dropped onto Vim, this reg is filled in and the pseudo key is sent for notification.It is highly unlikely that you are ever gonna use it.
Black hole _
It is what it say, anything sent to it is lost forever.*nix user can think
of it as /dev/null
.Cool awesome example, just popped up at perfect
moment.
Last search pattern /
Here come one more extremely useful register, ever wondered how vim could
remember tons of your searches. It is a Read-Write register. Its value can be
manipulated using let
. Vim script anyone.
Conclusion
We will wrap up now.Before we do here are few commands that can help you understand and use register better.
:reg :dis :help registers :help quote_quote :help quote_number :help quote_- :help quote- :help quote_alpha :help quote_. :help quote_% :help quote_: :help *quote_# :help quote_= :help quote_~ :help quote_= :help quote_ :help quote_/ :help @/
Recommend
-
149
Documentation | Chat | Twitter Neovim is a...
-
12
How Do I Create New Text Objects in Neovim/Vim2020-11-15Nvim1183 words 6 mins read 758 times readShortly after I started using
-
6
Introducing My First Vim/Neovim Plugin2020-12-18Nvim306 words 2 mins read 1 times readAfter using and learning Neovim for over 2 years, I have finally...
-
8
vim-mine-sweeping mine sweeping game in vim and neovim ScreenShot Installation " vim-plug Plug 'iqxd/vim-mine-sweeping' Usage Launch Vim Mine Sweeping with...
-
11
最近...
-
8
Introduction Have you ever found it difficult to manage and operate text in Vim, especially in Cut/Copy/Paste stuff. You cannot figure out how on earth am I supposed to retrieve my un-saved, un-committed changes in Vim. Then...
-
205
Copilot.vim GitHub Copilot is an AI pair programmer which suggests line completions and entire function bodies as you type. GitHub Copilot is powered by the OpenAI Codex AI system, trained on public Internet text and billions of line...
-
10
📅 Jan 16, 2016 · ☕ 3 min read · ✍️ Syed Dawood The first thing that may come to your mind when I say language of vim is Vim Script.No that's not what I am talking about.I am talking about the patterns of keystrokes t...
-
11
我的vim/mavim/neovim配置 2016-06-26 工具
-
12
How to start using Neovim instead of Vim 5 minutes readIn this article I want to show you how to start using Neovim instead of Vim with a minimum effort. If...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK