How to select only file content in VIM+ALE/Syntastic?

161 views Asked by At

When linters are enabled via ALE or Syntastic in VIM the warnings/errors are marked in 2-characters column at the left side of the buffer. I can copy by selecting with the mouse and paste by middle click. However, when warnings/errors are linted selecting the file content will also select the spaces and characters in the lint column.

How can I select only the file contents with the mouse? or temporarily remove the lint column?

(running VIM in Alacritty, Sway/Wayland, Arch, wl-clipboard is installed but I don't know if it is used)

EDIT: yes, I am trying to paste into other programs. Gvim works as wanted, but I'd rather have vim or vimlike, e.g. neovim which I am trying too now. In vim, neither the + or * clipboards work even though :echo has('clipboard') outputs 1. In neovim, only the * clibpoard works even though :checkhealth reports that wl-copy was found.

EDIT2: https://github.com/neovim/neovim/issues/2325 has a workaround for neovim, set mouse=a followed by vmap <LeftRelease> "*ygv

EDIT3: tests with mouse=a as suggested in the comments showed that the columns were selected under alacritty but not under urxvt, under kitty it does not work at all, so I am guessing it's a terminal bug

1

There are 1 answers

0
romainl On

If you want to yank from Vim to paste in other programs…

You need to make sure your Vim is built with clipboard support and, if so, use Vim's own "yanking" and "putting" commands instead of your terminal emulator|window manager|desktop environment's, which don't and can't be made to care about Vim's signs or line mumbers or window separators anyway.

  1. See if doing :echo has('clipboard') in Vim prints 1.

  2. If it does, then use "+yy to yank the current actual line, or "+y to yank the current selection, or "+y{motion} yo yank the text covered by {motion} to the system clipboard.

  3. If it does not, then install a proper Vim with clipboard support—the correct Arch package is gvim—and use the method outlined above.

If you only care about yanking and putting within Vim itself…

Use the built-in y and p as they are more versatile than your terminal emulator|window manager|desktop environment's copying and pasting anyway.

See :help y, :help p, and :help "+.