I wrote in this post on Evil Emacs about some of the things that vi does well. One feature I particularly like is the ability to store a mark in a register q using the key combination mq. You can then jump back to that point using `q
Compare that with the equivalent Emacs key combinations: C-x r <space> q to store a point in a register, and C-x r j q to jump back.
There are lots of useful, and by me at least, underused Emacs features that begin with C-x r
A handy trick to see them is all to enter
C-x r C-h
which opens a buffer listing all the commands beginning C-x r
Here are the four we’re interested in for the moment
C-x r space q Store point in register q C-x r j q Jump to point stored in register q C-x r s q Store region in register q C-x r i q Insert text from register q
Could that key sequence be shortened? Well, here’s one way…
C-x r calls the ctl-x-r-map prefix keymap
Adding the following to your .emacs will save you a keystroke:
(global-set-key (kbd "C-`") ctl-x-r-map) Now C-` is the same hitting C-x r
Which means the key combinations for storing points and regions are as follows
C-` space q Store point in register q C-` j q Jump to point stored in register q C-` s q Store region in register q C-` i q Insert text from register q
Is it worth it? Well, it makes it easier for me to remember the key combinations, it also makes me more likely to use them. An added bonus is it also makes it easier to remember the rectangle commands. See this post on rectangles for more details.