Paste Toggle

vim (depending on details) may try to reformat code if naively pasted in. It is useful to set a keypress to knock it from "INSERT" into "INSERT (paste)" mode, if externally pasting in stuff (particularly if just relying on terminal paste support rather than vim's, see below).  Place in vimrc

set pastetoggle=<F2>

Mouse/Clipboard Handling and questionable Vim builds

At time of writing (in 2020?!) I'm seeing a bunch of text mode vim (rather than gvim) packaged binary builds, including in major linux distros, that as far as I can tell are inexplicably being built with terminal mouse support but not any clipboard support (see :version info).  That can make your vim session into a kind of roach motel in conjunction with many common terminal emulators: you can still paste in (with the terminal emulator's method for doing so as injected text rather than the missing native vim support), but copying stuff out won't work.  Symptomatically, vim's xterm mouse support will typically cause the terminal emulator to not do its highlighting, instead vim will use the mouse, but meanwhile vim also won't support '*' or '+' special registers as one might expect for traditional vim-style copy out via special register (they'll work intra-vim but not make it all the way to the system clipboard)!  That gets old very fast indeed, so one handy thing to do is just turn off vim's own mouse support entirely. This may not seem like progress, but it at least means the terminal emulator's internal mouse and copy/paste handling will work again, until someone can convince distros to fix the strange vim builds. Hopefully this issue will eventually go away, so don't do this unless you need to.  Place in vimrc.

set mouse=
set ttymouse=

 

Tags: