I use Cygwin's vim & gvim. I used to be able to do as follows.
Consider this file mk.bash
, with no right-padding spaces:
// mk.bash
// -------
javac \
-classpath "/c/Program Files/MyJarFile.jar" \
TestSetup.java
I used to press ctrl-V
on the very 1st character, then cursor down to the
last character. All the text becomes highlighted to show that is
is selected. I then yank it into register a
using "ay
. I can
then paste an accurate copy in another Vim subwindow, tab, file,
and/or buffer.
I also used to be able to press ctrl-V
on the very 1st character,
cursor down to last character of last line, then continue cursoring
right. When I cursor beyond the last character, the highlighting
would change into a rectange, upper left corner on 1st character of
the file and lower right corner at the cursor.
If I yank into register a
and paste, only the highlighted text would
insert, and it included right padding with spaces to ensure a
rectangular block of text was pasted.
Because of work place restrictions, I hadn't upgraded Cygwin in a long time. When I recently had a chance to, however, I found that the ctrl-V yanking behaviour changed. My work flow is now disrupted. Specifically, the first highlighting above without right padding still looks the same, but when I paste the yanked text, it is all right-padded with spaces so that each line length is as long as the longest line -- plus one space.
For bash, the terminating \
on a line indicates that
a command continues to the next line. With the extra space after
\
, however, it is no longer valid. Hence, I am unable to simply
paste visually selected text to an xterm
after yanking into register *
(the system/OS cut & paste buffer).
What would cause vim to change its behaviour to right-pad like
this? Is this hard-coded into vim, or is it a setting? I'm
wondering if recent changes to my vimrc
might be the cause. I am
always changing my vimrc
.
:ver
output
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 30 2020 21:51:17)
Included patches: 1-486
Modified by <[email protected]>
Compiled by <[email protected]>
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl +cmdline_hist +ex_extra +keymap -mouse_gpm +persistent_undo +spell +timers +X11
+arabic +cmdline_info +extra_search +lambda -mouse_jsbterm +popupwin +startuptime +title -xfontset
+autocmd +comments -farsi +langmap +mouse_netterm +postscript +statusline +toolbar +xim
+autochdir +conceal +file_in_path +libcall +mouse_sgr +printer -sun_workshop +user_commands +xpm
-autoservername +cryptv +find_in_path +linebreak -mouse_sysmouse +profile +syntax +vartabs +xsmp_interact
+balloon_eval +cscope +float +lispindent +mouse_urxvt +python/dyn +tag_binary +vertsplit +xterm_clipboard
+balloon_eval_term +cursorbind +folding +listcmds +mouse_xterm +python3/dyn -tag_old_static +virtualedit -xterm_save
+browse +cursorshape -footer +localmap +multi_byte +quickfix -tag_any_white +visual
++builtin_terms +dialog_con_gui +fork() +lua/dyn +multi_lang +reltime -tcl +visualextra
+byte_offset +diff +gettext +menu -mzscheme +rightleft +termguicolors +viminfo
+channel +digraphs -hangul_input +mksession +netbeans_intg +ruby/dyn +terminal +vreplace
+cindent +dnd +iconv +modify_fname +num64 +scrollbind +terminfo +wildignore
+clientserver -ebcdic +insert_expand +mouse +packages +signs +termresponse +wildmenu
+clipboard +emacs_tags +job +mouseshape +path_extra +smartindent +textobjects +windows
+cmdline_compl +eval +jumplist +mouse_dec +perl/dyn +sound +textprop +writebackup
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "/etc/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: "/etc"
f-b for $VIMRUNTIME: "/usr/share/vim/vim82"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -D_REENTRANT -ggdb -O2 -pipe -Wall -Werror=format-security -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/usr/src/ports/vim/vim-8.2.0486-1.x86_64/build=/usr/src/debug/vim-8.2.0486-1 -fdebug-prefix-map=/usr/src/ports/vim/vim-8.2.0486-1.x86_64/src/vim-8.2.0486=/usr/src/debug/vim-8.2.0486-1 -fstack-protector-strong -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -fstack-protector-strong -L/usr/local/lib -Wl,--as-needed -o vim.exe -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncursesw -lcanberra -liconv -lacl -lattr -lintl -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong -L/usr/lib/perl5/5.30/x86_64-cygwin-threads/CORE -lperl -lpthread -ldl -lcrypt
'virtualedit'
is set. If you unset it, then when you paste an uneven virtual block on lines that are empty, it won't pad the lines with spaces. But it will do that when it's set. (But note you do need'virtualedit'
set to select the second rectangle...)Normal
mode regardless of where a line actually ended. So I must have hadvirtualedit=all
. I'm beginning to think that yanking in visual mode has changed. Before, exactly the highlighted text was yanked, and this applied to both pictures in my original post. Now, it does not apply to the 1st picturevirtualedit
enabled... But I glanced at the commits that mentionvirtualedit
and none seems to touch this area.virtualedit=all
. Otherwise, it's too constraining.