Question

I have a version of vim with both clipboard and xterm_clipboard support. However, "*y or "+y don't copy to the system clipboard. I know I can use :w !pbcopy (and even create a shortcut for it), but I really want the standard way. I saw fakeclip also, but wish to find a solution that is not fake...

Moreover, I wish to not need to use "* or "+ and just use y

UPDATE:

I just checked using the :reg command. I copied some text In another application then in vim ran the :reg command. The text is not there. I then ran MacVim and :reg showed that "* has the copied text. So something wrong with my vim?

Here's vim --version:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Nov 21 2013 07:13:18)
MacOS X (unix) version
Included patches: 1-244, 246-762
Compiled by idror@tlv-mp3u2
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
+find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
+mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_sgr -mouse_sysmouse
+mouse_urxvt +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg
+path_extra -perl +persistent_undo +postscript +printer +profile -python
-python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup +X11 +xfontset -xim
+xsmp_interact +xterm_clipboard -xterm_save
   system vimrc file: "/opt/local/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -I/opt/local/include -DMACOS_X_UNIX -no-cpp-precomp  -pipe -O2 -arch x86_64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1   -I/opt/local/include
Linking: /usr/bin/clang  -L/opt/local/lib   -L/opt/local/lib -arch x86_64 -L/usr/local/lib -o vim    -lXt -lX11 -lSM -lICE -lm  -lncurses -liconv -lintl -framework Cocoa
Was it helpful?

Solution 2

+xterm_clipboard is useless on a Mac: it won't help you get clipboard support at all.

You have MacVim installed, why don't you simply use it since it has clipboard support? Too easy?

Also, :set clipboard^=unnamed is a good idea in theory but it can clobber your clipboard history pretty quickly so… try it for a while to see if it works with you.

OTHER TIPS

I don't know what's the problem with the clipboard (it looks fine, seems to be specific to Vim on Mac OS / MacVim), but:

I wish to not need to use "* or "+ and just use y

That can be achieved with :set clipboard^=unnamed and :set clipboard^=unnamedplus, respectively.

I think the problem is this line from vim --version:

Huge version without GUI.

Try using /Applications/MacVim.app/Contents/MacOS/Vim instead (assuming the standard installation location). See How to run mvim (MacVim) from Terminal? for more information. (Wow! I did not realize that the mvim script was based on my own hack.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top