Instantly share code, notes, and snippets.

Embed
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" }
@twosixcode

This comment has been minimized.

Show comment
Hide comment
@twosixcode

twosixcode 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

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

@frank-laemmer

This comment has been minimized.

Show comment
Hide comment
@frank-laemmer

frank-laemmer commented Oct 26, 2012

Nice!

@Macxim

This comment has been minimized.

Show comment
Hide comment
@Macxim

Macxim Nov 29, 2012

Thank you so much!

Macxim commented Nov 29, 2012

Thank you so much!

@buritica

This comment has been minimized.

Show comment
Hide comment
@buritica

buritica commented Jan 13, 2013

👍

@chuckbergeron

This comment has been minimized.

Show comment
Hide comment
@chuckbergeron

chuckbergeron Jan 21, 2013

This is grand! Thanks. 🍻 🐱

chuckbergeron commented Jan 21, 2013

This is grand! Thanks. 🍻 🐱

@espy

This comment has been minimized.

Show comment
Hide comment
@espy

espy Jan 24, 2013

Thanks!

espy commented Jan 24, 2013

Thanks!

@zerodburn

This comment has been minimized.

Show comment
Hide comment
@zerodburn

zerodburn Feb 20, 2013

Cheers!

for windows:

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

zerodburn commented Feb 20, 2013

Cheers!

for windows:

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

@zachstronaut

This comment has been minimized.

Show comment
Hide comment
@zachstronaut

zachstronaut Mar 20, 2013

Huge thanks for this.

zachstronaut commented Mar 20, 2013

Huge thanks for this.

@LiYiBin

This comment has been minimized.

Show comment
Hide comment
@LiYiBin

LiYiBin commented Apr 20, 2013

Great!

@madprops

This comment has been minimized.

Show comment
Hide comment
@madprops

madprops May 2, 2013

sublime just got so much better

madprops commented May 2, 2013

sublime just got so much better

@AndrewBarba

This comment has been minimized.

Show comment
Hide comment
@AndrewBarba

AndrewBarba May 10, 2013

Wow, can't thank you enough for this one

AndrewBarba commented May 10, 2013

Wow, can't thank you enough for this one

@A5308Y

This comment has been minimized.

Show comment
Hide comment
@A5308Y

A5308Y commented May 23, 2013

Wheee!

@creezi

This comment has been minimized.

Show comment
Hide comment
@creezi

creezi commented May 23, 2013

Good

@andybaumgar

This comment has been minimized.

Show comment
Hide comment
@andybaumgar

andybaumgar commented Jun 24, 2013

Thanks!!

@nielsiano

This comment has been minimized.

Show comment
Hide comment
@nielsiano

nielsiano Jul 3, 2013

Thank you!

nielsiano commented Jul 3, 2013

Thank you!

@alessandroleite

This comment has been minimized.

Show comment
Hide comment
@alessandroleite

alessandroleite commented Aug 19, 2013

Nice.

@ahimsauzi

This comment has been minimized.

Show comment
Hide comment
@ahimsauzi

ahimsauzi commented Aug 20, 2013

Sweet!

@matthewlein

This comment has been minimized.

Show comment
Hide comment
@matthewlein

matthewlein Aug 26, 2013

Brilliant of you.

matthewlein commented Aug 26, 2013

Brilliant of you.

@pierreozoux

This comment has been minimized.

Show comment
Hide comment
@pierreozoux

pierreozoux Dec 19, 2013

O yeah! Thank ya :)

pierreozoux commented Dec 19, 2013

O yeah! Thank ya :)

@ursbraem

This comment has been minimized.

Show comment
Hide comment
@ursbraem

ursbraem commented Jan 11, 2014

yess

@baerkins

This comment has been minimized.

Show comment
Hide comment
@baerkins

baerkins Jan 13, 2014

Puh leeeeeeeeeaaassse

baerkins commented Jan 13, 2014

Puh leeeeeeeeeaaassse

@cambridgemike

This comment has been minimized.

Show comment
Hide comment
@cambridgemike

cambridgemike Jan 28, 2014

you are amazing!

cambridgemike commented Jan 28, 2014

you are amazing!

@aronwoost

This comment has been minimized.

Show comment
Hide comment
@aronwoost

aronwoost Feb 19, 2014

OMG! #yearswasted

aronwoost commented Feb 19, 2014

OMG! #yearswasted

@djadmin

This comment has been minimized.

Show comment
Hide comment
@djadmin

djadmin Mar 3, 2014

This one is awesome !

djadmin commented Mar 3, 2014

This one is awesome !

@GetContented

This comment has been minimized.

Show comment
Hide comment
@GetContented

GetContented Apr 6, 2014

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.

GetContented commented Apr 6, 2014

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

This comment has been minimized.

Show comment
Hide comment
@epogue

epogue Apr 28, 2014

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

epogue commented Apr 28, 2014

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

@stereonom

This comment has been minimized.

Show comment
Hide comment
@stereonom

stereonom commented Sep 4, 2014

@Maelstromeous

This comment has been minimized.

Show comment
Hide comment
@Maelstromeous

Maelstromeous Oct 28, 2014

Really wish this was default. Cheers for this!

Maelstromeous commented Oct 28, 2014

Really wish this was default. Cheers for this!

@marcushat

This comment has been minimized.

Show comment
Hide comment
@marcushat

marcushat Nov 10, 2014

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

marcushat commented Nov 10, 2014

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

@jimtryon

This comment has been minimized.

Show comment
Hide comment
@jimtryon

jimtryon Nov 11, 2014

