![]() ![]() Now you can yank text to system clipboard. The above will install the latest VIM with the option +clipboard enabled. # Reload bash_profile so the changes take effect in this window $ echo 'PATH=/opt/local/bin:$PATH' > ~/.bash_profile # Add the binary to your path, ahead of /usr/bin # Download, compile, and install the latest Vim You need to MAKE and install your VIM with the option you need. If it is -clipboard, then your VIM does NOT have the option to access the system clipboard. ![]() In the result, you should have +clipboard. To check if your vim has that option enabled use the below command vim -version | grep clipboard You need that option to access the system clipboard. When this answer was written (2019), the default vim shipped with macOS did not come with clipboard option enabled. If this does not work, check if your installed version maybe has the clipboard feature not enabled. This answer contains details specific to macOS users.Īppend the following line to ~/.vimrc: set clipboard=unnamed Currently it does not have any other options. brew info vim will be able to see other options for installing vim.:help "* or :help *+ for more informations.However this is hard to type, I am still thinking about alternatives. use "*y or "+y to save this visual block to clipboard. ![]() If you select a word range, the above will not work.Paste the content from the system clipboard into vim on a new line: :put + (Hint: use v or V to select the range first, and then type the colon : to activate the Ex command): :yank +Į.g., to copy/yank lines 5-10 to the system clipboard * register use: :5,10y * Here is a better and more elegant solution.Ĭopy the text of vim into the system clipboard. The biggest drawback is it will mess up your clipboard history, even when you use x for deletion. I was never satisfied with set clipboard method for years. Now you can copy the line in vim with yy and paste it system-wide. Install gui verion of vim: brew install macvimĪppend the following line to ~/.vimrc set clipboard=unnamed Luckily, homebrew can easily solve this problem. If you are using vim in and old version of macOS, unfortunately the shipped version of vim may and not be compiled with clipboard options. ![]()
0 Comments
Leave a Reply. |