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

flot selection / highlighting - need to have simple value, not range
Big Query - And/Or Operators
Selecting text including $ in Sublime Text 3
polymer core-animated-pages switching on tap
Genetic Algorithm new generation exponentially increasing
Kendo IntegerTextBoxFor select all numbers on focus
Arcpy - Selecting Attribute and adding attributes to a feature class
Selecting multitple, specific lines in Sublime Text using the keyboard
Genetic Programming : Difference between Roulette Rank and Tournament Selection
Unselect all sections when “Custom” InstType is chosen
Drawing transform independent layout bounds in JavaFX
How to perform rank based selection in a genetic algorithm?
Copy-paste of selections with Xlib in X11: XA_TARGETS array of atoms
Selecting who should breed with whom from a list of qualified parents?
programmatically change selected rows in a slickgrid
dgrid selection- select row only when I click on check box

Categories

HOME
powerbi
libgdx
eclipse-plugin
qc
windows-10
docker-cloud
fogbugz
dependencies
iptables
navigation
pyresttest
kurento
spring-security-oauth2
clish
sslhandshakeexception
django-rq
max-msp-jitter
google-sites
spam
clr
libgit2
social-tables
liferay-6.2
pdf.js
opentext
managed-c++
d3.js-v4
instructions
snap-framework
gnu-classpath
db2-luw
grails-2.5
eclipse-gmf
unification
llvm-ir
widestring
linq.js
selenide
python-sounddevice
game-center
hdiv
coverage.py
spooler
virtual-memory
latexml
julius-speech
morphline
zend-form
common-table-expression
absolute
android-5.0-lollipop
sonatype
android-webservice
mura
mongodb-aggregation
ptvs
front-camera
prefetch
fitbit
elastic4s
xcode6.4
libharu
callouts
between
verisign
seadragon
wikimedia-commons
nastran
blank-line
auto-generate
sqlbase
gluon-desktop
css-paged-media
roxygen2
r.java-file
utf8-decode
windows-rt
visual-c++-2012
incognito-mode
radius-protocol
boolean-algebra
mod-perl
infinite
rikulo
donut-chart
jquery-cycle
cgrectmake
zend-pdf
first-class
server-name
trialware
microblogging
mmc3
net-use
channelfactory
ntruencrypt
isapi-redirect

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App