Thanks! This is exactly what I needed.

jimtryon commented Nov 11, 2014

Thanks! This is exactly what I needed.

@JoeDuncko

This comment has been minimized.

Show comment
Hide comment
@JoeDuncko

JoeDuncko Dec 3, 2014

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

JoeDuncko commented Dec 3, 2014

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

@afuggini

This comment has been minimized.

Show comment
Hide comment
@afuggini

afuggini commented Dec 28, 2014

Thanks!

@xander-miller

This comment has been minimized.

Show comment
Hide comment
@xander-miller

xander-miller Jan 28, 2015

Awesome Tip! Tweeted it. Thanks! 👍 😄

xander-miller commented Jan 28, 2015

Awesome Tip! Tweeted it. Thanks! 👍 😄

@rin

This comment has been minimized.

Show comment
Hide comment
@rin

rin Feb 4, 2015

Thank you!

Here, have a 🍺 .

rin commented Feb 4, 2015

Thank you!

Here, have a 🍺 .

@pixelbrackets

This comment has been minimized.

Show comment
Hide comment
@pixelbrackets

pixelbrackets Feb 4, 2015

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" }

pixelbrackets commented Feb 4, 2015

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" }
@yberreby

This comment has been minimized.

Show comment
Hide comment
@yberreby

yberreby commented Mar 31, 2015

Thanks!

@ahnbizcad

This comment has been minimized.

Show comment
Hide comment
@ahnbizcad

ahnbizcad Jul 3, 2015

obviously. should have done this sooner.

This is so much win.

ahnbizcad commented Jul 3, 2015

obviously. should have done this sooner.

This is so much win.

@sepehr

This comment has been minimized.

Show comment
Hide comment
@sepehr

sepehr commented Jul 30, 2015

👍

@antonpod

This comment has been minimized.

Show comment
Hide comment
@antonpod

antonpod Nov 3, 2015

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

antonpod commented Nov 3, 2015

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

@vkrakovna

This comment has been minimized.

Show comment
Hide comment
@vkrakovna

vkrakovna Nov 16, 2015

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

vkrakovna commented Nov 16, 2015

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

@NickWoodhams

This comment has been minimized.

Show comment
Hide comment
@NickWoodhams

NickWoodhams Nov 25, 2015

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!

NickWoodhams commented Nov 25, 2015

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!

@bubakazouba

This comment has been minimized.

Show comment
Hide comment
@bubakazouba

bubakazouba Dec 30, 2015

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

bubakazouba commented Dec 30, 2015

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

@webcaetano

This comment has been minimized.

Show comment
Hide comment
@webcaetano

webcaetano commented Jan 6, 2016

Awesome

@tayhalla

This comment has been minimized.

Show comment
Hide comment
@tayhalla

tayhalla Jan 10, 2016

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

tayhalla commented Jan 10, 2016

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

@trjones1

This comment has been minimized.

Show comment
Hide comment
@trjones1

trjones1 commented Jan 12, 2016

Nice!!!

@solepixel

This comment has been minimized.

Show comment
Hide comment
@solepixel

solepixel Jan 13, 2016

Greatest thing since sliced bread!

solepixel commented Jan 13, 2016

Greatest thing since sliced bread!

@deusd

This comment has been minimized.

Show comment
Hide comment
@deusd

deusd Jan 13, 2016

Who knew!!!

deusd commented Jan 13, 2016

Who knew!!!

@ismnoiet

This comment has been minimized.

Show comment
Hide comment
@ismnoiet

ismnoiet Feb 10, 2016

Save my day thanks.

ismnoiet commented Feb 10, 2016

Save my day thanks.

@mathiastambjergsteengaard

This comment has been minimized.

Show comment
Hide comment
@mathiastambjergsteengaard

mathiastambjergsteengaard commented Feb 10, 2016

Two thumbs up!!

@jeffrand

This comment has been minimized.

Show comment
Hide comment
@jeffrand

jeffrand commented Feb 26, 2016

@imkost

This comment has been minimized.

Show comment
Hide comment
@imkost

imkost Mar 22, 2016

Thank you!

imkost commented Mar 22, 2016

Thank you!

@augnustin

This comment has been minimized.

Show comment
Hide comment
@augnustin

augnustin Jun 16, 2016

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

augnustin commented Jun 16, 2016

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

@jenlampton

This comment has been minimized.

Show comment
Hide comment
@jenlampton

jenlampton commented Aug 15, 2016

👍

@rcanand

This comment has been minimized.

Show comment
Hide comment
@rcanand

rcanand commented Jan 22, 2017

👍

@adamwgriffin

This comment has been minimized.

Show comment
Hide comment
@adamwgriffin

adamwgriffin commented Feb 22, 2017

👍

@SirCameron

This comment has been minimized.

Show comment
Hide comment
@SirCameron

SirCameron Sep 26, 2017

Dude, you are the King of Town!

SirCameron commented Sep 26, 2017

Dude, you are the King of Town!

@qmclaugh

This comment has been minimized.

Show comment
Hide comment
@qmclaugh

qmclaugh commented Mar 7, 2018

Love it

@andriy-baran

This comment has been minimized.

Show comment
Hide comment
@andriy-baran

andriy-baran commented Apr 20, 2018

👍

@nkn81

This comment has been minimized.

Show comment
Hide comment
@nkn81

nkn81 Aug 22, 2018

Super Siked !! Works with Sublime Version 3.1.1, Build 3176

nkn81 commented Aug 22, 2018

Super Siked !! Works with Sublime Version 3.1.1, Build 3176

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