-
Welcome back to emacs rocks
-
today I'll show you my definitely most favourite feature
-
of IntelliJ IDEA
-
selecting stuff by semantic units
-
it's an absolutely addictive feature
-
and JetBrains, in their infinite wisdom,
-
mapped it to Command-W on the mac
-
also known as Close Window ...
-
I still carry with me the frustration,
-
and bitterness over once again closing Firefox
-
with *all my tabs*
-
instead of selecting a word.
-
So, let's jump in and take a look at expand-region
-
and let's definitely not bind it to Command-W.
-
I've got expand-region on Control-@
-
look at point
-
see how it first selects the entire word
-
it expands to the entire sentence ...
-
the quotes ... the inside of the sexp ...
-
the entire sexp ... and so on
-
It's really a quick way of precisely marking whatever is at point
-
let's try some HTML
-
expand region works fairly well with most languages,
-
due to the general nature of its basic expansions
-
but there are also custom expansions to improve certain modes
-
like expand-html-attribute
-
and marking an entire tag
-
here's some JavaScript
-
expand to word ...
-
method call ... return statement ...
-
block ... function ... object property
-
I especially like using it with pending-delete-mode
-
if you start typing with an active region,
-
the contents are replaced with whatever you type.
-
you can get expand-region on github
-
and thanks to Josh Johnston and Le Wang for contributing
-
I have to say, I'm really loving the extensibility of emacs
-
whenever people brag about some cool new features
-
in their favourite editor,
-
I always pay close attention
-
who knows -
-
I might decide to spend a couple of hours
-
adding it to emacs.