Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Make "Paste and Indent" the default paste in Sublime Text 2
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
Owner

twosixcode commented Mar 6, 2012

Sublime Text 2 has a "Paste and Indent" menu item (⌘⇧V) which automatically applies correct indentation to pasted text (like pasting in TextMate).

You can effectively make smart-pasting the default by swapping the ST2 keybindings for "Paste" and "Paste and Indent." Go to Preferences > Key Bindings - User or from the Command Palette (⌘⇧P) type "key bindings."

http://www.sublimetext.com/forum/viewtopic.php?f=4&t=5511#p24379

Nice!

Macxim commented Nov 29, 2012

Thank you so much!

👍

This is grand! Thanks. 🍻 🐱

espy commented Jan 24, 2013

Thanks!

Cheers!

for windows:

{ "keys": ["ctrl+v"], "command": "paste_and_indent" },
{ "keys": ["ctrl+shift+v"], "command": "paste" }

Huge thanks for this.

LiYiBin commented Apr 20, 2013

Great!

madprops commented May 2, 2013

sublime just got so much better

Wow, can't thank you enough for this one

A5308Y commented May 23, 2013

Wheee!

creezi commented May 23, 2013

Good

Thanks!!

Thank you!

Sweet!

Brilliant of you.

O yeah! Thank ya :)

yess

Puh leeeeeeeeeaaassse

you are amazing!

OMG! #yearswasted

djadmin commented Mar 3, 2014

This one is awesome !

I love you so much. This has been X_#&_#($#ing me off since I switched to Sublime Text two days ago. <3 <3 <3 Spose I should read sublimtext's manual or something - didn't even know the feature existed lol.

epogue commented Apr 28, 2014

Thank you so much! I never even realized Sublime Text had a "Paste and Indent" command.

Really wish this was default. Cheers for this!

Thanks so much. Too many wasted hours correcting this manually. Definitely should be default! can't think of very many cases when a developer(or at least myself) would really want just a regular paste

Thanks! This is exactly what I needed.

Thanks for this and thanks to @zerodburn for the specific Windows settings at https://gist.github.com/twosixcode/1988097#comment-778005

Thanks!

Awesome Tip! Tweeted it. Thanks! 👍 😄

rin commented Feb 4, 2015

Thank you!

Here, have a 🍺 .

Ah, nice one!

Note/Reminder for Linux & Windows users: use »CTRL« instead of »Super« (OS X) of course

// swap the keybindings for paste and paste_and_indent
{ "keys": ["ctrl+v"], "command": "paste_and_indent" },
{ "keys": ["ctrl+shift+v"], "command": "paste" }

Thanks!

obviously. should have done this sooner.

This is so much win.

sepehr commented Jul 30, 2015

👍

antonpod commented Nov 3, 2015

really weird decision not make this a default behaviour.
thanks!

Thanks a lot! This should definitely be the default setting.

I have probably wasted an entire week of my life manually indenting. Didn't even know what paste and indent was until today. What a relief!

wow, why didn't they teach us that in school :'(

Awesome

Been bugging me for over a year... this afternoon finally decided to do something about it and found this. Thanks!

Nice!!!

Greatest thing since sliced bread!

deusd commented Jan 13, 2016

Who knew!!!

Save my day thanks.

Two thumbs up!!

imkost commented Mar 22, 2016

Thank you!

Any chance on replacing: swap_line_up by swap_line_up_and_indent?
http://superuser.com/questions/1089928/sublime-text-swap-line-and-indent

👍

rcanand commented Jan 22, 2017

👍

👍

Dude, you are the King of Town!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment