UPDATE: I run an X server (XQuartz 2.7.11) on MacOS, which I forward via ssh to any Linux machine I use. The problem seems to be that under XQuartz, the "+
register does not support blockwise yanking/pasting. Indeed, :call setreg('+',@+,"b")
does not work (echo getregtype('+')
still gives V
). Is there anything that can be done about this? How does vim registers work under the hood? Why does the system clipboard affect whether the "+
register supports blockwise yanking/pasting?
I am having trouble with blockwise pasting from the "+ register. It works if I run MacOS's default version but on both MacOS or Linux I get the following results when I use the version I have installed via nixpkgs.
I start up vim with vim -u NONE
and then use ctrl+v
to select the first three lines in:
1
2
3
a
b
c
I then press "+y
to put the block in the "+ register. I then put the cursor on the line a
and press "+p
to paste from the "+ register. Result:
1
2
3
a
1
2
3
b
c
Any advice?
Additional info:
- It works with other registers including
*
(like using"ay
and"ap
or"*y
and"*p
). - If I start vim with
vim -u NONE -X
(disable connection to X server):- Linux: The register
+
works as expected. - MacOS: The register
+
does not work at all.
- Linux: The register
- MacOS: If I stop the X server (XQuartz 2.7.11) things works as expected.
- After blockwise yank to
"+
respectively to"a
:echo getregtype('+')
givesV
echo getregtype('a')
gives^V1
- I do not use any clipboard manager.
vim version on MacOS:
$vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 10 2018 05:50:24)
macOS version w/o darwin feat.
Included patches: 1-146
Compiled by root
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl +farsi +mouse_sgr -tag_any_white
+arabic +file_in_path -mouse_sysmouse -tcl
+autocmd +find_in_path +mouse_urxvt +termguicolors
-autoservername +float +mouse_xterm +terminal
+balloon_eval +folding +multi_byte +terminfo
+balloon_eval_term -footer +multi_lang +termresponse
+browse +fork() -mzscheme +textobjects
++builtin_terms +gettext +netbeans_intg +timers
+byte_offset -hangul_input +num64 +title
+channel +iconv +packages +toolbar
+cindent +insert_expand +path_extra +user_commands
+clientserver +job -perl +vartabs
+clipboard +jumplist +persistent_undo +vertsplit
+cmdline_compl +keymap +postscript +virtualedit
+cmdline_hist +lambda +printer +visual
+cmdline_info +langmap +profile +visualextra
+comments +libcall +python +viminfo
+conceal +linebreak -python3 +vreplace
+cryptv +lispindent +quickfix +wildignore
+cscope +listcmds +reltime +wildmenu
+cursorbind +localmap +rightleft +windows
+cursorshape +lua +ruby +writebackup
+dialog_con_gui +menu +scrollbind +X11
+diff +mksession +signs -xfontset
+digraphs +modify_fname +smartindent +xim
+dnd +mouse +startuptime +xpm
-ebcdic +mouseshape +statusline -xsmp
+emacs_tags +mouse_dec -sun_workshop +xterm_clipboard
+eval -mouse_gpm +syntax -xterm_save
+ex_extra -mouse_jsbterm +tag_binary
+extra_search +mouse_netterm +tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "
/nix/store/mxb9yfzskiid83j9rv1icw39fnimaiv1-vim_configurable-8.1.0146/share/vim
"
Compilation: see nix-store --read-log /nix/store/mxb9yfzskiid83j9rv1icw39fnimaiv1-vim_configurable-8.1.0146
Linking: see nix-store --read-log /nix/store/mxb9yfzskiid83j9rv1icw39fnimaiv1-vim_configurable-8.1.0146
vim version on Linux:
$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jan 1 1970 00:00:01)
Included patches: 1-578
Compiled by nixbld
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl +extra_search +mouse_netterm +tag_old_static
+arabic +farsi +mouse_sgr -tag_any_white
+autocmd +file_in_path -mouse_sysmouse -tcl
+autochdir +find_in_path +mouse_urxvt +termguicolors
-autoservername +float +mouse_xterm +terminal
+balloon_eval +folding +multi_byte +terminfo
+balloon_eval_term -footer +multi_lang +termresponse
+browse +fork() -mzscheme +textobjects
++builtin_terms +gettext +netbeans_intg +timers
+byte_offset -hangul_input +num64 +title
+channel +iconv +packages +toolbar
+cindent +insert_expand +path_extra +user_commands
+clientserver +job -perl +vartabs
+clipboard +jumplist +persistent_undo +vertsplit
+cmdline_compl +keymap +postscript +virtualedit
+cmdline_hist +lambda +printer +visual
+cmdline_info +langmap +profile +visualextra
+comments +libcall +python +viminfo
+conceal +linebreak -python3 +vreplace
+cryptv +lispindent +quickfix +wildignore
+cscope +listcmds +reltime +wildmenu
+cursorbind +localmap +rightleft +windows
+cursorshape +lua +ruby +writebackup
+dialog_con_gui +menu +scrollbind +X11
+diff +mksession +signs -xfontset
+digraphs +modify_fname +smartindent +xim
+dnd +mouse +startuptime +xpm
-ebcdic +mouseshape +statusline -xsmp
+emacs_tags +mouse_dec -sun_workshop +xterm_clipboard
+eval -mouse_gpm +syntax -xterm_save
+ex_extra -mouse_jsbterm +tag_binary
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "
/nix/store/dgna8nl8d3nmzxbzjxvv7kqbwyv9f62c-vim_configurable-8.1.0578/share/vim
"
Compilation: see nix-store --read-log /nix/store/dgna8nl8d3nmzxbzjxvv7kqbwyv9f62c-vim_configurable-8.1.0578
Linking: see nix-store --read-log /nix/store/dgna8nl8d3nmzxbzjxvv7kqbwyv9f62c-vim_configurable-8.1.0578
<CR>
before?a
,b
,c
intoa1
,b2
andc3
, respectively.:echo getregtype('+')
after yanking to the+
register? What when yanking into e.g. registera
?