selection


Swapping text selections in Sublime Text 2


Forgive me if this has been asked before; I've looked around and while I can find (vague) documentation for swapping lines in Sublime Text, I can't see anything about swapping selections.
For instance, say I have the following text:
<div class="fade-black">...</div>
<div class="fade-white">...</div>
and I want to switch the colors of the two divs. So I select black and white. Now what? Is there anything built in, or should I be looking into writing an add-on myself? (I know that this particular example is relatively simple, but I have a lot of needs for this type of function in my code, and I can't simply swap lines because the content is not otherwise identical.)
Hopefully this helps some others out too -- definitely seems like a nice feature to know about!
To swap two (or more) selections you need to use the transpose command, by default you can call it pressing ctrl + t (works on Sublime Text 3 too)
{ "keys": ["ctrl+t"], "command": "transpose" }
As mentioned in Joe's comment to Hugo's answer, you can swap two selections via the Edit -> Permute Selections -> Reverse menu item. Shuffle won't always change the ordering as you want it to.
You can map this operation to a key by adding something like this to your Preferences -> Key Bindings – User file, replacing f8 with a key binding of your choice:
{ "keys": ["f8"], "command": "permute_selection", "args": {"operation": "reverse"} },
Every day I'm shuffling...
Select both statements, Edit -> Permute Selections -> Shuffle.

Related Links

GIMP: Subtract overlapping selections
Opencart: Add extra features under the same product
AQGridView Selection and Deselection
make 2 different selection-tools coexist in pyside
Swapping text selections in Sublime Text 2
Selecting text with Sublime Text 2
Stata: Lag length criteria: How can I explain the results?
jquery-autocomplete default selection
Zend Studio selecting full Block
Genetic Algorithm - producing a new generation
UICollectionView shouldSelectItemAtIndexPath=NO does not avoid deselecting old selection?
UICollectionView Tap Selects More Than One Cell
Should this be selection or projection
Deselecting cells programmatically in NSMatrix does not work
Sublime Text 2 multiple selection at boundaries of selection (Mac OS X)
How should Stochastic Universal Sampling be combined with Elitism in Genetic Programming?

Categories

HOME
rust
orientdb
webview
android-espresso
firebase
list
shinyapps
cucumber
focus
livecode
opencv-python
activex
compilation
openlayers-3
mirc
google-webmaster-tools
haxe
lda
xamarin-zebble
grocery-crud
web-deployment
susy-sass
wsf
el
websphere-portal
morris.js
annotation-processing
substance
windowsiot
rust-cargo
xcrun
private-key
jslint
jade4j
aurelia-http-client
raytracing
google-prediction
elasticsearch-aggregation
julius-speech
git-tfs
jshint
nuclio
ipp-protocol
daz3d
gcal
music21
deployd
icecast
entropy
sigsegv
android-sharing
wikimapia
glassfish-4.1
glimpse
cocoa-bindings
ndk-build
livereload
gcloud-node
textblock
accessibilityservice
certificate-authority
in-app-billing
largenumber
fantom
uitest
vdm-sl
roxygen2
dynamics-ax-2012-r2
swagger-maven-plugin
scala-swing
mxe
dos2unix
jquery-mobile-flipswitch
lmax
angular-ui-select
screwturn
forceclose
air-native-extension
preorder
colon
acitree
revmob
ui-design
tridion-2011
popup-blocker
opends
fitch-proofs
boost-foreach
motodev-studio
groovy-console
fork-join
webresponse
j2mepolish
eventaggregator
wmd-editor
gtktextview
ntruencrypt
bindable-linq

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App