Skip to content

[MacOS] Copy The Content From VIM Editor To System Clipboard

Last Updated on 2021-09-17 by Clay

We can easily copy and paste the external code in Vim editor on Mac OS; however, if we want to copy the content of Vim editor for pasting to outside, it is a difficult mission.

This is because there are several clipboards in Vim editor so it can receive the paste content, but if we have no any setting, we can not use system clipboard to store the content of Vim editor, of course we cannot be pasted to the outside.

Then, the following simple record may be tried.


Solutions

We have two methods to solve this problem, first one is try to install macvim, and the other one is change the ~/.vimrc settings.

It is said that it can be copied directly to the system clipboard in macvim... But I haven't actually tested this method.

You can use the following command to install it:

brew install macvim --override-system-vim


And the other solution is edit the ~/.vimrc file:

set clipboard=unnamed

Then you can use V to start the VISUAL mode, press SHIFT + G to select all, and press y to copy, and then you can use Command + v to paste it externally.


References


Read More

Tags:

Leave a ReplyCancel reply

Exit mobile version