DEV Community

Discussion on: create a shortcut to toggle paste mode with Vim

Collapse
 
moopet profile image
Ben Sinclair

You can use ! to toggle the state of an option, so I have this:

inoremap <F3> <esc>:set paste!<cr>i
nnoremap <F3> :set paste!<cr>
Enter fullscreen mode Exit fullscreen mode

It doesn't give me feedback as a message, but I have the PASTE option in my statusbar so it's always visible.
My config has F2 - whitespace and 80-column hint, F3 - paste mode, F4 -indentlines. This is because They're otherwise unused functions between F1 (which is often shadowed by the terminal emulator) and F5 (which is conventionally for debugging).

Collapse
 
andy4thehuynh profile image
Andy Huynh

Did not know this! Thank you.

I'm using the newer macs that come w/ a touchbar. I rarely have F2, F3 etc at my fingertips. Will come back to this if I use a different machine.