On my linux computer I am able to copy text to the clipboard with the command "+y
. How do I do the same on Mac?
MacOS – Copying text in vim to the global clipboard
macosvi
Related Question
- Copying and pasting between tmux panes containing vim instances over SSH in Terminal.app
- MacOS – How to use AppleScript to create a new Rich Text Format file from clipboard text
- MacOS – How to get the selected text into an AppleScript, without copying the text to the clipboard
- MacOS – AppleScript bug: When placing plain text on the clipboard, the text is always converted to rich text
- MacOS – Sound effect to confirm text is copied to clipboard
Best Answer
macOS version of vim is compiled with
-clipboard
(you can check withvim --version
). So there's no shared clipboard available. In this case you can download/recompile new vim or you can use system commandpbcopy
(man page). Here's how to use it as CTRL ⌃+C shortcut:map <C-c> y:e ~/clipsongzboard<CR>P:w !pbcopy<CR><CR>:bdelete!<CR>
Add this to your
~/.vimrc
file.Explanation of this command can be found here: vimtips @ quora