Vim offers the + and * registers to reference the system clipboard ([help quoteplus] and [ help quotestar]). Note that on some systems, + and * are the same, while on others they are different. Generally on Linux, + and * are different: + corresponds to the desktop clipboard (XA_SECONDARY) that is accessed using CTRL-C, CTRL-X, and CTRL-V, while * corresponds to the X11 primary selection (XA_PRIMARY), which stores the mouse selection and is pasted using the middle mouse button in most applications. We can use these registers like any other register. Here are a few common commands that demonstrate this:
* gg"+yG – copy the entire buffer into + (normal mode)
* "*dd – cut the current line into * (normal mode)
* "+p – paste from + after the cursor (works in both normal and visua
Attributes | Values |
---|
rdfs:label
| - Accessing the system clipboard
|
rdfs:comment
| - Vim offers the + and * registers to reference the system clipboard ([help quoteplus] and [ help quotestar]). Note that on some systems, + and * are the same, while on others they are different. Generally on Linux, + and * are different: + corresponds to the desktop clipboard (XA_SECONDARY) that is accessed using CTRL-C, CTRL-X, and CTRL-V, while * corresponds to the X11 primary selection (XA_PRIMARY), which stores the mouse selection and is pasted using the middle mouse button in most applications. We can use these registers like any other register. Here are a few common commands that demonstrate this:
* gg"+yG – copy the entire buffer into + (normal mode)
* "*dd – cut the current line into * (normal mode)
* "+p – paste from + after the cursor (works in both normal and visua
|
Version
| |
dbkwik:vim/property/wikiPageUsesTemplate
| |
Previous
| |
Category
| |
Text
| |
Author
| |
Complexity
| |
Created
| |
ID
| - 984(xsd:integer)
- 2098(xsd:integer)
|
NEXT
| |
Rating
| |
abstract
| - Vim offers the + and * registers to reference the system clipboard ([help quoteplus] and [ help quotestar]). Note that on some systems, + and * are the same, while on others they are different. Generally on Linux, + and * are different: + corresponds to the desktop clipboard (XA_SECONDARY) that is accessed using CTRL-C, CTRL-X, and CTRL-V, while * corresponds to the X11 primary selection (XA_PRIMARY), which stores the mouse selection and is pasted using the middle mouse button in most applications. We can use these registers like any other register. Here are a few common commands that demonstrate this:
* gg"+yG – copy the entire buffer into + (normal mode)
* "*dd – cut the current line into * (normal mode)
* "+p – paste from + after the cursor (works in both normal and visual modes)
* :%y * – copy the entire buffer into * (this one is an ex command) One distinction to make is that using + and * is different from using CTRL-SHIFT-V on the terminal (or doing a right-click and then selecting "paste" in the terminal menu), where Vim essentially inserts each character in the clipboard one-by-one. In general using + and * is much more reliable than using CTRL-SHIFT-V. See also pasting registers for more general information about pasting from registers. I searched though the tips and found only a few passing references to this feature: VimTip71 (implies it's a feature of gvim, but I find it works in console Vim just fine under Linux; I only use gvim under MS Windows). VimTip771 and VimTip964 refer to an extra utility named xclip which is only for X11 and seems to be completely unnecessary for Vim using the * register), and VimTip960 (misses the point but the comments mention it a few times).
|