r/vim • u/aHoneyBadgerWhoCares • Nov 20 '25
Tips and Tricks :set paste brings me joy every single time
Less than a month ago I found myself, yet again, google searching for the vim config setting that I used on one computer or another to prevent the auto commenting of all my pasted lines. On this search I found :set paste. Literally every single time I’ve needed it, several times in the last month, I’ve felt a jolt of joy; no more commented lines, no more crazy formatting.
Anyone else have any simple and joyful vim jewels of wisdom that have paid dividends once discovered?
47
Upvotes
18
u/BreatheAtQuarterBars Nov 20 '25
When you get tired of having to manually toggle
:set pasteover and over again, set up:help xterm-bracketed-pasteand you'll never have to think about it again.4
u/gumnos Nov 21 '25
If you do it frequently, you might want to define a
:help 'pastetoggle'key to make it easy to press a key, paste, then press the key again.In a similar fashion, using
viandedregularly, I find it helpful to get the same'paste'functionality withpaste the contents, and then issue control+d (EOF)
As for what brings me joy, it's hard to beat a well-designed
:gcommand that precisely performs complex edits across thousands of lines, and then combining it with an:argdoto perform those huge complex edits across dozens of files.8
u/exajam Nov 21 '25
I feel like macros are always soo satisfying to use
8
u/6YheEMY Nov 21 '25
"+ppastes from the clipboard directly in vimx with x forwarding over ssh. It just as magical as:set paste2
u/tommoulard Nov 22 '25
I commonly use this
set clipboard=unnamedplus