vim拷贝
本文简单梳理了 macOS 下 vim 复制内容到系统剪切板。
vim-pbcopy#
How to copy to clipboard in Vim?
Vim copy to system clipboard on a Mac
macOS 下的 pbcopy 和 pbpaste 命令提供了对剪贴板的复制粘贴支持。
On macOS, copy lines to system clipboard:
- copy line m:
:<m> w !pbcopy - copy line m to n:
:<m>,<n> w !pbcopy - copy the whole file
:%w !pbcopy - paste from the clipboard
:r !pbpaste
copy selected part: visually select text(type v or V in normal mode) and type :w !pbcopy
- Visually select the text and type:
ggVG; - 输入
:,底行将提示:'<,'>(range 为选中区段); - 其后输入
!tee >(pbcopy)( orw !pbcopy)即可拷贝到系统剪贴板。
On most Linux Distros, you can substitute:
- pbcopy above with
xclip -i -sel corxsel -i -b - pbpaste using
xclip -o -sel -corxsel -o -b - visual select and copy