Emacs abbrevs hacks
I just watched Prot’s excellent video about abrrevs, and I feel my “Emacs IQ” has expanded a bit.
Here are the notes from my settings:
Turn Emacs' abbrevs on and place them in my Personal folder. The personal folder syncs to my machines so that these shortcuts are available on all of them (the default is somewhere in emacs.d/
).
(setq-default abbrev-mode t)
(setq abbrev-file-name "~/Sync/Personal/.abbrev_defs")
In addition, add “@” to my abbrevs, so that I can use “@” with a person number to get their user ID. For example, “Joe” will do nothing, but “@joe” will enter “jr2234.” Useful because I remember a person’s name, not their email address or user ID. Credit: Prot.
(abbrev-table-put global-abbrev-table :regexp "\\(?:^\\|[\t\s]+\\)\\(?1:[@].*\\|.*\\)")
Useful Abbrev reminders:
You can escape abbrevs with C-q after typing the abbrev. For example, if “rnd” expands to “Research and Development” but you actually want to type “rnd” in the buffer, type rnd
followed by C-q
.
If you want to add a prefix to an abbrev, for example, if you want the end result to be “non-Research and Development”, type: non-
and then M-'
(this will result in a hyphen showing; this is good) and then rnd
to produce the abbrev.