Move to the beginning of a line the smart way

I’ve moved away from using my recommended setup, prelude in favour of completely writing my own customisation file. I would still recommend prelude for beginner and intermediate Emacs users, but I wanted full control for myself. I have missed a few things from prelude, but happily the author provides some of his useful functions in a stand alone package called crux.

One of my favourite tools from crux is crux-move-beginning-of-line, which I use in place of the normal C-a to move to the start of the line. The crux version has the extra benefit that the first time you use it, it moves the point to the first non-whitespace character on the line. Repeating it moves to the start of the line, and more repeats toggle back and forth.

Here’s how I install and configure crux to do this.

(use-package crux
  :bind (("C-a" . crux-move-beginning-of-line)))

Crux has lots of other useful tools, so go and check them out.