Emacs

Table of Contents

1. Description

Some notes and references about GNU Emacs.

2. Selecting an area of text

To select text like Vim characterwise-visual mode we can use rectangles, C-x SPC to toggle rectangle mark mode.

3. Isearch

Search through Info pages with commands like isearch-forward or isearch-backward.

See M-x describe-function RET isearch-forward RET for a list of commands to run while searching, e.g. M-% to use query-replace.

4. Imenu

Jump to a package in list-packages with imenu bound to M-g i.

5. Increment numbers

Press C-M-% (query-replace-regexp) then 1 and \# as arguments to change numbers from 1 1 1 1 to 0 1 2 3.

6. Abbrevs

In Evil mode insert state C-p runs the command evil-complete-previous which use Dynamic Abbrevs.

7. TRAMP

TRAMP extends the Emacs file name syntax by adding a remote component. A remote file name always looks like /method:user@host:/path/to/file.

7.1. File name syntax

Remote file names have method, user and host parts prepended. All of them, and also the local file name part, are optional, in case of a missing part a default value is assumed. The default value for an empty local file name part is the remote user’s home directory. The shortest remote file name is thus /-::. The - notation for the default method is used for syntactical reasons, *note info “(tramp) Default Method”.

/method:host:/path/to/file opens file /PATH/TO/FILE on the remote host HOST, using the method METHOD.

7.2. Open file on local host with sudo

Abbreviation of /sudo:root@localhost:/path/to/file (see notes:sudo).

/sudo::/path/to/file

7.3. Open file on remote host

The remote host can be the Host keyword value defined in the ssh client configuration file (see notes:ssh).

/ssh:framboise:~/file

7.4. Open file on remote host with doas

Combining methods to open a remote file as admin (see notes:doas).

/ssh:framboise|doas::/path/to/file

8. References