Wiki source code of Tips

Last modified by David De La Harpe Golden on 2020/09/27 00:29

Show last authors
1 == Paste Toggle ==
2
3 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##
4
5 {{code language="vim"}}
6 set pastetoggle=<F2>
7 {{/code}}
8
9
10 == Mouse/Clipboard Handling and questionable Vim builds ==
11
12 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##.
13
14 {{code language="vim"}}
15 set mouse=
16 set ttymouse=
17 {{/code}}
18
19
20
21
22
23