14
votes

In Emacs, what are the names of the commands to:

  • indent all inside the buffer (in function of which language you use) (equivalent of select all the buffer and press tab)

  • move by "paragraph" (equivalent to ctrl-up and ctrl-down)

  • move by word (equivalent to ctrl-right and ctrl-left)

The true is that I moved to a macbook for professional raison and these features are impossible because of the binding of OS shortcuts on ctrl+...

I already tried to find this on google but no results. I will assign new bindings to these functions in .emacs.

3

3 Answers

25
votes

To help you help yourself: C-h k is describe key. Just press it and then your key combination and then it gives you the name and the doc for the bound elisp function.

For you it is:

  • indent-region (this is usually depending on the mode)

  • forward-paragraph and backward-paragraph

  • backward-word and forward-word

1
votes
  • M-x indent-region
  • M-x backward-paragraph and M-x forward-paragraph
  • M-x backward-word and M-x forward-word
1
votes

As said before you can use C-hk to display the documentation of the given binding. Another helpful command is the apropos-command bound to C-ha to find a function when you know a part of its name.

But another really cool feature to align text is align-regexp bound to C-x\.

e.g.

a = 12;
baz_to_bar = 3.14;
foo = 42;

Select the region and then use C-x\=RET

a          = 12;
baz_to_bar = 3.14;
foo        = 42;

And as its name suggests it, you can use a regular expression to determine how emacs will align your text. Enjoy!