Emacs

Editing text

To mark a region use C-SPACE or C-@. To copy the selected text use M-w, to cut use C-w, for pasting use C-y.

To load a file with the given encoding use C-x RET r or revert-buffer-with-coding-system.

To reload a file from disk use M-x revert-buffer. To enable autorealoading one can use the auto revert mode with the command M-x auto-revert-mode.

To do a regular expression replace, use the command M-x replace-regexp. The regular expression syntax has more backslashes than usual. For instance, to replace the date in format DD/MM/YYYY to <YYYY-MM-DD> use the expression \([0-9]\{2\}\)/\([0-9]\{2\}\)/\([0-9]\{4\}\) ⟶ <\3-\2-\1>.

Configuration

The following settings are tested with Emacs 25.

To reload the configuration use M-x eval-buffer.

Saving sessions is so called desktop mode:

                        (desktop-save-mode 1)
                

To match parenthesis use the Paren Mode:

                        (show-paren-mode 1)
                

In order to show tabs of the opened files, install package emacs-goodies-el for Debian based distribution. In the configuration file put:

                        (tabbar-mode 1)
                

To force SSH connection to remote machines set in the configuration file:

                        (setq tramp-default-method "ssh")
                
Then use C-x C-f with the prefix ssh of the file path.

There is a possibility to setup Window split policy, it defines minimum width or height when to apply the split policy:

                        (setq split-height-threshold 80)
                        (setq split-width-threshold 240)
                

For the line highlighting use

                        (global-hl-line-mode 1)
                        (set-face-background hl-line-face "#222222")
                

Magit

To install Magit, first setup the package archive in .emacs/init.el:

                        (require 'package)
                        (add-to-list 'package-archives
                            '("melpa" . "http://melpa.org/packages/") t)
                
After refreshing Emacs with eval-buffer, refresh the package list using M-x package-refresh-contents RET and then install it with M-x package-install RET magit RET

To use Magit type M-x magit-status or C-x g, to exit use q. When Magit window is opened, use key TAB to show the diff, use s to stage changes, key u to unstage, key k to revert a file changes. To commit press c and then c again; when log comment is finished, press C-c C-c to finish the commit. To push the commit use P and then u to push to the current upstream. Since Magit does not provide git rm, delete a file with M-x delete-file RET <file> RET and then refresh Magit buffer with g.

Ido mode

To reload a directory in Tramp mode use C-l.

JSON mode

Install it via Melpa:

                        M-x package-install RET json-mode RET
                
Set indent size with:
                        M-x customize-group RET json-mode RET
                
To format a buffer use C-c C-f.

TeX mode

To compile from .tex into .pdf use C-c C-c. To view the PDF file use again C-c C-c. Emacs will show the PDF file in a new buffer. For the autocomplete of Tex commands use M-/

Dired

Use it with dired. Open a file by selecting it and pressing the Enter. To rename a file use R Enter. To flag a file for deletion press d. To actually delete the flagged files press x and confirm it.

Ibuffer

Use it with M-x ibuffer to show all the open buffers. To mark a buffer use m, to unmark it use u, to kill all the marked buffers use D. To see the help use ?.

Term Mode

Call it with M-x term. To switch between the terminal buffer and another one use C-c C-left and C-c C-right. To switch to the line mode use C-c C-j. To switch to the character mode use C-c C-k. To kill the terminal buffer use C-c k.

Org Mode

To refresh a table use C-u C-c * or C-u C-c C-c anywhere in the table.

To format a cell to one decimal place:

ready.

10 print "mail: contact at alepho.com | skype: karastojko | stackoverflow: karastojko | github: karastojko"
20 print "(c) 2009-2022 www.alepho.com"