How To Paste From Different Registers Vim
Table of Contents
Cutting, Copy and Paste using the computer keyboard
Everybody knows how to use the keyboard combinations Ctrl-c
, Ctrl-x
and Ctrl-v
in Windows and Linux (or Cmd-c
, Cmd-x
and Cmd-5
in macOS) to re-create, cut and paste text across applications.
Many call back that those combinations are universal and work with whatsoever application. But information technology's not truthful.
Vim uses another system to substitution data with other applications.
For example, in Vim under GNU/Linux, the key combination Ctrl-v
corresponds to the visual cake part and does not affect the pasting text.
I wrote this commodity to remind me, equally a non-programmer, the fundamental combinations to be used in the Vim world to share text with other applications.
Vim and the clipboard
Vim uses an original resource to exchange text with other applications.
If you printing the Vim (or gVim, the graphic version of Vim) :reg
command, you can notice a listing of items beginning with a double quotation marking (") followed by a symbol, a letter or a number: these are the registers.
Vim uses a specific register to interact with the organisation clipboard and, consequently, with other applications.
This specific clipboard register is identified with the mathematical plus symbol (+
).
In that location'due south also some other symbol for the clipboard: the asterisk (*
) that produces almost the aforementioned results of the plus symbol but in GNU/Linux OS it saves data specifically for the middle mouse button.
From Vim to the Clipboard
If you need to transfer data from Vim to other applications you must use the key combination "+y
to copy the text and "+x
to cutting it from the original certificate.
As shown in the official menu in gVim:
Pay attention to the post-obit table:
Key | What is? |
---|---|
" | The registers symbol |
+ | The clipboard annals symbol |
x | The letter to cut the text |
y | The letter to copy the text |
Then, to complete the functioning, you lot have to press three keys in sequence:
-
"
-
+
-
x
ory
In both cases, the cut or copied text is sent also to the clipboard and can exist pasted outside Vim using the usual Ctrl-v
control, in Windows and Linux, or Cmd-v
in macOS.
From the Clipboard to Vim
The reverse functioning is as well quite simple.
You can transfer your text copied from the clipboard using the cord "+gP
.
Let's analyze every single component of the string:
- "
P
" ways paste earlier the current position. - The "
1000
" key puts the cursor afterward the pasted text.
And then "gP
" command produces the post-obit result: Paste before the current position, placing the cursor after the pasted text.
If yous don't utilize g
the cursor volition be placed on the last letter of the pasted text and you'll waste material fourth dimension to advance the cursor past 1 character.
In Vim philosophy everything must exist optimized, also the single movements of the cursor!
Some key shortcuts in gVim
In some cases, it's also possible to use key shortcuts in gVim.
They mainly piece of work in MS Windows just some of them piece of work also in several Linux distributions.
I can direct confirm the working in Mint, Fedora, Ubuntu, Antergos for the pasting shortcut (see list below) but not the same for the others.
The following is the list of shortcuts:
Shortcut | What happens? |
---|---|
Shift+Delete | Cut text and copy it in the clipboard |
Ctrl+Insert | Re-create text in the clipboard |
Shift+Insert | Paste text from the clipboard into a document |
Thank you for Your attending.
How To Paste From Different Registers Vim,
Source: https://francopasut.netlify.app/post/vim_cut_copy_paste_clipboard/
Posted by: carterseved1952.blogspot.com
0 Response to "How To Paste From Different Registers Vim"
Post a Comment