2

I am using Homebrew Vim from MacOS Terminal. The problem I am having now is to copy in vim to System Clipboard. I follow the guide online, which told me to use "+y after selection texts in visual mode. However, when I hit the corresponding keys on "+y, the system responds with a sound indicating that such key combination is illegal. What am I doing wrong?

I did what is suggested. Here is what my dot file looks like:

 set runtimepath+=~/.vim_runtime


 source ~/.vim_runtime/vimrcs/basic.vim
 source ~/.vim_runtime/vimrcs/filetypes.vim
 source ~/.vim_runtime/vimrcs/plugins_config.vim
 source ~/.vim_runtime/vimrcs/extended.vim

 try
 source ~/.vim_runtime/my_configs.vim
 catch
 endtry


 " Define Key Mapping
 inoremap jj <Esc>

 set clipboard=unnamedplus

 " Run Python file with one command
 nnoremap <buffer> <C-M> :exec '!python' shellescape(@%, 1)<cr>

 "YouCompleteMe virtual env config
 let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'

Further, the :reg does not show the "+ or "* registry.

P.He
  • 31
  • 3
  • 1
    Possible duplicate of [Vim: copy selection to OS X clipboard](https://stackoverflow.com/questions/677986/vim-copy-selection-to-os-x-clipboard) – phd Dec 08 '18 at 16:41
  • https://stackoverflow.com/search?q=%5Bmacos%5D+%5Bvim%5D+copy+to+system+clipboard – phd Dec 08 '18 at 16:41
  • I read the thread and copying into system registry works for macvim but it doesn't work in my terminal vim. – P.He Dec 14 '18 at 15:09

1 Answers1

1

You can try with add the line:

set clipboard=unnamed

to your .vimrc ^1. For using + you might want to try with set clipboard=unnamedplus.

If you are not sure how to do this, just type in:

cd ~ && echo 'set clipboard=unnamedplus' >> .vimrc

See more information by :h clipboard-unnamedplus.

Notice that this this option works only in vim that is compiled with X11 & clipboard feature.

Regards

Songcheng Li
  • 181
  • 7