Skip to content

Latest commit

 

History

History
3678 lines (3113 loc) · 423 KB

keybindings.org

File metadata and controls

3678 lines (3113 loc) · 423 KB

Psimacs Emacs configuration

Psimacs Key Bindings

The following tables summarizes the key bindings found in Psimacs. The key bindings of original Emacs are mostly unaltered. The most useful and important bindings are also listed below. In order to get proficient, it is important to learn about the help system that let you discover commands and bindings.

I am trying to setup keybinding in a mnemonics way so it’s easy to remember (and use). I am staying with the standard emacs keybinding as much as possible.

Emacs’s keybindings has well-defined conventions listed at Emacs Key Bindings Convention. In summary, the general rules are:

  • C-x reserved for Emacs native essential keybindings: buffer, window, frame, file, directory, etc.
  • F5F9 without modifier keys are reserved for users to define.
  • C-c
    • C-c C-letter, C-c digit are reserved for major modes.
    • C-c punctuation with punctuation in { } < > : ; are also reserved for major modes.
    • C-c punctuation with any other punctuation are allocated for minor modes.
    • C-c letter are reserved for users. In practice most third-party packages don’t give a hoot and will gladly stuff their own key binds in there.
  • Don’t rebind C-g, C-h and ESC.
  • <hyper> and <super> are two prefix keys reserved to you. They are remnants from ancient keyboards used in the 80s, but live on today in Emacs. Most PC-compatible keyboards won’t have a <super> or <hyper> key so we rebind the <lwindow> and <rwindow> Windows keys and the <apps> Application Context key to be the <super> and <hyper> prefix keys instead.

Psimacs uses the <super> and <hyper> key prefixes for all of its own key bindings.

KeyMnemonicKeyboard
<hyper>H-<Menu> or <Prnt-Scrn> in case of Lenovo notebook.
<super>s-<Left-Window> and <Right-Window>
<meta>M-<Alt>
<ctrl>C-<Strg>

Worth readings about Emacs keybindings:

Remapping the Capslock key

I remap the Left-Ctrl to the Capslock key and the original Capslock key to the Prnt Scrn key. This way I lose the original Prnt Scrn functionality, but I don’t bother. The reason that I do not simply exchange the Left-Ctrl and Capslock keys is that after years I’m used to the Left-Ctrl key and I still press this key often automatically. This however, is disruptive when I have changed the meaning of the Left-Ctrl key. So basically, now I have two Left-Ctrl keys and no Prnt Scrn :-).

In case of a minimal Lenovo ThinkPad keyboad that does not have a <Menu>, i.e. <Hyper> key, but that have the <Prnt-Scrn> key positioned between the <Alt Gr> and the <Right-Ctrl> keys the following layout is used by me. In this layout, the <Left-Ctrl> key is mapped to the <Capslock> key and the <Menu>, i.e. <Hyper> key is mapped to the <Prnt-Scrn> key.

Attention: This remapping is not performed automatically, but must be performed explicitely by the user as described in the init.html documentation file.

Get Help

The major help commands and their key bindings.

Key bindingCommandDescription
C-h ? C-h C-hM-x help-for-helpHelp command.
C-h tM-x help-with-tutorialSelect the Emacs learn-by-doing tutorial.
C-h C-sM-x search-forward-help-for-helpSearch forward in the help-for-help window.
C-h C-aM-x about-emacsDisplay the **About GNU Emacs** buffer.
C-h C-qM-x help-quick-toggleToggle display of a window showing popular commands and their bindings.
H-hHelp prefix, giving fast access to the help functions.
H-SPC hM-x psimacs/hydra/help/bodyHydra Help…
H-SPC HM-x psimacs/hydra/helpful/bodyHydra Helpful…
C-h eM-x view-echo-area-messagesView the log of recent echo-area messages: the **Messages** buffer.
C-h bM-x counsel-descbindsShow a list of all defined key bindings and their definitions.
C-h cM-x describe-key-brieflyPrint the name of the function called by key binding.
C-h kM-x describe-keyDisplay documentation of the function invoked by key binding.
H-h H-h bM-x helm-descbindsCreate a listing of all key bindings of current major mode.
C-h wM-x where-isPrint message listing key sequences that invoke the command DEFINITION.
C-h fM-x counsel-describe-functionDescribe a function in detail incl. key binding and source code. Replacement of M-x describe-function.
C-h xM-x describe-commandOnly describes commands, and not functions like its sibling below.
C-h FM-x Info-goto-emacs-command-nodeGo to the Info node in the Emacs manual for a command.
C-h aM-x apropos-commandList only the commands.
C-h vM-x counsel-describe-variableDisplay the full documentation of variable. Replacement of M-x describe-variable.
C-h jM-x counsel-set-variableAllows the setting of variable values.
C-h mM-x describe-modeDisplay documentation of current major mode and minor modes.
H-h H-h mM-x helm-describe-modesCreate a listing of all modes of current major mode.
H-h C-d mM-x discover-my-majorCreate a listing of all major-mode keys with their description.
H-h C-d MM-x discover-my-modeCreate a listing of all MODE keys with their description.
C-h lM-x counsel-find-libraryVisit a selected library elisp code.
C-h sM-x describe-syntaxDescribe the syntax specifications in the syntax table of BUFFER.
C-h PM-x describe-packageDisplay the full documentation of a package.
C-h pM-x finder-by-keywordFind packages matching a given keyworkd.
M-x infoEnter Info the documentation browser.
C-h rM-x info-manualDisplay a manual in Info mode - by default, the Emacs manual.
C-x RM-x info-display-manualDisplay an Info buffer displaying MANUAL.
C-h iM-x counsel-info-lookup-symbolOpen info reader and lookup a symbol.
C-h oM-x counsel-describe-symbolDisplay the full documentation of symbol.
M-x aproposThis command will display all symbols that match a given pattern.
C-x c aM-x helm-aproposHelm to describe commands, function, variables and faces.
C-h dM-x apropos-documentationSearches just the documentation.
M-x apropos-libraryLists all variables and functions defined in a library.
M-x apropos-user-optionShows user options available through the Customize interface.
M-x apropos-valueSearches ll symbols with a particular value.
M-x info-aproposSearch indexes of known Info files on your system for apropos PATTERN.
M-x counsel-describe-faceDisplay the properties of face FACE on FRAME.
C-h CM-x describe-coding-systemDisplay information about CODING-SYSTEM.
C-h IM-x describe-input-methodDescribe input method.
C-h LM-x describe-language-environmentDescribe how Emacs supports language environment.
C-h uM-x counsel-unicode-charInsert COUNT copies of a Unicode character at point.
H-<f1>M-x (lambda() (interactive) (browse-url psimacs/config/keybindings-html-file)))Open Psimacs keybindings as Html in default browser.
H-<f2>M-x (lambda() (interactive) (browse-url psimacs/config/init-html-file)))Open Psimacs configuration as Html in default browser.
H-S-<f1>M-x (lambda() (interactive) (eww-open-file psimacs/config/keybindings-html-file)))Open Psimacs keybindings as Html in eww.
H-S-<f2>M-x (lambda() (interactive) (eww-open-file psimacs/config/init-html-file)))Open Psimacs configuration as Html in eww.

Prefixes

Prefix commandDescription
H-SPCHydras
H-hHelp
H-ccommon user commands
H-xcommon execution commands
H-mspecial user commands

Hydras

All the hydras defined by Psimacs.

Key bindingCommandDescription
H-SPC H-SPCM-x psimacs/hydra/hydra/bodyHydras…
H-SPC SPCM-x psimacs/hydra/toggle/bodyToggles…
H-SPC aM-x psimacs/hydra/apropos/bodyApropos…
H-SPC dM-x dap-hydraDAP-Mode hydra…
H-SPC eM-x psimacs/hydra/else/bodyELSE mode hydra…
H-SPC hM-x psimacs/hydra/help/bodyHelp…
H-SPC HM-x psimacs/hydra/helpful/bodyHelpful…
H-SPC iM-x hydra-ivy/bodyIvy…
H-SPC jM-x psimacs/hydra/jupyter/open-hydraJupyter Notebook hydra…
H-SPC lM-x psimacs/hydra/lsp/bodyLSP Mode hydra…
H-SPC mM-x major-mode-hydraMajor Mode’s hydra…
H-SPC pM-x psimacs/hydra/projectile/bodyProjectile…
H-SPC tM-x psimacs/hydra/avy/bodyFast Jumping in Text…
H-SPC TM-x psimacs/hydra/transpose/bodyTransposing…
H-SPC wM-x psimacs/hydra/window/bodyWindow…
H-SPC yM-x psimacs/hydra/yasnippet/bodyYASnippet…
H-SPC C-cM-x psimacs/hydra/multiple-cursors/bodyMultiple Cursors…
H-SPC C-fM-x psimacs/hydra/flycheck/bodyFlycheck…
H-SPC C-iM-x psimacs/hydra/image+/bodyImage…
H-SPC C-lM-x psimacs/hydra/vlf-large-files/bodyLarge Files…
H-SPC C-mM-x psimacs/hydra/word-modes/bodyCamelCase…
H-SPC C-oM-x psimacs/hydra/org/bodyOrg-Mode…
H-SPC C-pM-x hydra-projectile-cmake/bodyProjectile CMake…
H-SPC C-rM-x psimacs/hydra/rectangle/bodyRectangle…
H-SPC C-sM-x psimacs/hydra/straight/bodyStraight…
H-SPC H-mM-x psimacs/hydra/navigation/bodyNavigation…

Universal, Numeric and Negative Argument

C-u or H-u runs the command universal-argument.

It is bound to C-u and H-u and it begin a numeric argument for the following command. Digits or minus sign following C-u make up the numeric argument. C-u following the digits or minus sign ends the argument. C-u without digits or minus sign provides 4 as argument. Repeating C-u without digits or minus sign multiplies the argument by 4 each time. For some commands, just C-u by itself serves as a flag that is different in effect from any particular numeric argument.

Key bindingCommandDescription
C-u H-uM-x universal-argumentBegin a numeric argument for the following command. Digits or minus sign following C-u make up the numeric argument.
C-u H-uC-u 4
C-u C-u H-u H-uC-u 16
C-0 M-0 C-M-0 H-0C-u 0Runs the command digit-argument.
C-1 M-1 C-M-1 H-1C-u 1Runs the command digit-argument.
C-2 M-2 C-M-2 H-2C-u 2Runs the command digit-argument.
C-3 M-3 C-M-3 H-3C-u 3Runs the command digit-argument.
C-4 M-4 C-M-4 H-4C-u 4Runs the command digit-argument.
C-5 M-5 C-M-5 H-5C-u 5Runs the command digit-argument.
C-6 M-6 C-M-6 H-6C-u 6Runs the command digit-argument.
C-7 M-7 C-M-7 H-7C-u 7Runs the command digit-argument.
C-8 M-8 C-M-8 H-8C-u 8Runs the command digit-argument.
C-9 M-9 C-M-9 H-9C-u 9Runs the command digit-argument.
C-- M-- C-M-- H--C-u -Runs the command negative-argument.

Basic movements

The table that follows contain the basic movement commands with their corresponding key binding. In case that Psimacs has a differing binding, the Psimacs binding is provided but the standard binding is given in the second column.

References:

Key bindingStandardCommandDescription
C-fM-x forward-charMove point forward by one character.
C-bM-x backward-charMove point backward by one character.
C-nM-x next-lineMove point forward by one line, keeping horizontal position.
C-pM-x previous-lineMove point backward by one line, keeping horizontal position.
<Left>M-x left-charProperly respect the right-to-left text.
<Rigth>M-x right-charDito.
C-aM-x move-beginning-of-lineGoto the beginning of the line.
C-eM-x move-end-of-lineGoto the end of the line.
M-<M-x beginning-of-bufferGoto the beginning of the buffer.
M->M-x end-of-bufferGoto the end of the buffer.
C-<Home>M-x beginning-of-bufferGoto the beginning of the buffer.
C-<End>M-x end-of-bufferGoto the end of the buffer.
M-g M-g M-g gM-x goto-lineGoto line number N
M-g <Tab>M-x move-to-columnMove point to column number N
M-fM-x forward-wordMove point forward by one word.
M-bM-x backward-wordMove point backward by one word.
M-{M-x forward-paragraphMove point forward by one paragraph.
M-}M-x backward-paragraphMove point backward by one paragrah.
C-<Down>M-x forward-paragraphMove point forward by one paragraph.
C-<Up>M-x backward-paragraphMove point backward by one paragrah.
C-M-fM-x forward-sexpMove point forward across one balanced expression.
C-M-bM-x backward-sexpMove point backward across one balanced expression.
M-eM-x forward-sentenceMove point forward by one sentence.
M-aM-x backward-sentenceMove point backward by one sentence.
C-vM-x scroll-up-commandMove the window to the next page. Disable cua-mode for that by pressing <f12> in Psimacs.
M-vM-x scroll-down-commandMove the window to the previous page.
<PageDown>M-x scroll-up-commandMove the window to the next page. Disable cua-mode for that by pressing <f12> in Psimacs.
<PageUp>M-x scroll-down-commandMove the window to the previous page.
C-lM-x recenter-top-bottomCenter line of point to the middle of the buffer window. Pressing it repeatedly cycles throug top, bottom and center.
C-M-lM-x reposition-windowAttempt to scroll the screen to fit as much as possible in the window.
H-m C-s sC-sM-x isearch-forwardSearch term forward and places point after the occurence.
H-m C-s rC-rM-x isearch-backwardSearch term backward and places point before the occurence.
H-sM-x psimacs/config/isearch-menuIn isearch mode, opens an isearch menu, allowing to easily utilize the functionality.
C-sM-x swiper-isearchIsearch enhanced by Ivy Swiper.
M-mM-x back-to-indentationMove point to the first non-whitespace character in the current line.
C-x C-nM-x set-goal-columnSet the current horizontal position as a goal column.
C-u C-x C-nC-u M-x set-goal-columnCleas out the goal column and resume to normal operation.

Basic selection

The fundamental selection commands with their corresponding key bindings are listed in the next table.

References:

Key bindingCommandDescription
C-SPCM-x cua-set-mark M-x set-mark-commandSet mark where point is, clear mark, or jump to mark. With no prefix argument, clear mark if already set. Otherwise, mark, and push old mark position on local mark ring; also push mark on global mark ring if last mark was set in another buffer.
C-@
C-u C-SPCM-x pop-to-mark-commandJump to mark, and pop a new position for mark off the local mark ring (this does not affect the global mark ring).
C-u C-@
H-x p
C-x C-SPCM-x pop-global-markJump to a mark off the global mark ring.
C-x C-@
H-x q
C-SPC C-SPCJumps to the next position off the local (or global) mark ring. Set the mark, pushing it onto the mark ring, without activating it.
C-u C-u C-SPCUnconditionally set mark.
C-x C-xM-x exchange-point-and-markSet mark where point is, and move point to last deactivated mark if any. Transient mark mode modifies the behaviour.
S-C-fM-x forward-char S-<Ret>Set mark where point is, and move point forward by one character, thereby creating a selection.
S-...M-x ... S-<Ret>Set mark where point is, and move point …, thereby creating a selection. Attention, this does not work for all movement command.
C-wM-x kill-regionDeletes text in region and copies it to kill ring.
M-wM-x kill-ring-saveCopies text in region to the kill ring.
C-yM-x yankPaste the most recently added text to the kill-ring at point.
M-yM-x counsel-yank-popReplace just-yanked text with former copied or killed text.
C-x C-uM-x upcase-regionConvert all charcters in region to upper case. Disable cua-mode for that by pressing <f12> in Psimacs.
C-x C-lM-x downcase-regionConvert all charcters in region to lower case. Disable cua-mode for that by pressing <f12> in Psimacs.
H-x H-x C-x C-uM-x crux-upcase-regionConvert all charcters in region to upper case when transient-mark-mode is on and region is active.
H-x H-x C-x C-lM-x crux-downcase-regionConvert all charcters in region to lower case when transient-mark-mode is on and region is active.
C-gM-x psimacs/config/keyboard-quit-dwimWhen the region is active, disable it. When a minibuffer is open, but not focused, close the minibuffer. When the Completions buffer is selected, close it.
M-@M-x mark-wordSets mark at end of next word without moving point.
C-M-@M-x mark-sexpSets mark at end of next s-expression without moving point.
M-hM-x mark-paragraphSets mark at end of next paragraph without moving point.
C-M-hM-x mark-defunMarks the whole defun under point.
C-x C-pM-x mark-pageSets mark at end of page/buffer without moving point, i.e. selecting from point to the end of the page/buffer.
C-x hM-x mark-whole-bufferMove point at the beginning of buffer, sets mark at end of buffer, i.e. selecting the whole buffer. In every other case use the regular `keyboard-quit’.”
H-x eM-x er/expand-regionExpand region intelligently.

Working with other Window

Following table with the most important commands and keybindings for working with other windows.

References:

Key bindingCommandDescription
C-x 4 .M-x xref-find-definitions-other-windowLike M-. (M-x xref-find-definitions) but switch to the other window. Find the definition of the identifier at point.
C-x 4 0M-x kill-buffer-and-windowKill the current buffer and delete the selected window.
C-x 4 1M-x same-window-prefixExecute command in same window. Display the buffer of the next command in the same window. The next buffer is the buffer displayed by the next command invoked immediately after this command
C-x 4 4M-x other-window-prefixExecute command in new window. Display the buffer of the next command in a new window. The next buffer is the buffer displayed by the next command invoked immediately after this command
C-x 4 aM-x add-change-log-entry-other-windowFind change log file in other window and add entry and item. This is just like add-change-log-entry except that it displays the change log file in another window.
C-x 4 bM-x switch-to-buffer-other-windowSwitch to another buffer in another window.
C-x 4 cM-x clone-indirect-buffer-other-windowCreate an indirect buffer that is a twin copy of the current buffer in other window.
C-x 4 dM-x dired-other-windowEdit directory DIRNAME (M-x dired) – delete, rename, print, etc. some files in it, but in other window.
C-x 4 fM-x find-file-other-windowEdit file FILENAME, in another window.
C-x 4 mM-x compose-mail-other-windowLike C-x m (M-x compose-mail). Start composing a mail message to send, but edit the outgoing message in another window.
C-x 4 pM-x project-other-window-commandRun project command, displaying resultant buffer in another window.
C-x 4 rM-x find-file-read-only-other-windowEdit file FILENAME, in another window, but don’t allow changes.
C-x 4 C-fM-x find-file-other-windowEdit file FILENAME, in another window.
C-x 4 C-jM-x dired-jump-other-windowJump to Dired buffer, in other window, corresponding to current buffer. If in a buffer visiting a file, Dired that file’s directory and move to that file’s line in the directory listing.
C-x 4 C-oM-x display-bufferDisplay BUFFER-OR-NAME in some window, without selecting it.

Working with other Frame

Following table with the most important commands and keybindings for working with other frames.

References:

Key bindingCommandDescription
C-x 5 .M-x xref-find-definitions-other-frameLike M-. (M-x xref-find-definitions) but switch to the other frame. Find the definition of the identifier at point.
C-x 5 0M-x delete-frameDelete FRAME, eliminating it from use. See also undelete-frame-mode.
C-x 5 1M-x delete-other-frameDelete all frames except FRAME (default: selected frame).
C-x 5 2M-x make-frame-commandMake a new frame, on the same terminal as the selected frame.
C-x 5 5M-x other-frame-prefixExecute command in other frame. Display the buffer of the next command in a new frame. The next buffer is the buffer displayed by the next command invoked immediately after this command.
C-x 5 bM-x switch-to-buffer-other-frameSwitch to another buffer in another frame.
C-x 5 cM-x clone-frameMake and select a new frame with the same parameters as FRAME.
C-x 5 dM-x dired-other-frameEdit directory DIRNAME (M-x dired) – delete, rename, print, etc. some files in it, but in other frame.
C-x 5 fM-x find-file-other-frameEdit file FILENAME, in another frame.
C-x 5 mM-x compose-mail-other-frameLike C-x m (M-x compose-mail). Start composing a mail message to send, but edit the outgoing message in another frame.
C-x 5 oM-x other-frameSelect the ARGth different visible frame on current display, and raise it. All frames are arranged in a cyclic order.
C-x 5 pM-x project-other-frame-commandRun project command, displaying resultant buffer in another frame.
C-x 5 rM-x find-file-read-only-other-frameEdit file FILENAME, in another frame, but don’t allow changes.
C-x 5 uM-x undelete-frameUndelete a frame deleted with M-x delete-frame.
C-x 5 C-fM-x find-file-other-frameEdit file FILENAME, in another frame.
C-x 4 C-oM-x display-buffer-other-frameDisplay buffer BUFFER preferably in another frame. This function attempts to look for a window displaying BUFFER, on all the frames on the current terminal, skipping the selected window; if that fails, it pops up a new frame.

Registers

Emacs registers are compartments where you can save text, rectangles, positions, and other things for later use.

In the following table Chr is any single key character.

Reference: Registers

Key bindingCommandDescription
M-x view-register RET ChrDisplay a description of what register Chr contains.
C-x r SPC ChrM-x point-to-register RET ChrRecord the position of point and the current buffer in register Chr.
C-x r SPC r ChrM-x point-to-register RET ChrSaves both the position of point and the current buffer in register Chr.
C-x r j ChrM-x jump-to-register RET ChrJump to the position and buffer saved in register Chr.
C-x r s ChrM-x copy-to-register RET ChrCopy region into register Chr.
C-u C-x r s ChrC-u M-x copy-to-register RET ChrCopies the text into register Chr and deletes the text from the buffer as well.
C-x r i ChrM-x insert-register RET ChrInsert text from register Chr.
M-x append-to-register RET ChrAppend region to text in register Chr.
C-u M-x append-to-register RET ChrAppend region to text in register Chr and deletes the text from the buffer as well.
C-x r + ChrM-x increment-register RET ChrWhen register Chr contains text, use this command to append to that register.
M-x prepend-to-register RET ChrPrepend region to text in register Chr.
C-x r r ChrM-x copy-rectangle-to-register RET ChrCopy the region-rectangle into register Chr. With prefix argument, delete it as well.
C-x r i ChrM-x insert-register RET ChrInsert the rectangle stored in register Chr (if it contains a rectangle).
C-x r w ChrM-x window-configuration-to-register RET ChrSave the state of the selected frame’s windows in register Chr.
C-x r f ChrM-x frameset-to-register RET ChrSave the state of all frames, including all their windows, in register Chr.
C-x r j ChrM-x jump-to-register RET ChrTo restore a window or frame configuration stored in register Chr. When you restore a frame configuration, any existing frames not included in the configuration become invisible.
C-u C-x r j ChrC-u M-x jump-to-register RET ChrUse Prefix to also delete pre-existing frames.
C-x C-k x ChrM-x kmacro-to-register RET ChrStores the last keyboard macro in register Chr.
C-x r j ChrM-x jump-to-register RET ChrTo execute the keyboard macro in register Chr.

Bookmarks

Bookmarks are somewhat like registers in that they record positions you can jump to. Unlike registers, they have long names, and they persist automatically.

Reference: Bookmarks

Key bindingCommandDescription
C-x r mM-x bookmark-set RETSet the bookmark for the visited file, at point.
C-x r m BookmarkM-x bookmark-set Bookmark RETSet the bookmark named Bookmark at point.
C-x r M BookmarkM-x bookmark-set-no-overwrite Bookmark RETLike C-x r m, but don’t overwrite an existing bookmark.
C-x r b BookmarkM-x bookmark-jump Bookmark RETJump to the bookmark named Bookmark.
C-x r lM-x list-bookmarksList all bookmarks.
M-x bookmark-saveSave all the current bookmark values in the default bookmark file.
M-x bookmark-write RET Filename RETSave all the current bookmark values in the file Filename.
M-x bookmark-load RET Filename RETLoad a file named Filename that contains a list of bookmark values. You can use this command, as well as bookmark-write, to work with other files of bookmark values in addition to your default bookmark file.
M-x bookmark-delete RET Bookmark RETDelete the bookmark named Bookmark.
M-x bookmark-insert-location RET Bookmark RETInsert in the buffer the name of the file that bookmark Bookmark points to.
M-x bookmark-insert RET Bookmark RETInsert in the buffer the contents of the file that bookmark Bookmark points to.

Useful commands

In the following, a table is provided that contains useful commands and their key bindings. The list is not exhaustive, but contains just bindings and commands that I did not know about beforhand or that I might forget about in the future.

Key bindingCommandDescription
C-x zM-x repeatRepeat the most recently executed command. After first execution pressing key z repeats the command further.
C-x M-:M-x repeat-complex-commandEdit and re-evaluate last complex command, or ARGth from last. A complex command is one that used the minibuffer.
M-x view-lossageDisplay last few input keystrokes and the commands run.
C-x C--C-u -1 M-x zoom-outDecrease the default face height by one step.
C-x C-+C-u +1 M-x zoom-inIncrease the default face height by one step.
C-x C-0C-u 0 M-x zoom-frm-unzoomReset the default face height to the global default.

Buffer Handling in Psimacs

Psimacs defines some buffer toggle commands of its own.

Key bindingCommandDescription
C-TABM-x psimacs/buffer/next-user-bufferSwitch to the next user buffer. Buffer name starts with *, it’s not considered a user buffer.
C-S-TABM-x psimacs/buffer/previous-user-bufferSwitch to the previous user buffer. Buffer name starts with *, it’s not considered a user buffer.
H-TABM-x psimacs/buffer/next-emacs-bufferSwitch to the next emacs buffer, i.e. that starts with *.
H-S-TABM-x psimacs/buffer/previous-emacs-bufferSwitch to the previous emacs buffer, i.e. that starts with *.
C-x <right>M-x next-bufferSwitch to the next buffer.
C-x <left>M-x previous-bufferSwitch to the previous buffer.

Tab Bar Mode

A tab is a window configuration. In Emacs, a window configuration is a collection of windows – size, location, the buffer, and so on – that captures the layout of your Emacs frame.

Remarks: With option tab-bar-show it is possible to hide the tab-bar, but still benefit from all the capabilitties of the tab bar.

References:

Key bindingCommandDescription
M-x tab-bar-modeToggle the tab bar in all graphical frames.
C-x t RETM-x tab-switchSwitch to the tab by NAME.
C-x t 0M-x tab-closeClose the current tab.
C-x t 1M-x tab-close-otherClose all tabs on the selected frame, except the tab TAB-NUMBER.
C-x t 2M-x tab-newCreate a new tab ARG positions to the right.
C-x t ^ fM-x tab-detachMove tab number FROM-NUMBER to a new frame.
C-x t bM-x switch-to-buffer-other-tabSwitch to buffer BUFFER-OR-NAME in another tab.
C-x t dM-x dired-other-tabEdit directory DIRNAME. Like M-x dired but make a new tab.
C-x t fM-x find-file-other-tabEdit file FILENAME, in another tab.
C-x t GM-x tab-groupAdd the tab specified by its absolute position TAB-NUMBER to GROUP-NAME. If no TAB-NUMBER is specified, then set the GROUP-NAME for the current tab. Interactively, TAB-NUMBER is the prefix numeric argument, and the command prompts for GROUP-NAME.
C-x t MM-x tab-move-toMove tab from FROM-NUMBER position to new position at TO-NUMBER.
C-x t mM-x tab-moveMove the current tab ARG positions to the right.
C-x t NM-x tab-new-toAdd a new tab at the absolute position TAB-NUMBER.
C-x t nM-x tab-duplicateClone the current tab to ARG positions to the right.
C-x t OM-x tab-previousSwitch to ARGth previous tab.
C-x t oM-x tab-nextSwitch to ARGth next tab.
C-x t pM-x project-other-tab-commandRun project command, displaying resultant buffer in a new tab.
C-x t rM-x tab-renameGive the tab specified by its absolute position TAB-NUMBER a new NAME.
C-x t tM-x other-tab-prefixExecute command in other tab. Display the buffer of the next command in a new tab. The next buffer is the buffer displayed by the next command invoked immediately after this command.
C-x t uM-x tab-undoRestore the most recently closed tab.
C-x t C-fM-x find-file-other-tabEdit file FILENAME, in another tab.
C-x t C-rM-x find-file-read-only-other-tabEdit file FILENAME, in another tab, but don’t allow changes.
M-x tab-listDisplay a list of named window configurations.
M-x tab-recentSwitch to ARGth most recently visited tab.

Working with Info

This is just a brief overview over the most important Info commands:

Key bindingCommandDescription
H-SPC h iM-x infoEnter Info the documentation browser.

Inside Info the following commands are useful:

Key bindingCommandDescription
?Provide brief list of commands in Info.
qQuit info.
C-lRedisplay
M-x visible-modeShow or hide invisible text.
b eJump to beginning or end of node text
gGo to node if node’s name is given, e.g. gGo to Node<ret>, g(dir)Top<ret>, g(emacs)Top<ret>, g*<ret>, g(FILENAME)*<ret>.
n pGo to next or previous node at same level.
SPC BACKSPCMove forward or backward in node and might move to next or previous logical node.
] [Move to next or previous logical node.
dM-x Info-directoryGo to directory node.
tM-x Info-top-nodeGo to current manual top node, i.e. gTop<ret>
mGo to subnode found in node’s menu.
19Go to N-th subnode found in node’s menu.
0Go to last subnode found in node’s menu.
uGo to parent node.
<tab> S-<tab>Go to next or previous node menu entry or cross reference.
fFollow cross reference.
l rMove backward or forward in the node and cross reference history list.
LCreate a virtual node with menu of all nodes visited.
sSearch info file text for string.
C-s C-rIncremental search forward or backward info file text.
iSearches the index for string.
,After i, visit additional index entries which match.
IM-x Info-virtual-indexConstruct a virtual info node displaying results of an index search.
M-x index-aproposSearch in all the indices of all the Info documents known by the system.
M-nM-x clone-bufferCreate and return a twin copy of the current buffer, i.e. a new Info-buffer from the current node.
C-u m C-u gGo to new Info-buffer in another window.
M-x info-display-manualShow the Info manual by name.
C-u M-x info-display-manualShow the Info manual by name, but limits the completion alternatives to currently visited info files.

Debugging ELisp with Debug

Emacs has two debuggers, Debug and Edebug. The first is built into the internals of Emacs and is always with you; the second requires that you instrument a function before you can use it.

You can enter the debugger when you call the function by calling debug-on-entry, e.g. M-x debug-on-entry RET my-function RET. To cancel the effect of debug-on-entry, call cancel-debug-on-entry with the same function name.

Since a break is a recursive edit, all the usual editing facilities of Emacs are available; you can even run programs that will enter the debugger recursively.

If you want errors to enter the debugger, set the variable debug-on-error to non-nil. However, if variable eval-expression-debug-on-error is non-nil, then debug-on-error is set to t in case of running command eval-expression.

The most used commads are the following. For more detail see Debugger Commands.

Key bindingDescription
cExit the debugger and continue execution.
qTerminate the program being debugged; return to top-level Emacs command execution.
dContinue execution, but enter the debugger the next time any Lisp function is called.
lDisplay a list of functions that will invoke the debugger when called. This is a list of functions that are set to break on entry by means of debug-on-entry.
eRead a Lisp expression in the minibuffer, evaluate it.

Debugging ELisp with Edebug

Edebug is a source-level debugger for Emacs Lisp programs that is very useful developing Lisp code. In the following you can find some useful commands and settings for debugging with Edebug:

  • Using Edebug: To debug a Lisp program with Edebug, you must first instrument the Lisp code that you want to debug. A simple way to do this is to first move point into the definition of a function or macro and then do C-u C-M-x.
  • Embedding a breakpoint into source code: (edebug)

References:

Key bindingCommandDescription
H-m C-f C-fM-x find-functionFind the definition of function near point
C-u C-M-xM-x edebug-defunInstrument the Lisp code at point. Any call to the function activates Edebug.
C-M-xM-x eval-defunUndo instrumentation.
hM-x edebug-goto-hereProceed to the stop point near where point is.
fM-x edebug-forward-sexpRun the program for one expression.
oM-x edebug-step-outRun the program until the end of the containing sexp.
iM-x edebug-step-inStep into the function or macro called by the form after point.
bM-x edebug-set-breakpointSet a breakpoint at the stop point at or after point. If you use a prefix argument, the breakpoint is temporary – it turns off the first time it stops the program.
uM-x edebug-unset-breakpointUnset the breakpoint (if any) at the stop point at or after point.
UM-x edebug-unset-breakpointsUnset any breakpoints in the current form.
DM-x edebug-toggle-disable-breakpointToggle whether to disable the breakpoint near point.
x condition RETM-x edebug-set-conditional-breakpointSet a conditional breakpoint which stops the program only if evaluating condition produces a non-nil value.
BM-x edebug-next-breakpointMove point to the next breakpoint in the current definition.
SM-x edebug-stopStop: don’t execute any more of the program, but wait for more Edebug commands
SPCM-x edebug-step-modeStep: stop at the next stop point encountered.
nM-x edebug-next-modeNext: stop at the next stop point encountered after an expression.
tM-x edebug-trace-modeTrace: pause (normally one second) at each Edebug stop point.
TM-x edebug-Trace-fast-modeRapid trace: update the display at each stop point, but don’t actually pause.
gM-x edebug-go-modeGo: run until the next breakpoint.
cM-x edebug-continue-modeContinue: pause one second at each breakpoint, and then continue.
CM-x edebug-Continue-fast-modeRapid continue: move point to each breakpoint, but don’t pause.
GM-x edebug-Go-nonstop-modeGo non-stop: ignore breakpoints. You can still stop the program by typing S, or any editing command.
?M-x edebug-helpDisplay the help message for Edebug.
C-]M-x abort-recursive-editAbort one level back to the previous command level
qM-x top-levelReturn to the top level editor command loop. This exits all recursive editing levels, including all levels of Edebug activity.
QM-x edebug-top-level-nonstopLike q, but don’t stop even for protected code. Like q, but don’t stop even for protected code.
rM-x edebug-previous-resultRedisplay the most recently known expression result in the echo area.
dM-x edebug-pop-to-backtraceDisplay the current backtrace in a backtrace-mode window
vM-x edebug-view-outsideSwitch to viewing the outside window configuration. Type C-x X w to return to Edebug.
pM-x edebug-bounce-pointTemporarily display the outside current buffer with point at its outside position, pausing for one second before returning to Edebug. With a prefix argument n, pause for n seconds instead.
wM-x edebug-whereMove point back to the current stop point in the source code buffer.
WM-x edebug-toggle-save-windowsToggle whether Edebug saves and restores the outside window configuration.
e exp RETM-x edebug-eval-expressionEvaluate expression exp in the context outside of Edebug. That is, Edebug tries to minimize its interference with the evaluation.
M-: exp RETM-x eval-expressionEvaluate expression exp in the context of Edebug itself.
C-x C-eM-x edebug-eval-last-sexpEvaluate the expression before point, in the context outside of Edebug.
C-u 0 C-x C-eC-u 0 M-x edebug-eval-last-sexpDito, but don’t shorten long items (like strings and lists).
EM-x edebug-visit-eval-listSwitch to the evaluation list buffer edebug
C-jM-x edebug-eval-print-last-sexpEvaluate the expression before point, in the outside context, and insert the value in the buffer.
C-u 0 C-jC-u 0 M-x edebug-eval-print-last-sexpDito, but don’t shorten long items (like strings and lists).
C-c C-uM-x edebug-update-eval-listBuild a new evaluation list from the contents of the buffer.
C-c C-dM-x edebug-delete-eval-itemDelete the evaluation list group that point is in.
C-c C-wM-x edebug-whereSwitch back to the source code buffer at the current stop point.

References to Emacs Lisp

The following links might be useful for diving deeper into Elisp:

Startup frame size and position

Psimacs provides three simple strategies for positioning and sizing new frames. These strategies can be activated by the following functions.

Key bindingCommandDescription
H-m C-w C-x 5 lM-x psimacs/window/set-frame-creation-strategy-layoutPlace and size new frames left and right to the main frame. This is the default strategy.
H-m C-w C-x 5 mM-x psimacs/window/set-frame-creation-strategy-mainAlways use the same placement and size as the initial main frame.
H-m C-w C-x 5 sM-x psimacs/window/set-frame-creation-strategy-systemLet Emacs and the operating system decide.

MSYS2 Packages

Pacman queries the local package database with the -Q flag, the sync database with the -S flag and the files database with the -F flag. See pacman -Q --help, pacman -S --help and pacman -F --help for the respective suboptions of each flag.

Most important commands taken from

CommandDescription
pacman -SyuSynchronizes the repository databases and updates the system’s packages, excluding “local” packages that are not in the configured repositories.
pacman -SyuuSynchronizes the repository databases and updates packages. Repeat this step until it says there are no packages to update.
pacman -S <name>Install package.
pacman -R <name>Uninstall package.
pacman -Q --helpGet help about the sub options for local package database access.
pacman -S --helpGet help about the sub options for sync database access.
pacman -F --helpGet help about the sub options for files database access.
pacman -Ss <string>Search for packages in the database, searching both in packages’ names and descriptions.
pacman -Qs <string>To search for already installed packages.
pacman -F <string>To search for package file names in remote packages
pacman -Si <package>To display extensive information about a given package.
pacman -Qi <package>For locally installed packages.
pacman -Qe <package>To retrieve a list of all installed packages.
pacman -Ql <package>To retrieve a list of the files installed by a package.

Detail startup benchmarking

This is a simple benchmark of calls to Emacs require and load functions. It can be used to keep track of where time is being spent during Emacs startup in order to optimize startup times.

Usage: The following commands and functions can be used to govern the benchmarking.

Command
M-x benchmark-init/show-durations-tabulated
M-x benchmark-init/show-durations-tree
M-x benchmark-init/activate
M-x benchmark-init/deactivate

References to benchmarking:

Make C-g a bit more helpful

C-g should behave more then expected:

  • When the region is active, disable it.
  • When a minibuffer is open, but not focused, close the minibuffer.
  • When the Completions buffer is selected, close it.
  • In every other case use the regular `keyboard-quit’.”
Key bindingCommandDescription
C-gM-x psimacs/config/keyboard-quit-dwimQuit or abort.

Cancels All

Call command keyboard-escape-quit immediately on pressing key H-g.

See also:

Key bindingCommandDescription
H-gM-x keyboard-escape-quitQuit or abort.

HTML Documentation

Provide keybindings for conveniently access of the Psimacs HTML documentation and keybindings.

Key bindingCommandDescription
H-<f1>M-x (lambda() (interactive) (browse-url psimacs/config/keybindings-html-file)))Open Psimacs keybindings as Html in default browser.
H-<f2>M-x (lambda() (interactive) (browse-url psimacs/config/init-html-file)))Open Psimacs configuration as Html in default browser.
H-S-<f1>M-x (lambda() (interactive) (eww-open-file psimacs/config/keybindings-html-file)))Open Psimacs keybindings as Html in eww.
H-S-<f2>M-x (lambda() (interactive) (eww-open-file psimacs/config/init-html-file)))Open Psimacs configuration as Html in eww.

Printing on Windows

Psimacs currently supports two sets of commands for printing on windows:

Key bindingCommandDescription
H-m C-p C-p bM-x print-bufferB/W print hardcopy of buffer on default printer
H-m C-p C-p rM-x print-regionB/W print hardcopy of region on default printer
H-m C-p C-q pM-x ps-print-bufferB/W print buffer via Ghostscript
H-m C-p C-q rM-x ps-print-regionB/W print region via Ghostscript
H-m C-p C-f pM-x ps-print-buffer-with-facesColor print buffer via Ghostscript
H-m C-p C-f rM-x ps-print-region-with-facesColor print region via Ghosts

Encoding system

Key bindingCommandDescription
M-x revert-buffer-with-coding-system
M-x set-buffer-file-coding-system
M-x describe-coding-systemInformation about coding system.
M-x list-coding-systems
M-x find-file-literallyOpen file without any conversion.
C-x RET cM-x universal-coding-system-argument=Ttakes as an argument the coding system you want to use, and a command to execute it with. That makes it possible to open files, shells or run Emacs commands as though you were using a different coding system.

Smooth Scrolling

The smooth-scrolling package offers a minor mode which make emacs scroll smoothly. It keeps the point away from the top and bottom of the current buffer’s window in order to keep lines of context around the point visible as much as possible, whilst minimising the frequency of sudden scroll jumps which are visually confusing.

You can toggle the smooth-scrolling-mode with the following command.

Key bindingCommandDescription
H-m C-w C-s sM-x smooth-scrolling-modeEnable or disable the smooth scrolling mode.

Mark and Pop

Handy way of getting back to previous places.

Immediately after you type C-u C-SPC, you can type C-SPC instead of C-u C-SPC to cycle through the mark ring.

From the Emacs Manual: The Mark Ring:

Each buffer remembers previous locations of the mark, in the mark ring. Commands that set the mark also push the old mark onto this ring. One of the uses of the mark ring is to remember spots that you may want to go back to.

Key bindingCommandDescription
C-SPC C-@M-x cua-set-mark M-x set-mark-commandSet mark where point is, clear mark, or jump to mark. With no prefix argument, clear mark if already set. Otherwise, mark, and push old mark position on local mark ring; also push mark on global mark ring if last mark was set in another buffer.
C-u C-SPC C-u C-@ H-x pM-x pop-to-mark-commandJump to mark, and pop a new position for mark off the local mark ring (this does not affect the global mark ring).
C-x C-SPC C-x C-@ H-x qM-x pop-global-markJump to a mark off the global mark ring.
C-SPC C-SPCJumps to the next position off the local (or global) mark ring. Set the mark, pushing it onto the mark ring, without activating it.
C-u C-u C-SPCUnconditionally set mark.

If you set set-mark-command-repeat-pop to non-nil, then immediately after you type C-u C-SPC, you can type C-SPC instead of C-u C-SPC to cycle through the mark ring.

Indentation and Tab stops

Electric Indent mode is a global minor mode that automatically indents the line after every RET you type. This mode is enabled by default, which we turn off.

Use instead:

Key bindingCommandDescription
C-jM-x newline-and-indentIndent current line

Do not use tab characters -> fill spaces instead. Insert a real tab character with C-q TAB.

Key bindingCommandDescription
C-q TABM-x quoted-insertRead next input character (TAB) and insert it. This is useful for inserting control characters.

Fill column indicator

Emacs allows to display boundaries. Psimacs uses this to show an indicator at the fill column position. The default fill column is set to 120 characters because huge displays are now commonly in use.

Key bindingCommandDescription
H-m C-m C-v fM-x global-display-fill-column-indicator-modeToggle the display of the fill column indicator.

Symbol overlay mode

The package Symbol Overlay highlight symbols with overlays while providing a keymap for various operations about highlighted symbols. It was originally inspired by the package highlight-symbol. The fundamental difference is that in symbol-overlay every symbol is highlighted by the Emacs built-in function overlay-put rather than the font-lock mechanism used in highlight-symbol. On start up the symbol-overlay-mode is not activated.

Additionally, the package symbol-overlay-mc is a tiny Emacs package enabling multiple cursors on symbol overlays.

Key bindingCommandDescription
H-x H-s mM-x symbol-overlay-modeToggle the automatic symbol highlight. This is disabled on default.
H-x H-s iM-x symbol-overlay-putToggle all overlays of symbol at point.
H-x H-s aM-x symbol-overlay-mc-mark-allplace a cursor on every symbol currently highlighted.
H-x H-s xM-x symbol-overlay-remove-allRemove all highlighted symbols in the buffer.
H-x H-s bM-x symbol-overlay-switch-backwardSwitch backward to another symbol.
H-x H-s fM-x symbol-overlay-switch-forwardSwitch forward to another symbol.
H-x H-s hM-x symbol-overlay-map-helpDisplay the bindings in ‘symbol-overlay-map’.

The bindings in ‘symbol-overlay-map’ that are active when the cursor points a highlighted symbol.

Key bindingCommandDescription
H-x H-s iM-x symbol-overlay-putToggle all overlays of symbol at point.
H-x H-s nM-x symbol-overlay-jump-nextJump to the next location of symbol at point.
H-x H-s pM-x symbol-overlay-jump-prevJump to the previous location of symbol at point.
H-x H-s <M-x symbol-overlay-jump-firstJump to the first location of symbol at point.
H-x H-s >M-x symbol-overlay-jump-lastJump to the last location of symbol at point.
H-x H-s wM-x symbol-overlay-save-symbolCopy symbol at point.
H-x H-s tM-x symbol-overlay-toggle-in-scopeToggle overlays to be showed in buffer or only in scope.
H-x H-s eM-x symbol-overlay-echo-markJump back to the mark.
H-x H-s dM-x symbol-overlay-jump-to-definitionJump to the definition of symbol at point.
H-x H-s sM-x symbol-overlay-isearch-literallyIsearch symbol at point literally.
H-x H-s qM-x symbol-overlay-query-replaceQuery replace symbol at point.
H-x H-s rM-x symbol-overlay-renameRename symbol at point on all its occurrences.

Theming

Key bindingCommandDescription
M-x counsel-load-themeAllows easily switching of themes.
Theme
ef-symbiosis
modus-vivendi
modus-operandi
nimbus
kaolin-valley-dark
vscode-dark-plus
alect-dark
alect-light-alt
sanityinc-tomorrow-eighties
moe-dark

Prettify-Symbols-Mode

When prettify-symbols-mode and font-locking are enabled, symbols are prettified. Psimacs defines list of symbols for various programming modes.

Currently the greek characters are supported for all programming modes and additionally some extra symbols are defined for the Python programming mode.

See also: About prettify-symbols-mode

Key bindingCommandDescription
H-m C-x C-pM-x prettify-symbols-modeToggle prettify-symbols-mode.
<f8>M-x prettify-symbols-modeToggle prettify-symbols-mode.
M-<f8>M-x global-prettify-symbols-modeToggle prettify-symbols-mode globally.

Rainbow delimiters

The package rainbow-delimiters highlights delimiters such as parentheses, brackets or braces according to their depth. Each successive level is highlighted in a different color. This makes it easy to spot matching delimiters, orient yourself in the code, and tell which statements are at a given depth.

See also:

Key bindingCommandDescription
H-m C-p C-r C-pM-x psimacs/pair/rainbow-toggle-sized-delimitersToggle the size of the rainbow-delimiters.
H-m C-p C-r M-C-pM-x psimacs/pair/rainbow-sized-delimitersAll rainbow delimiters have various heights.
H-m C-p C-r S-C-pM-x psimacs/pair/rainbow-non-sized-delimitersAll rainbow delimiters have the same height. This is the default.
M-x psimacs/pair/rainbow-toggle-theme-is-light-coloredToggle the rainbow delimiters colors with respect to light or dark themes.

History

Package savehist automatically save minibuffer, kill-ring, search-ring and regexp-search-ring histories to a file. It also deletes duplicates entries.

Package savehist.el is available on emacs-mirror.

Key bindingCommandDescription
H-m C-c C-h(find-file-read-only history-file)Open the history file in read-only mode.

Recent files

Recentf-mode is a minor mode that builds a list of recently opened files. This list is automatically saved across sessions on exiting Emacs - you can then access this list through the command C-x C-r.

Key bindingCommandDescription
H-x rM-x recentf-open-filesShow a dialog to open a recent file.
H-x C-rM-x recentf-open-more-filesShow a dialog to open a recent file that is not in the menu.
H-x fM-x counsel-recentfFind a file on recent file list.
H-x C-fM-x counsel-buffer-or-recentfFind a buffer visiting a file or file on recent file list.
H-x C cM-x recentf-cleanupCleanup the recent file list.
H-x C C-cM-x psimacs/config/recentf-cleanup-directory-filesRemove all files of DIR from recent file list.

Undo-Redo

The package undo-fu provides a simple, stable linear undo with redo for Emacs.

This is a light weight wrapper for Emacs built-in undo system, adding convenient undo/redo without losing access to the full undo history, allowing you to visit all previous states of the document if you need. The changes compared Emacs undo are as follows:

  • Redo will not pass the initial undo action.
  • Redo will not undo (unlike Emacs redo which traverses previous undo/redo steps).
  • These constraints can be temporarily disabled by pressing C-g before undo or redo.

Note that this doesn’t interfere with Emacs internal undo data, which can be error prone.

The default Emacs undo has two limitations this package aims to resolve,

  • Two actions are required to initiate redo.
  • It’s easy to accidentally redo past the point where undo started making it inconvenient to restore the document to the point when undo began.
Key bindingCommandDescription
C-zM-x undo-fu-only-undoUndo the last action.
C-S-zM-x undo-fu-only-redoRedo an action until the initial undo action.
H-m C-zM-x undo-fu-only-redo-allRedo all actions until the initial undo step.

References to undo/redo packages:

PackageRemark
CUA modeProvides undo/redo binding. Disabled for Psimacs.
undo-treeInstead of treating undo/redo as a linear sequence of changes, undo-tree-mode treats undo history as a branching tree of changes.
undo-fu-sessionSave & recover undo steps between Emacs sessions.

Helpful

The package helpful is an alternative to the built-in Emacs help that provides much more contextual information.

Psimacs do not change the default bindings for the describe- commands. Instead the helpful commands are provided in the additional H-h key map for help topics.

References:

It provides the following commands:

Key bindingCommandDescription
H-h fM-x helpful-callableShow help for function, macro or special form named SYMBOL.
H-h FM-x helpful-functionShow help for function named SYMBOL.
H-h MM-x helpful-macroShow help for macro named SYMBOL.
H-h cM-x helpful-commandShow help for interactive function named SYMBOL.
H-h kM-x helpful-keyShow help for interactive command bound to KEY-SEQUENCE.
H-h vM-x helpful-variableShow help for variable named SYMBOL.
H-h pM-x helpful-at-pointShow help for the symbol at point.

Edit region indirectly in another buffer

The package edit-indirect is a useful enhancement for editing. It provides a command edit-indirect-region that allows the editing of a region in a separate buffer.

The region is copied, without text properties, to a separate buffer, called edit-indirect buffer. The major is guessed.

After finishing the editing the command edit-indirect-commit replaces the original region with the content of the edit-indirect buffer. Alternatively, the command edit-indirect-abort drops the modification and leaves the region unchanged. Very useful!

Key bindingCommandDescription
H-c C-eM-x edit-indirect-regionEdit region in separate buffer edit-indirect buffer
C-c C-cM-x edit-indirect-commitCommit the modification done in edit-indirect buffer
C-c C-kM-x edit-indirect-abort=Abort indirect editing; kill buffer edit-indirect buffer
C-x C-sM-x edit-indirect-saveReplace the original region in the parent buffer with the contents of the edit-indirect buffer.

Insert brackets by pair

Some convenience functions that use the psimacs/pair/insert-bracket-pair function.

Additionally, Psimacs provides the following key bindings:

Key bindingCommandDescription
H-m (M-x psimacs/pair/insert-parenInsert paranthesis (▮).
H-m [M-x psimacs/pair/insert-bracketInsert brackets [▮].
H-m {M-x psimacs/pair/insert-braceInsert braces {▮}.
H-m "M-x psimacs/pair/insert-ascii-double-quoteInsert ascii double quotes "▮".
H-m 'M-x psimacs/pair/insert-ascii-single-quoteInsert ascii single quotes '▮'.
H-m eM-x psimacs/pair/insert-emacs-quoteInsert emacs quotes `▮'.
H-m =M-x psimacs/pair/insert-equalInsert equality signs ==▮==.
H-m *M-x psimacs/pair/insert-starInsert stars *▮*.
H-m /M-x psimacs/pair/insert-slashInsert slashes /▮/.

Smart parenthesis

The package smartparens is minor mode for Emacs that deals with parens pairs and tries to be smart about them.

Psimacs does have the show-paren-mode active on default. With the command M-x psimacs/activate/toggle-smartparens-paren-mode which is bound to H-m C-p C-s t you can easily toggle between global smartparens-mode and show-paren-mode.

Documentation: Welcome to Smartparens’s documentation!

See also:

Psimacs provides the following key bindings for active smartparens-mode:

Key bindingCommandDescription
H-m C-p C-s tM-x psimacs/activate/toggle-smartparens-paren-modeToggle between smartparens-mode and show-paren-mode.
H-p C-fM-x sp-forward-sexpMove forward across one balanced expression.
H-p C-bM-x sp-backward-sexpMove backward across one balanced expression.
H-p M-FM-x sp-forward-symbolMove point to the next position that is the end of a symbol.
H-p M-BM-x sp-backward-symbolMove point to the next position that is the beginning of a symbol.
H-p C-nM-x sp-next-sexpMove forward to the beginning of next balanced expression.
H-p C-pM-x sp-previous-sexpMove backward to the end of previous balanced expression.
H-p C-uM-x sp-up-sexpMove forward out of one level of parentheses.
H-p C-dM-x sp-down-sexpMove forward down one level of sexp.
H-p M-uM-x sp-backward-up-sexpMove backward out of one level of parentheses.
H-p M-dM-x sp-backward-down-sexpMove backward down one level of sexp.
H-p C-aM-x sp-beginning-of-sexpJump to beginning of the sexp the point is in.
H-p C-eM-x sp-end-of-sexpJump to end of the sexp the point is in.
H-p M-aM-x sp-beginning-of-next-sexpJump to beginning of the next sexp on the same depth.
H-p M-eM-x sp-beginning-of-previous-sexpJump to beginning of the previous sexp on the same depth.
H-p C-tM-x sp-transpose-sexpTranspose the expressions around point.
H-p M-tM-x sp-transpose-hybrid-sexpTranspose the hybrid sexps around point.
H-p C-jM-x sp-join-sexpJoin the sexp before and after point if they are of the same depth.
H-p C-vM-x sp-convolute-sexpConvolute balanced expressions.
H-p C-iM-x sp-indent-defunReindent the current defun.
H-p C-mM-x sp-mark-sexpSet mark ARG balanced expressions from point.
H-p C-kM-x sp-kill-sexpKill the balanced expression following point.
H-p M-wM-x sp-copy-sexpCopy the following ARG expressions to the kill-ring.
H-p M-DELM-x sp-unwrap-sexpUnwrap the following expression.
H-p M-BCKM-x sp-backward-unwrap-sexpUnwrap the previous expression.
H-p C-<right>M-x sp-forward-slurp-sexpAdd sexp following the current list in it by moving the closing delimiter.
H-p C-<left>M-x sp-backward-slurp-sexpAdd the sexp preceding the current list in it by moving the opening delimiter
H-p M-<right>M-x sp-forward-barf-sexpRemove the last sexp in the current list by moving the closing delimiter.
H-p M-<left>M-x sp-backward-barf-sexpThis is exactly like calling ‘sp-forward-barf-sexp’ with minus ARG.
H-p M-DM-x sp-splice-sexpUnwrap the current list.
H-p C-M-DELM-x sp-splice-sexp-killing-forwardUnwrap the current list and kill all the expressions between.
H-p C-M-BCKM-x sp-splice-sexp-killing-backwardUnwrap the current list and kill all the expressions.
H-p C-S-BCKM-x sp-splice-sexp-killing-aroundUnwrap the current list and kill everything inside except next expression.
H-p C-s NM-x sp-select-next-thing-exchangeJust like sp-select-next-thing but run exchange-point-and-mark afterwards.
H-p C-s nM-x sp-select-next-thingSet active region over next thing as recognized by ‘sp-get-thing’.
H-p C-s pM-x sp-select-previous-thingSet active region over ARG previous things as recognized by ‘sp-get-thing’.
H-p C-c iM-x sp-change-innerChange the inside of the next expression.
H-p M-c eM-x sp-change-enclosingChange the inside of the enclosing expression.

Buffer List

Use command ibuffer instead of the default list-buffers for C-x C-b. The command ibuffer is an improved version of list-buffers. IBuffer colors the files by type and Xah Lee introduces it in Emacs: List Buffers.

Key bindingCommandDescription
C-x C-bM-x ibufferBegin using IBuffer to edit a list of buffers.
C-x bM-x switch-to-bufferSwitch to buffer, selected from list.
C-x kM-x kill-bufferClose the current buffer.

Cua Mode

When CUA mode is enabled, the keys C-x, C-c, C-v, and C-z invoke commands that cut (kill), copy, paste (yank), and undo respectively.

To enter an Emacs command like C-x C-f while the mark is active, use one of the following methods:

  • either hold Shift together with the prefix key, e.g., S-C-x C-f,
  • or quickly type the prefix key twice, e.g., C-x C-x C-f
  • or disable CUA mode by pressing <f12> or H-m c.

CUA mode provides enhanced rectangle support with visible rectangle highlighting. Use H-x C-RET to start a rectangle, extend it using the movement commands, and cut or copy it using C-x or C-c. RET moves the cursor to the next (clockwise) corner of the rectangle, so you can easily expand it in any direction. Normal text you type is inserted to the left or right of each line in the rectangle (on the same side as the cursor).

With CUA you can easily copy text and rectangles into and out of registers by providing a one-digit numeric prefix to the kill, copy, and yank commands, e.g., C-1 C-c copies the region into register 1, and C-2 C-v yanks the contents of register 2.

CUA mode also has a global mark feature which allows easy moving and copying of text between buffers. Use C-S-SPC to toggle the global mark on and off. When the global mark is on, all text that you kill or copy is automatically inserted at the global mark, and text you type is inserted at the global mark rather than at the current position.

By default Psimacs does not activate CUA mode on start-up, because it is to intrusive with respect to normal Emacs operation.

See also:

Key bindingCommandDescription
<f12>M-x cua-modeToggle CUA mode.
H-m cM-x cua-modeToggle CUA mode.
C-xWindows conform cut if CUA-mode is active.
C-cWindows conform copy if CUA-mode is active.
C-vWindows conform paste if CUA-mode is active.
H-x C-RETM-x cua-set-rectangle-markStart a rectangle.
<Ret>M-x cua-rotate-rectangleMove to next corner.
C-1 C-cCopy rectangle to register 1
...
C-9 C-cCopy rectangle to register 9
C-1 C-xCut rectangle to register 1
...
C-9 C-xCut rectangle to register 9
C-1 C-vYank rectangle from register 1
...
C-9 C-vYank rectangle from register 9

Dired+

Package Dired+ extends functionalities provided by standard Emacs library dired. The standard functions are all available, plus many more.

See also:

Important bindings in a Dired+ buffer:

Key bindingsDescription
(Hide/show details.
qQuit dired.
gRefresh and synch all.
mMark this file or directory.
uUnmark this file or directory.
UUnmark all marked files and directories.
* . <ext>Mark/unmark all files with given extension.
RETOpen file.
bByte compile.
BByte compile marked files or directories.
zCompress/uncompress file or directory.
ZCompress/uncompress marked file or directory.
C-kDelete with confirmation.
rRename file or directory.
M-c=Capitalize name.
M-uUpper case name.
M-lLower case name.
===Ediff.
C-S-bBookmark.
M-bBookmark marked files and directories.
FVisit marked files.
CCopy marked files and directories.
RRename of move marked files and directories.
C-M-S-tTouch marked files and directories.
MChange mode of marked files or directories.
C-M-gRun grep on marked files.
LLoad Emacs lisp of marked files.
&Run shell command asynchronously on marked files or directories.
!Run shell command synchronously on marked files or directories.

Some usefule key bindings and commands:

Key bindingCommandDescription
M-x diredp-dired-plus-helpDescribe dired+.
C-x dM-x diredOpen dired in current window.
C-x 4 dM-x dired-other-windowOpen dired in another window.
C-x 5 dM-x dired-other-frameOpen dired in another frame.
C-x t dM-x dired-other-tabOpen dired on an new tab.
C-c p DM-x projectile-diredOpen dired in current window at the root of the project.
C-c p 4 DM-x projectile-dired-other-windowOpen dired in another window at the root of the project.
C-c p 5 DM-x projectile-dired-other-frameOpen dired in another frame at the root of the project.
C-x C-jM-x dired-jumpJump to dired in current window corresponding to the current buffer.
C-x 4 C-jM-x dired-jump-other-windowJump to dired in another window corresponding to the current buffer.
C-c dM-x counsel-dired-jumpJump to directory below of current directory.
C-x D rM-x diredp-dired-recent-dirsOpen dired in current window showing recently visited directories.
C-x 4 D rM-x diredp-dired-recent-dirs-other-windowOpen dired in another window showing recently visited directories.
C-x D RM-x diredp-dired-recent-filesOpen dired in current window showing recently visited files and directories.
C-x 4 D RM-x diredp-dired-recent-files-other-windowOpen dired in another window showing recently visited files and directories.
C-x D FM-x diredp-dired-for-filesDired in current window the file names that you entered in a dired buffer that you name.
C-x 4 D FM-x diredp-dired-for-files-other-windowDired in another window the file names that you entered in a dired buffer that you name.
M-x dired-do-find-marked-filesOpen marked files, each in separate window, by splitting window vertically.
C-u M-x dired-do-find-marked-files=Open marked files, without splitting window.

Perspective

The perspective package provides multiple named workspaces (or “perspectives”) in Emacs, similar to multiple desktops in window managers.

Each perspective has its own buffer list and its own window layout. This makes it easy to work on many separate projects without getting lost in all the buffers. Switching to a perspective activates its window configuration, and when in a perspective, only its buffers are available (by default).

Each Emacs frame has a distinct list of perspectives.

Commands are all prefixed by C-x M-p by default. To change the prefix key, customize persp-mode-prefix-key. Additionally, creating a key binding for persp-mode-map will also activate the prefix.

Key bindingCommandDescription
C-x M-pPrefix key for all perspective commands.
C-x M-p sM-x persp-switchQuery a perspective to switch to, or create
C-x M-p kM-x persp-remove-bufferQuery a buffer to remove from current perspective
C-x M-p cM-x persp-killQuery a perspective to kill
C-x M-p rM-x persp-renameRename current perspective
C-x M-p aM-x persp-add-bufferQuery an open buffer to add to current perspective
C-x M-p AM-x persp-set-bufferAdd buffer to current perspective and remove it from all others
C-x M-p bM-x persp-switch-to-bufferLike switch-to-buffer; includes all buffers from all perspectives; changes perspective if necessary
C-x M-p iM-x persp-importImport a given perspective from another frame.
C-x M-p nM-x persp-nextSwitch to next perspective
C-x M-p pM-x persp-prevSwitch to previous perspective
C-x M-p <right>M-x persp-nextSwitch to next perspective
C-x M-p <left>M-x persp-prevSwitch to previous perspective
C-x M-p C-sM-x persp-state-saveSave all perspectives in all frames to a file
C-x M-p C-lM-x persp-state-loadLoad all perspectives from a file

Since perspective maintains distinct buffer lists for each perspective, it helps to use a Perspective-aware buffer switcher.

Buffer switcherSupport
IdoInteractive Do (Ido, ido-mode), in particular its ido-switch-buffer command, is automatically Perspective-aware when persp-mode is enabled.
bs.elPerspective provides a wrapper for bs-show: persp-bs-show. When this function is called normally, it shows a list of buffers filtered by the current perspective. With a prefix argument, it shows a list of buffers in all perspectives.
IBufferPerspective provides a wrapper for ibuffer: persp-ibuffer. When this function is called normally, it shows a list of buffers filtered by the current perspective. With a prefix argument, it shows a list of buffers in all perspectives.
HelmPerspective ships with buffer-listing advice for Helm, so Helm’s buffer listing code should be automatically Perspective-aware when persp-mode is enabled.
Ivy / CounselPerspective provides two commands for listing buffers using Ivy and Counsel: persp-ivy-switch-buffer and persp-counsel-switch-buffer. When these functions are called normally, they show a list of buffers filtered by the current perspective. With a prefix argument, they shows a list of buffers in all perspectives.

Abbreviations

Emacs’s Abbrevs feature lets you type a short word and expand into a full word or code template.

Emacs has a nice feature to expand abbreviations. If for example, you wanted an abbreviation for ‘Your Name’ to be ‘yn’, just type ‘yn’ and with your point after the ‘n’ do C-x a i g (mnemonic add inverse global) and enter the expansion, in this case ‘Your Name’. In the future, whenever you type ‘yn’ your name will be inserted. The abbrevs are automatically saved between sessions in a file.

If you don’t like an abbrev that you have set up, then do M-x edit-abbrevs. You can have different abbrevs for each mode (cperl, c++, Message); the g in C-x a i g is for global, meaning every mode.

Suppose you want to define “bg” for “background”: Type M-x add-global-abbrev, i.e. C-x a g and then type “bg” in the prompt. Now, when you type “bg” followed by a space or return, it will expand to “background”.

If you want the abbrev only for the current major mode: Type M-x add-mode-abbrev, i.e. C-x a l

If the expanded text is more than one word, for example, suppose you want to define “faq” for “frequently asked questions”. Type “frequently asked questions”, then select the text and do C-u C-x a g rspl. C-u C-x a l.

Remove an abbreviation by C-u -1 C-x a g rspl. C-u -1 C-x a l followed by the memnomic, e.g. “bg”.

Other commands: M-x list-abbrevs M-x edit-abbrevs, M-x edit-abbrevs-redefine, M-x abbrev-edit-save-buffe and M-x abbrev-edit-save-to-file.

Additionally, M-x read-abbrev-file and M-x write-abbrev-file.

Key bindingCommandDescription
H-m C-x C-aM-x abbrev-modeEnable/Disable abbreviation mode.
C-x a i gM-x inverse-add-global-abbrevadd inverse global abbreviation, i.e. ‘yn’→ C-x a i g → ‘Your Name’
C-x a gM-x add-global-abbrevadd global abbreviation, i.e. ‘Name’ → C-x a g → ‘n’
C-u C-x a gM-x add-global-abbrevadd region global abbreviation, i.e. ‘Your Name’ → C-x a g → ‘yn’
C-u -1 C-x a gremove global abbreviation, i.e. ‘yn’
C-x a i lM-x inverse-add-mode-abbrevadd inverse mode abbreviation, i.e. ‘yn’→ C-x a i l → ‘Your Name’
C-x a lM-x add-mode-abbrevadd mode abbreviation, i.e. ‘Name’ → C-x a l → ‘n’
C-u C-x a lM-x add-mode-abbrevadd mode abbreviation, i.e. ‘Your Name’ → C-x a l → ‘yn’
C-u -1 C-x a lremove mode abbreviation, i.e. ‘yn’
M-x edit-abbrevs
M-x edit-abbrevs-redefine
M-x list-abbrevs
M-x abbrev-edit-save-buffer
M-x abbrev-edit-save-to-file

See also:

Centaur tabs

Package Centaur tabs provides aesthetic, functional and efficient tabs for Emacs.

Key bindingCommandDescription
H-<prior>M-x centaur-tabs-backwardSelect the previous available tab.
H-<next>M-x centaur-tabs-forwardSelect the next available tab.

Expand-Region

The package expand-region allows you to expand a selected region by semantic units. Just keep pressing the key until it selects what you want.

See also:

Key bindingCommandDescription
H-x eM-x er/expand-regionExpand region intelligently.

Folding

The package yafolding provides a minor mode that allows you to fold code blocks based on its indentation.

See also:

Key bindingCommandDescription
H-x H-f hM-x yafolding-hide-elementHide element.
H-x H-f sM-x yafolding-show-elementShow element.
H-x H-f tM-x yafolding-toggle-elementToggle element.
H-x H-f HM-x yafolding-hide-allHide all elements.
H-x H-f SM-x yafolding-show-allShow all elements.
H-x H-f TM-x yafolding-toggle-allToggle all elements.
H-x H-f pM-x yafolding-go-parent-elementGo to parent element.
H-x H-f PM-x yafolding-hide-parent-elementHide parent element.
H-x H-f mM-x yafolding-modeToggle yafolding-mode.

Whitespace Mode

Emacs’s whitespace-mode is a minor mode to visualize blanks, i.e. TAB, SPACE and NEWLINE.

See also:

Key bindingCommandDescription
H-m C-m C-v wM-x whitespace-modeToggle whitespace-mode.

Trailing white spaces

You can make trailing whitespace at the end of a line visible by setting the buffer-local variable show-trailing-whitespace to t. Then Emacs displays trailing whitespace, using the face trailing-whitespace. Psimacs disables this feature on default.

Key bindingCommandDescription
H-x C-w dM-x psimacs/whitespace/delete-trailing-whitespaceDelete trailing white spaces.
H-x C-w tM-x psimacs/whitespace/toggle-auto-delete-trailing-whitespace-on-saveToggle auto deletion of white spaces on buffer save.

Hungry delete mode

The package hungry-delete-mode implements hungry deletion, meaning that deleting a whitespace character will delete all whitespace until the next non-whitespace character.

Refefences:

Key bindingCommandDescription
H-dM-x hungry-delete-forwardDelete the following character or all following whitespace.
H-<DEL>M-x hungry-delete-backwardDelete the preceding character or all preceding whitespace.

Zoom Frame

The package zoom-frm allows the font resize of the current buffer, the current frame or of all frames. It is an enhancement of the build-in M-x text-adjust-scale command.

Key bindingCommandDescription
H-m C-x C-0M-x zoom-frm-unzoomCancel zoom of frame.

Zoom

Package zoom provides a minor mode that takes care of managing the window sizes by enforcing a fixed and automatic balanced layout where the currently selected window is resized according to zoom-size which can be an absolute value in lines/columns, a ratio between the selected window and frame size or even a custom callback.

Zoom is an alternative to package Golden-Ratio which does have some problems to be convenient.

Key bindingCommandDescription
H-m C-w +M-x zoomZoom the current window and balance the others according to zoom-size.
H-m C-w C-zM-x zoom-modeToggle automatic window resizing with zoom.

Easy window switching

The package ace-window allows easy window switching.

When there are two windows, ace-window will call other-window. If there are more, each window will have the first character of its window label highlighted at the upper left of the window. Pressing that character will either switch to that window or filter to the next character needed to select a specific window. Note that, unlike ace-jump-mode, the position of point will not be changed, i.e. the same behavior as that of other-window.

Key bindingCommandDescription
C-x oM-x ace-windowEither other-window or easy switching by first character of window label. Swap window with prefix C-u and delete selected window with double prefix C-u C-u.
C-x OM-x other-frameSwitch to the next frame in ring.
H-m C-w C-x sM-x psimacs/config/toggle-ace-scopeToggle scope of ace-window between ‘global’ and ‘frame’ scope.

If ace-window is active the following key bindings are available:

Key bindingCommandDescription
zaw-make-frameCreate a new frame.
xaw-delete-windowDelete Window.
maw-swap-windowSwap Windows.
Maw-move-windowMove Window.
caw-copy-windowCopy Window.
jaw-switch-buffer-in-windowSelect Buffer.
naw-flip-windowSelect the previous window.
uaw-switch-buffer-other-windowSwitch Buffer Other Window.
eaw-execute-command-other-windowExecute Command Other Window.
Faw-split-window-fairSplit Fair Window.
vaw-split-window-vertSplit Vert Window.
baw-split-window-horzSplit Horz Window.
odelete-other-windowsDelete Other Windows.
Taw-transpose-frameTranspose Frame.
?aw-show-dispatch-helpShow this table for help.

Winner Mode

winner-mode lets you use C-c <left> and C-c <right> to switch between window configurations. This is handy when something has popped up a buffer that you want to look at briefly before returning to whatever you were working on. When you’re done, press C-c <left>.

See also:

Key bindingCommandDescription
C-c <left>M-x winner-undoSwitch back to an earlier window configuration saved by Winner mode.
C-c <right>M-x winner-redoRestore a more recent window configuration saved by Winner mode.

Ediff

The Ediff package provides a comprehensive visual interface to Unix diff and patch utilities.

From the Ediff Introduction

Ediff provides a convenient way for simultaneous browsing through the differences between a pair (or a triple) of files or buffers. The files being compared, file-A, file-B, and file-C are shown in separate windows (side by side, one above the another, or in separate frames), and the differences are highlighted as you step through them. You can also copy difference regions from one buffer to another (and recover old differences if you change your mind).

Another powerful feature is the ability to merge a pair of files into a third buffer. Merging with an ancestor file, (a.k.a. 3way merges) is also supported. Furthermore, Ediff is equipped with directory-level capabilities that allow the user to conveniently launch browsing or merging sessions on groups of files in two (or three) different directories.

In addition, Ediff can apply a patch to a file and then let you step through both files, the patched and the original one, simultaneously, difference-by-difference.

CommandDescription
M-x ediff-filesCompare two files.
M-x ediffdito
M-x ediff-backupCompare a file with its backup. If there are several numerical backups, use the latest. If the file is itself a backup, then compare it with its original.
M-x ediff-current-fileCompare the buffer with its file on disk. This function can be used as a safe version of revert-buffer.
M-x ediff-buffersCompare two buffers.
M-x ediff-files3Compare three files.
M-x ediff3dito
M-x ediff-buffers3Compare three buffers.
M-x edirsCompare files common to two directories.
M-x ediff-directoriesdito
M-x edirs3Compare files common to three directories.
M-x ediff-directories3dito
M-x edir-revisionsCompare versions of files in a given directory. Ediff selects only the files that are under version control.
M-x ediff-directory-revisionsdito
M-x edir-merge-revisionsMerge versions of files in a given directory. Ediff selects only the files that are under version control.
M-x ediff-merge-directory-revisionsdito
M-x edir-merge-revisions-with-ancestorMerge versions of files in a given directory using other versions as ancestors. Ediff selects only the files that are under version control.
M-x ediff-merge-directory-revisions-with-ancestordito
M-x ediff-windows-wordwiseCompare text visible in 2 windows word-by-word.
M-x ediff-windows-linewiseCompare text visible in 2 windows line-by-line.
M-x ediff-regions-wordwiseCompare regions word-by-word. The regions can come from the same buffer and they can even overlap. You will be asked to specify the buffers that contain the regions, which you want to compare. For each buffer, you will also be asked to mark the regions to be compared.
M-x ediff-regions-linewiseSimilar to ediff-windows-linewise, but compares the regions line-by-line. See ediff-windows-linewise for more details.
M-x ediff-revisionCompare versions of the current buffer, if the buffer is visiting a file under version control.
M-x ediff-patch-filePatch a file or multiple files, then compare. Since the patch might be in a buffer or a file, you will be asked which is the case. To avoid this extra prompt, you can invoke this command with a prefix argument. With an odd prefix argument, Ediff assumes the patch is in a file; with an even argument, a buffer is assumed.
M-x epatchdito
M-x ediff-patch-bufferPatch a buffer, then compare. The buffer being patched and the file visited by that buffer (if any) is not modified. The result of the patch appears in some other buffer that has the name ending with _patched.
M-x epatch-bufferdito
M-x ediff-merge-filesMerge two files.
M-x ediff-mergedito
M-x ediff-merge-files-with-ancestorLike ediff-merge, but with a third ancestor file.
M-x ediff-merge-with-ancestordito
M-x ediff-merge-buffersMerge two buffers.
M-x ediff-merge-buffers-with-ancestorSame but with ancestor.
M-x edirs-mergeMerge files common to two directories.
M-x ediff-merge-directoriesdito
M-x edirs-merge-with-ancestorSame but using files in a third directory as ancestors.
M-x ediff-merge-directories-with-ancestordito
M-x ediff-merge-revisionsMerge two versions of the file visited by the current buffer.
M-x ediff-merge-revisions-with-ancestorSame but with ancestor.
M-x ediff-documentationBrings up the Ediff manual.
M-x ediff-show-registryBrings up Ediff session registry. This feature enables you to quickly find and restart active Ediff sessions.
M-x eregistrydito

Remarks:

  • All Ediff commands are displayed in a Quick Help window, unless you type ? to shrink the window to just one line. You can redisplay the help window by typing ? again.
  • Many Ediff commands take numeric prefix arguments.
  • Some commands take negative prefix arguments as well.
  • Without the prefix argument, all commands operate on the currently selected difference region.
CommandDescription
?Toggles the Ediff Quick Help window ON and OFF.
EBrings up the top node of the Ediff manual.
vScrolls up buffers A and B (and buffer C where appropriate) in a coordinated fashion.
VScrolls the buffers down.
<Scrolls the buffers to the left simultaneously.
>Scrolls buffers to the right.
wdSaves the output from the diff utility, for further reference.
waSaves buffer A, if it was modified.
wbSaves buffer B, if it was modified.
wcSaves buffer C, if it was modified
aIn comparison sessions: Copies the current difference region from buffer A to buffer B (see rb).
aIn merge sessions: Copies the current difference region from buffer A to the merge buffer (r).
abCopies the current difference region from buffer A to buffer B.
acCopies the difference region from buffer A to buffer C.
baCopies the difference region from buffer B to buffer A.
bcCopies the difference region from buffer B to buffer C.
caCopies the difference region from buffer C to buffer A.
cbCopies the difference region from buffer C to buffer B.
p, DELMakes the previous difference region current.
n, SPCMakes the next difference region current.
j, -j, NjMakes the very first difference region current. Makes the very first difference region current. Typing a number, N, and then j makes the difference region N current.
gaMakes current the difference region closest to the position of the point in buffer A.
gbMakes current the difference region closest to the position of the point in buffer B.
gcMakes current the difference region closest to the position of the point in buffer C.
!Recomputes the difference regions, bringing them up to date.
*Forces refinement of the current difference region, which highlights the exact words of disagreement among the buffers
mDisplays the current Ediff session in a frame as wide as the physical display.
Toggles the horizontal/vertical split of the Ediff display.
@Toggles auto-refinement of difference regions.
hCycles between full highlighting, the mode where fine differences are not highlighted (but computed), and the mode where highlighting is done with ASCII strings.
rRestores the old contents of the region in the merge buffer.
raRestores the old contents of the current difference region in buffer A.
rbRestores the old contents of the current difference region in buffer B.
rcRestores the old contents of the current difference region in buffer C.
##Tell Ediff to skip over regions that disagree among themselves only in the amount of white space and line breaks.
#cToggle case sensitivity in the diff program.
#hEdiff prompts you to specify regular expressions for each variant. Difference regions where each variant’s region matches the corresponding regular expression will be skipped from then on.
#fDoes dual job: it focuses on regions that match the corresponding regular expressions. All other regions will be skipped over.
AToggles the read-only property in buffer A.
BToggles the read-only property in buffer B.
CToggles the read-only property in buffer C.
~Swaps the windows where buffers A and B are displayed.
iDisplays all kinds of useful data about the current Ediff session.
DRuns ediff-custom-diff-program on the variants and displays the buffer containing the output.
RDisplays a list of currently active Ediff sessions—the Ediff Registry.
MShows the session group buffer that invoked the current Ediff session.
zSuspends the current Ediff session. The easiest way to resume a suspended Ediff session is through the registry of active sessions.
qTerminates this Ediff session.
%Toggles narrowing in Ediff buffers.
C-lRestores the usual Ediff window setup. This is the quickest way to resume an Ediff session, but it works only if the control panel of that session is visible.
$$Skipping the regions where only one of the variants clashes with the ancestor but the other variant agrees with it. Typing $$ again undoes this setting.
$*When merging files with large number of differences, it is sometimes convenient to be able to skip the difference regions for which you already decided which variant is most appropriate. Typing $* will accomplish precisely this.
/Toggle to display the ancestor file in 3way merges.
&On merge the right course of action is not always clear, and Ediff would use a default action. The above command changes the default action.
sCauses the merge window shrink to its minimum size, thereby exposing as much of the variant buffers as possible. Typing s again restores the original size of that window.
+Combines the difference regions from buffers A and B and copies the result into the merge buffer.
===Creates a child Ediff session for comparing regions in buffers A, B or C.

See also:

goto-chg - go to the point where the last edit was made

Package goto-chg allows you to jump back to the last edited places.

Key bindingCommandDescription
H-x H-,M-x goto-last-changeGo to the point where the last edit was made in the current buffer.
H-x H-.M-x goto-last-change-reverseGo back to more recent changes after goto-last-change have been used.

Visible Bookmarks

The package Visible bookmarks provides visible, buffer local, bookmarks and the ability to jump forward and backward to the next bookmark. They are quite similar to the MS Visual Studio bookmarks I am used to.

See also:

Key bindingCommandDescription
<f2>M-x bm-nextJump to the next bookmark.
S-<f2>M-x bm-previousJump to the previous bookmark.
C-<f2>M-x bm-toggleSet or unset bookmark.
C-S-<f2>M-x bm-remove-all-current-bufferRemove all bookmarks of the current buffer.

Avy - jumping to visible text

Avy is a GNU Emacs package for jumping to visible text using a char-based decision tree.

Key bindingCommandDescription
H-m C-s C-a cM-x avy-goto-charInput one char, jump to it with a tree.
H-m C-s C-a CM-x avy-goto-char-2Input two consecutive chars, jump to the first one with a tree.
H-m C-s C-a tM-x avy-goto-char-timerInput an arbitrary amount of consecutive chars, jump to the first one with a tree.
H-m C-s C-a TM-x avy-org-goto-heading-timerType part of an Org heading. When you stop typing it will be jumped to; if more than one matches, you can jump to a heading with Avy.
H-m C-s C-a lM-x avy-goto-lineInput zero chars, jump to a line start with a tree.
H-m C-s C-a wM-x avy-goto-word-1Input one char at word start, jump to a word start with a tree.
H-m C-s C-a WM-x avy-goto-word-0Input zero chars, jump to a word start with a tree.

Mosey

Mosey is a GNU Emacs package that makes it easy to mosey back and forth in your buffers.

Key bindingCommandDescription
H-m C-s C-m fM-x mosey-forwardMosey on forward.
H-m C-s C-m bM-x mosey-backwardMosey on back.
H-m C-s C-m FM-x mosey-forward-bounceBounce forward a notch when it hits the beginning.
H-m C-s C-m BM-x mosey-backward-bounceBounce back a notch when it hits the end.
H-m C-s C-m C-fM-x mosey-forward-cycleLoop around when it gets to one end or the other.
H-m C-s C-m C-bM-x mosey-backward-cycleLoop around when it gets to one end or the other.

Multiple Cursors

Multiple-cursors is a very nice package that lets you create several cursors that all do the same thing as you type.

See also:

Remarks:

  • Notice that the number of cursors active can be seen in the modeline.
  • If you get out of multiple-cursors-mode and yank - it will yank only from the kill-ring of main cursor. To yank from the kill-rings of every cursor use yank-rectangle, normally found at C-x r y.
Key bindingCommandDescription
H-m H-c m nM-x mc/mark-next-like-thisAdds a cursor and region at the next part of the buffer forwards that matches the current region. If no region is selected, it will just add a cursor on the next line.
H-m H-c m pM-x mc/mark-previous-like-thisAdds a cursor and region at the next part of the buffer backwards that matches the current region.
H-m H-c m aM-x mc/mark-all-like-thisMarks all parts of the buffer that matches the current region.
H-m H-c m w nM-x mc/mark-next-like-this-wordAdds a cursor and region at the next part of the buffer forwards that matches the current region, if no region is selected it selects the word at the point. If no region is selected, it will mark the word and add a cursor at the next occurrence.
H-m H-c m w pM-x mc/mark-previous-like-this-wordAdds a cursor and region at the next part of the buffer backwards that matches the current region, if no region is selected it selects the word at the point.
H-m H-c m W nM-x mc/mark-next-word-like-thisLike mc/mark-next-like-this but only for whole words.
H-m H-c m W pM-x mc/mark-previous-word-like-thisLike mc/mark-previous-like-this but only for whole words.
H-m H-c m w aM-x mc/mark-all-words-like-thisLike mc/mark-all-like-this but only for whole words.
H-m H-c m s nM-x mc/mark-next-like-this-symbolAdds a cursor and region at the next part of the buffer forwards that matches the current region, if no region is selected it selects the symbol at the point. If no region is selected, it will mark the symbol and add a cursor at the next occurrence.
H-m H-c m s pM-x mc/mark-previous-like-this-symbolAdds a cursor and region at the next part of the buffer backwards that matches the current region, if no region is selected it selects the symbol at the point.
H-m H-c m S nM-x mc/mark-next-symbol-like-thisLike mc/mark-next-like-this but only for whole symbols.
H-m H-c m S pM-x mc/mark-previous-symbol-like-thisLike mc/mark-previous-like-this but only for whole symbols.
H-m H-c m s aM-x mc/mark-all-symbols-like-thisLike mc/mark-all-like-this but only for whole symbols.
H-m H-c m f aM-x mc/mark-all-like-this-in-defunMarks all parts of the current defun that matches the current region.
H-m H-c m f w aM-x mc/mark-all-words-like-this-in-defunLike mc/mark-all-like-this-in-defun but only for whole words.
H-m H-c m f s aM-x mc/mark-all-symbols-like-this-in-defunLike mc/mark-all-like-this-in-defun but only for whole symbols.
H-m H-c m d aM-x mc/mark-all-dwimTries to be smart about marking everything you want. Can be pressed multiple times.
H-m H-c m m eM-x mc/mark-more-like-this-extendedUse arrow keys to quickly mark/skip next/previous occurrences.
C-S-<mouse-1>M-x mc/add-cursor-on-clickAdd a new cursor at click position.
H-m H-c m mM-x mc/mark-popSet a cursor at the current point and move to the next (different) position on the mark stack. This allows for fine grained control over the placement of cursors.
H-m H-c m r aM-x mc/mark-all-in-regionPrompts for a string to match in the region, adding cursors to all of them.
H-m H-c m t = | =M-x mc/mark-sgml-tag-pairMark the current opening and closing tag.
H-m H-c u nM-x mc/unmark-next-like-thisRemove the next cursor furthest down in the buffer.
H-m H-c u pM-x mc/unmark-previous-like-thisRemove the previous cursor furthest up in the buffer.
H-m H-c s nM-x mc/skip-to-next-like-thisRemove the cursor furthest down, marking the next occurrence down.
H-m H-c s pM-x mc/skip-to-previous-like-thisRemove the cursor furthest up, marking the next occurrence up.
H-m H-c e lM-x mc/edit-linesAdds one cursor to each line in the current region. You can give it a positive or negative prefix to change how it behaves on too short lines.
H-m H-c e C-aM-x mc/edit-beginnings-of-linesAdd one cursor to the beginning of each line in the active region.
H-m H-c e C-eM-x mc/edit-ends-of-linesAdd one cursor to the end of each line in the active region.
H-m H-c i nM-x mc/insert-numbersInsert increasing numbers for each cursor, top to bottom.
H-m H-c i lM-x mc/insert-lettersInsert increasing letters for each cursor, top to bottom.
H-m H-c r sM-x mc/sort-regionsSort the marked regions alphabetically.
H-m H-c r rM-x mc/reverse-regionsReverse the order of the marked regions. If nothing is selected with just one cursor, it will flip the sexp at point and the one below it.
H-m H-c a r r = | =M-x set-rectangular-region-anchorThink of this one as set-mark except you’re marking a rectangular region.
H-m H-c v aM-x mc/vertical-alignAligns all cursors vertically with a given CHARACTER to the one with the highest column number (the rightest). (Might not behave as intended if more than one cursors are on the same line.)
H-m H-c v AM-x mc/vertical-align-with-spaceAligns all cursors with whitespace like mc/vertical-align does.
<return>Will make <return> insert a newline.
C-jInsert a newline in multiple-cursors-mode.
C-gTo get out of multiple-cursors-mode. This will first disable multiple regions before disabling multiple cursors.
C-vM-x mc/cycle-forwardScroll the screen down to center on each cursor.
M-vM-x mc/cycle-backwardScroll the screen up to center on each cursor.
C-;M-x mc-hide-unmatched-lines-modeToggle hiding all lines without a cursor.

PCRE to Elips Regexp converter

The package pcre2el converts between PCRE, Emacs and rx regexp syntaxes.

See also:

Do-what-I-mean” commands:

Key bindingCommandDescription
C-c / /M-x rxt-explainPop up a buffer with pretty-printed `rx’ syntax for the regex at point.
C-c / cM-x rxt-convert-syntaxConvert regex at point to other kind of syntax, depending on major mode.
C-c / xM-x rxt-convert-to-rxConvert regex at point to RX syntax. Chooses Emacs or PCRE syntax by major mode.
C-c / 'M-x rxt-convert-to-stringsConvert regex at point to RX syntax. Chooses Emacs or PCRE syntax by major mode.

Commands that work on a PCRE regexp:

Key bindingCommandDescription
C-c / p eM-x rxt-pcre-to-elispTranslate PCRE, a regexp in Perl-compatible syntax, to Emacs Lisp.
C-c / %M-x pcre-query-replace-regexpPerform query-replace-regexp using PCRE syntax.
C-c / p xM-x rxt-pcre-to-rxTranslate PCRE, a regexp in Perl-compatible syntax, to `rx’ syntax.
C-c / p 'M-x rxt-pcre-to-stringsReturn a list of all strings matched by PCRE, a Perl-compatible regexp.
C-c / p /M-x rxt-explain-pcreInsert the pretty-printed `rx’ syntax for REGEXP in a new buffer.

Commands that work on an Emacs regexp:

Key bindingCommandDescription
C-c / e /M-x rxt-explain-elispInsert the pretty-printed `rx’ syntax for REGEXP in a new buffer.
C-c / e pM-x rxt-elisp-to-pcreTranslate REGEXP, a regexp in Emacs Lisp syntax, to Perl-compatible syntax.
C-c / e xM-x rxt-elisp-to-rxTranslate REGEXP, a regexp in Emacs Lisp syntax, to `rx’ syntax.
C-c / e 'M-x rxt-elisp-to-stringsReturn a list of all strings matched by REGEXP, an Emacs Lisp regexp.
C-c / e tM-x rxt-toggle-elisp-rxToggle the regexp near point between Elisp string and rx syntax.
C-c / tM-x rxt-toggle-elisp-rxToggle the regexp near point between Elisp string and rx syntax.

Visualize Regexp

The package visual-regexp provides the same functionality like Emacs’s command replace-regexp, but with live visual feedback directly in the buffer

See also:

Key bindingCommandDescription
H-c rM-x vr/replace#ERROR
H-c qM-x vr/query-replacequery-replace-regexp with live visual feedback.
H-c mM-x vr/mc-markConvert regexp selection to multiple cursors.

Visualize Regexp Steroids

The package visual-regexp-steroids is an extension to package visual-regexp which enables the use of modern regexp engines (no more escaped group parentheses, and other goodies!).

In addition to that, you can optionally use the better regexp syntax to power isearch-forward-regexp and isearch-backward-regexp.

For now, Python and pcre2el are supported out of the box.

See also:

Key bindingCommandDescription
H-c sM-x vr/isearch-forwardLike isearch-forward but with a PCRE regular expression.
H-c pM-x vr/isearch-backwardLike isearch-backward but with a PCRE regular expression.

Ripgrep

The package rg brings support for ripgrep to Psimacs.

ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern. It is expected to be installed on the system and availbale through the search path of the os. Personally, I have it installed with MSYS2. By default, ripgrep will respect gitignore rules and automatically skip hidden files/directories and binary files. (To disable all automatic filtering by default, use rg -uuu.)

Emacs package rg allows you to interactively create searches, doing automatic searches based on the editing context, refining and modifying search results and much more. It is also highly configurable to be able to fit different users’ needs.

See also:

Key bindingCommandDescription
C-c sM-x rg-menuShow the rg menu.
C-c s r (rg)Interactive search with regex.
C-c s tInteractive search with literate string.
C-c s p (rg-project)Project search
C-c s d (rg-dwim)DWIM in current project.
C-u C-c s d (rg-dwim)DWIM in current dir.
C-u C-u C-c s d (rg-dwim)DWIM in current file.
M-x rg-dwim-project-dirDWIM search in the current directory.
M-x rg-dwim-current-fileDWIM search in the current file.
M-x rg-dwim-project-dirDWIM search in the current project.

Spell checking with Flyspell and Aspell or Hunspell

Flyspell enables on-the-fly spell checking in Emacs by the means of a minor mode. Flyspell highlights incorrect words as soon as they are completed or as soon as the cursor hits a new word.

Basically two spell checker programs are usable. At first there is Aspell and secondly there is hunspell. Psimacs supports both backends. You can configure which one to use with the flag variable psimacs/internal/spell-checker-use-aspell. If this is set to t the Aspell program will be used.

The following key bindings are defined for the spell checking mode.

Key bindingCommandDescription
H-m C-f mM-x flyspell-modeMinor mode performing on-the-fly spelling checking.
H-m C-f MM-x flyspell-prog-modeTurn on flyspell-mode for comments and strings.
H-m C-f rM-x flyspell-regionChecks all words inside a region.
H-m C-f bM-x flyspell-bufferChecks the whole buffer.
H-m C-f wM-x flyspell-wordSpell check a word.
C-,M-x flyspell-goto-next-errorGo to the next detected error.
C-.M-x flyspell-auto-correct-wordAutomatically Correct the current word. This command proposes various successive corrections for the current word.
C-:M-x flyspell-auto-correct-previous-wordAuto correct the first mispelled word that occurs before point.
C-;M-x flyspell-correct-wrapperBy default jumps to the first misspelled word before the point and prompts for correction and gets you back. Calling it with C-u gives ability to correct multiple misspelled words in one run. C-u C-u changes direction. C-u C-u C-u changes direction and enables multiple corrections.
H-m C-f aM-x flyspell-correct-at-pointTo correct word at point.
H-m C-f pM-x flyspell-correct-previousTo correct any visible word before the point.
H-m C-f nM-x flyspell-correct-nextTo correct any visible word after the point.
H-m C-f cM-x flyspell-check-previous-highlighted-wordCorrect the closer misspelled word.
M-x flyspell-correct-wordPop up a menu of possible corrections for a misspelled word. The word checked is the word at the mouse position.
M-x flyspell-correct-word-before-pointPop up a menu of possible corrections for misspelled word before point.
H-m C-f dM-x psimac/spell/add-word-to-dictAdd the word at the current location to the private dictionary without question.
H-m C-f gM-x psimac/spell/switch-to-germanChange to german language dictionary.
H-m C-f eM-x psimac/spell/switch-to-englishChange to english language dictionary.
H-m C-f tM-x psimac/spell/toggle-languageToggle german and english language dictionaries.

Some more information about spell checking can be found in the following references:

Spell and grammar checking with LanguageTool

LanguageTool provides a Java based spell and grammar checking tool. The langtool.el package gives access to that tool.

Key bindingCommandDescription
H-m C-l bM-x langtool-check-bufferTo check current buffer and show warnings. With prefix C-u check with different language.
H-m C-l pM-x langtool-goto-previous-errorGoto previous error. Obsoleted function. Should use langtool-correct-buffer.
H-m C-l nM-x langtool-goto-next-errorGoto next error. Obsoleted function. Should use langtool-correct-buffer.
H-m C-l ;M-x langtool-correct-bufferExecute interactive correction after langtool-check-buffer. To correct marker follow LanguageTool suggestions.
H-m C-l tM-x langtool-switch-default-languageSwitch ‘langtool-default-language’ to LANG
H-m C-l mM-x langtool-show-brief-message-at-pointShow error brief message at point.
H-m C-l MM-x langtool-show-message-at-pointShow error details at point..
H-m C-l BM-x langtool-check-doneFinish LanguageTool process and cleanup existing colorized texts.

Google translate

The package google-translate allows to translate the strings using Google Translate Service directly from Emacs. Psimacs pre defines the query language to German and the target laguage to English in variable google-translate-translation-directions-alist. If you do not like that setting, change it as it pleases you.

Psimacs binds the M-x google-translate-smooth-translate command that allows easy translation between the language pairs provided in the google-translate-translation-directions-alist variable. You can toggle between these pairs with C-n and C-p.

On default, Psimacs outputs the result of the translation process to a separate ‘translation buffer’. It then puts the input focus into that buffer. That can easily be changed to output directly into the current buffer by calling function psimacs/spell/google-tanslate/toggle-output-destination.

Key bindingCommandDescription
H-m C-t ;M-x google-translate-smooth-translateTranslate a text using translation directions. Make a prompt in minibuffer for a text to translate. Default text is word at point.
H-m C-t oM-x psimacs/spell/google-tanslate/toggle-output-destinationToggle output desination between ‘current buffer’ and ‘translation buffer’.
M-x google-translate-at-pointTranslates the word at point or the active region.
M-x google-translate-query-translateTranslate, and shows a buffer with available translations of the text.

Google search

The package google-this provides a set of functions and keybindings for launching google searches from within Emacs.

Key bindingCommandDescription
H-m C-x G RETM-x google-this-searchWrite and do a google search. Quote argument with PREFIX C-u.
H-m C-x G tM-x google-thisDecide what the user wants to google (always something under point). Quote argument with PREFIX C-u. Unlike google-this-search (which presents an empty prompt with “this” as the default value), this function inserts the query in the minibuffer to be edited.
H-m C-x G nM-x google-this-noconfirmDecide what the user wants to google and go without confirmation. Quote argument with PREFIX C-u. Exactly like google-this or google-this-search, but don’t ask for confirmation.
H-m C-x G gM-x google-this-lucky-searchExactly like google-this-search, but use the “I’m feeling lucky” option. Quote argument with PREFIX C-u.
H-m C-x G SPCM-x google-this-regionGoogle the current region. Quote argument with PREFIX C-u.
H-m C-x G aM-x google-this-rayGoogle text between the point and end of the line. If there is a selected region, googles the region.
H-m C-x G lM-x google-this-lineGoogle the current line. Quote argument with PREFIX C-u.
H-m C-x G sM-x google-this-symbolGoogle the current symbol. Quote argument with PREFIX C-u.
H-m C-x G wM-x google-this-wordGoogle the current word. Quote argument with PREFIX C-u.
H-m C-x G iM-x google-this-lucky-and-insert-urlFetch the url that would be visited by ‘google-this-lucky’.
H-m C-x G rM-x google-this-cpp-referenceVisit the most probable cppreference.com page for this word.
H-m C-x G fM-x google-this-forecastSearch google for “weather”. With PREFIX C-u, ask for location.
H-m C-x G eM-x google-this-errorGoogle the current error in the compilation buffer. Quote argument with PREFIX C-u.
H-m C-x G cM-x google-this-translate-query-or-regionIf region is active google-translate-at-point, otherwise google-translate-query-translate.

Counsel-search

The Swiper package provides with counsel-search a command that allows you to interactively search the Web. This command is available through the following binding:

Key bindingCommandDescription
H-m C-s w RETM-x counsel-searchInteractively search the web with counsel.
H-m C-s w tM-x psimacs/web/counsel/toggle-search-engineToggle the search engine of ‘counsel-search’ between duckduckgo and google.

Stack Exchange

The package sx provides a full-featured Stack Exchange mode for Emacs.

If you are going to be doing any asking/answering/commenting/upvoting/downvoting/ etc., you must use sx-authenticate to provide SX with an authentication token to act on your behalf.

References:

Psimacs currently only provides minimal key bindings for sx, since its author does not actively participate in the StackExchange community.

Key bindingCommandDescription
H-m C-x S RETM-x sx-tab-all-questionsDisplay a list of All-Questions questions for SITE.
H-m C-x S sM-x sx-searchDisplay search on SITE for question titles containing QUERY.
H-m C-x S rM-x sx-question-list-refreshUpdate the list of questions.

The following table shows only the key bindings important for the author. The sx site provides many more bindings and commands that comes into play when you actively participate in the StackExchange world.

Key bindingsDescription
RETOpen question buffer.
pNavigate to previous entry in list.
nNavigate to next entry in list.
jNavigate to previous entry while viewing the question in a separate buffer.
kNavigate to next entry while viewing the question in a separate buffer.
s sSwitch site.
vVisit the thing-at-point in your browser.
wCopy the thing-at-point (usually a link).

Crux

The package crux is a collection of useful extensions for Emacs. Crux bundles many useful interactive commands to enhance your overall Emacs experience.

See also:

Key bindingCommandDescription
H-x H-x C-c oM-x crux-open-withOpen the currently visited file with an external program.
H-x H-x C-kM-x crux-smart-kill-lineFirst kill to end of line, then kill the whole line.
H-x H-x C-S-RETM-x crux-smart-open-line-aboveInsert an empty line above the current line and indent it properly.
H-x H-x S-RETM-x crux-smart-open-lineInsert an empty line and indent it properly (as in most IDEs).
H-x H-x C-c nM-x crux-cleanup-buffer-or-regionFix indentation in buffer and strip whitespace.
H-x H-x C-c fM-x crux-recentf-find-fileOpen recently visited file.
H-x H-x C-c uM-x crux-view-urlOpen a new buffer containing the contents of URL.
H-x H-x C-c eM-x crux-eval-and-replaceEval a bit of Emacs Lisp code and replace it with its result.
H-x H-x C-x 4 tM-x crux-transpose-windowsTranspose the buffers between two windows.
H-x H-x C-c DM-x crux-delete-file-and-bufferDelete current file and buffer.
H-x H-x C-c cM-x crux-copy-file-preserve-attributesCopy current file with file attributes preserved
H-x H-x C-c dM-x crux-duplicate-current-line-or-regionDuplicate the current line (or region).
H-x H-x C-c M-dM-x crux-duplicate-and-comment-current-line-or-regionDuplicate and comment the current line (or region).
H-x H-x C-c rM-x crux-rename-file-and-bufferRename the current buffer and its visiting file if any.
H-x H-x C-c tM-x crux-visit-term-bufferOpen a terminal emulator (ansi-term).
H-x H-x C-c kM-x crux-kill-other-buffersKill all open buffers except the one you’re currently in.
H-x H-x C-M zM-x crux-indent-defunIndent the definition at point.
H-x H-x C-c TABM-x crux-indent-rigidly-and-copy-to-clipboardIndent and copy region to clipboard
H-x H-x C-c IM-x crux-find-user-init-fileOpen user’s init file.
H-x H-x C-c ,M-x crux-find-user-custom-fileOpen user’s custom file.
H-x H-x C-c SM-x crux-find-shell-init-fileOpen shell’s init file.
H-x H-x C-jM-x crux-top-join-lineJoin lines
H-x H-x C-KM-x crux-kill-whole-lineKill whole line
H-x H-x C-BCKM-x crux-kill-line-backwardsKill line backwards
H-x H-x C-S-BCKM-x crux-kill-and-join-forwardIf at end of line, join with following; otherwise kill line.
H-x H-x C-c PM-x crux-kill-buffer-truenameKill absolute path of file visited in current buffer.
H-x H-x C-c iM-x crux-ispell-word-then-abbrevFix word using ispell and then save to abbrev.
H-x H-x C-x C-uM-x crux-upcase-regionUpcase-region when transient-mark-mode is on and region is active.
H-x H-x C-x C-lM-x crux-downcase-regionDowncase-region when transient-mark-mode is on and region is active.
H-x H-x C-x M-cM-x crux-capitalize-regionCapitalize-region when transient-mark-mode is on and region is active.
H-x H-x M-oM-x crux-other-window-or-switch-bufferSelect other window, or switch to most recent buffer if only one windows.

Edit multiple regions

The package iedit provides two Emacs minor modes iedit-mode and iedit-rectangle-mode and allows you to edit one occurrence of some text in a buffer (possibly narrowed) or region, and simultaneously have other occurrences edited in the same way, with visual feedback as you type.

See also:

Key bindingCommandDescription
H-;M-x iedit-modeToggle iedit-mode.

Easy duplicate

The package duplicate-thing provides functionality that allows you to duplicate whatever’s marked, i.e. easy duplication of line or region, with comment out.

Duplicate line or region N times.

  • If it has active mark, it will expand the selection and duplicate it.
  • If it doesn’t have active mark, it will select current line and duplicate it.
Key bindingCommandDescription
M-cM-x psimacs/string/duplicate-thingDuplicate whatever’s marked, i.e. easy duplication of line or region, with comment out.

Help on Psimacs

Provide access to the HTML documentation of Psimacs.

Key bindingCommandDescription
H-h H-p cM-x psimacs/help/browse-psimacs-configOpen default browser and shows the Psimacs configuration export.
H-h H-p kM-x psimacs/help/browse-psimacs-keysOpen default browser and shows the Psimacs keys.
H-h H-p bM-x psimacs/help/browse-psimacs-key-listOpen default browser and shows the Psimacs listed keys.
H-h H-p CM-x psimacs/help/org-psimacs-configOpen org buffer with Psimacs configuration.
H-h H-p KM-x psimacs/help/org-psimacs-keysOpen org buffer and shows the Psimacs keys.
H-h H-p BM-x psimacs/help/org-psimacs-key-listOpen org buffer and shows the psimacs listed keys.

Helm

Psimacs uses the Helm as well as the Ivy / Counsel framework. It is more focused towards the Ivy / Counsel tools none the less. They both can be used side by side. In Psimacs, however Ivy / Counsel takes preference.

Helm is an Emacs framework for incremental completions and narrowing selections. It provides an easy-to-use API for developers wishing to build their own Helm applications in Emacs, powerful search tools and dozens of already built-in commands providing completion to almost everything. It is a must-have for anyone using Emacs as a main work environment.

References:

See also:

Key bindings that related to Helm:

Key bindingCommandDescription
C-x cM-x helm-command-prefixPrefix key for Helm commands.
C-x c /M-x helm-findHelm for find shell command.
C-x c 8M-x helm-ucsHelm for ‘usc-names’.
C-x c @M-x helm-list-elisp-packagesHelm for listing and handling packages.
C-x c FM-x helm-select-xfontHelm to select Xfont.
C-x c IM-x helm-imenu-in-all-buffersHelm for fetching imenu entries in all buffers with similar mode as current.
C-x c aM-x helm-aproposHelm to describe commands, functions, variables and faces.
C-x c bM-x helm-resumeResume a previous Helm session.
C-x c cM-x helm-colorsHelm for colors.
C-x c eM-x helm-etags-selectHelm for etags.
C-x c fM-x helm-multi-filesLike helm-for-files but running locate only on demand.
C-x c iM-x helm-imenuHelm for imenu.
C-x c lM-x helm-locateHelm for ‘Locate’.
C-x c mM-x helm-man-womanHelm for Man and Woman pages.
C-x c pM-x helm-list-emacs-processHelm for Emacs process.
C-x c rM-x helm-regexpHelm for building regexps.
C-x c sM-x helm-surfrawHelm to search PATTERN with search ENGINE.
C-x c tM-x helm-topHelm for top command.
C-x c C-,M-x helm-calcul-expressionHelm for helm-source-calculation-result.
C-x c C-:M-x helm-eval-expression-with-eldocHelm for helm-source-evaluation-result with ‘eldoc’ support.
C-x c <tab>M-x helm-lisp-completion-at-pointHelm for Lisp symbol completion at point.
C-x c h gM-x helm-info-gnusHelm for gnus info.
C-x c h hM-x helm-documentationHelm for Helm documentation.
C-x c h iM-x helm-info-at-pointHelm for searching info at point.
C-x c h rM-x helm-info-emacsHelm for Emacs info.
C-x c C-c C-xM-x helm-run-external-commandHelm to run external program asynchronously from Emacs.
C-x c C-c SPCM-x helm-all-mark-ringsHelm for helm-source-global-mark-ring and helm-source-mark-ring.
C-x c C-c fM-x helm-recentfHelm for recently used files.
C-x c M-xM-x helm-M-xHelm for Emacs commands
C-x c C-c gM-x helm-google-suggestHelm for Google search with Google suggest.
C-x c M-yM-x helm-show-kill-ringHelm for kill-ring.
C-x c M-s oM-x helm-occurHelm for searching lines matching pattern in ‘current-buffer’.
C-x c M-g aM-x helm-do-grep-agHelm for grepping with AG in default directory.
C-x c M-g iM-x helm-gidHelm for gid command line of ID-Utils.
C-x c C-x C-bM-x helm-buffers-listHelm to list buffers.
C-x c C-x C-fM-x helm-find-filesHelm implementatio of find-file.
C-x c C-x r bM-x helm-filtered-bookmarksHelm for bookmarks filtered by category.
C-x c C-x r iM-x helm-registerHelm for Emacs registers.
H-h H-h bM-x helm-descbindsHelm for describe-bindings.
H-h H-h mM-x helm-describe-modesHelm for describe-mode.
M-x helm-helpGenerate Helm’s help
M-x helm-infoHelm for searching Info files.
M-x helm-modeToggle generic helm completion.

Discoverability

Emacs is quite a complicated beast that is not easy to get acquainted with. Fortunately, few packages are available that mitigate the learning curve. The following packages let you discover key bindings, modes etc.

Package discover-my-major allows to discover key bindings and descriptions for commands defined by a buffer’s major and minor modes.

Key bindingCommandDescription
H-h C-d mM-x discover-my-majorCreate a listing of all major-mode keys with their description.
H-h C-d MM-x discover-my-modeCreate a listing of all MODE keys with their description.

Helm-Descbinds

The package helm-descbinds provides an interface to *Emacs’s describe-bindings making the currently active key bindings interactively searchable with helm.

Key bindingCommandDescription
H-h H-h bM-x helm-descbindsCreate a listing of all key bindings of current major mode.

Helm-Describe-Modes

The package helm-describe-modes provides a Helm interface to Emacs’s describe-mode. It lists the major mode, active minor modes, and inactive minor modes using Helm, and provides actions for each mode.

Key bindingCommandDescription
H-h H-h mM-x helm-describe-modesCreate a listing of all modes of current major mode.

Which Key

Which-key is a minor mode for Emacs that displays the key bindings following your currently entered incomplete command (a prefix) in a popup. IMHO, this package is one of the most useful packages for Emacs.

Key bindingCommandDescription
H-m C-u C-w tM-x psimacs/which-key/toggle-sort-orderToggle the which-key-mode sort order.
H-m C-u C-w cM-x psimacs/which-key/cycle-sort-orderCycle through the which-key-mode sort orders.

Swiper / Ivy / Counsel

Swiper gives us a really efficient incremental search with regular expressions and Ivy / Counsel replace a lot of ido or helms completion functionality

See also:

Key bindingCommandDescription
C-sM-x swiper-iseachA swiper that’s not line-based. Incrementally search with an overview.
C-rM-x swiperIncrementally search with an overview.
C-c vM-x ivy-push-viewPush the current window tree on ivy-views
C-c VM-x ivy-pop-viewDelete a view to delete from ivy-views.
H-m C-s aM-x swiper-allIncrementally search in all open buffers.
H-m C-s sM-x isearch-forwardIncrementally search forward.
H-m C-s rM-x isearch-backwardIncrementally search backward.
H-sM-x psimacs/config/isearch-menuIn isearch mode, opens an isearch menu, allowing to easily utilize the functionality.
H-m C-s w RETM-x counsel-searchInteractively search the web with counsel.
H-m C-s w tM-x psimacs/web/counsel/toggle-search-engineToggle the search engine of ‘counsel-search’ between duckduckgo and google.

Ivy

Ivy is for quick and easy selection from a list. When Emacs prompts for a string from a list of several possible choices, Ivy springs into action to assist in narrowing and picking the right string from a vast number of choices.

Key bindingCommandDescription
C-x bM-x ivy-switch-bufferSwitch to another buffer.
C-c C-S-rM-x ivy-resumeResumes the last Ivy-based completion.
M-yM-x ivy-next-lineIn minibuffer, Move cursor vertically down.
H-w C-'M-x ivy-avyUses avy to select one of the candidates on the current candidate page.

See also Ivy User Manual

The package ivy-hydra provides a hydra for ivy.

Key bindingCommandDescription
H-SPC iM-x hydra-ivy/bodyIvy…

Counsel

To keep concerns separated, Ivy doesn’t have a lot of other functionality. That’s where Counsel comes in.

Ivy mode ensures that any Emacs command using completing-read-function uses ivy for completion. Counsel takes this further, providing versions of common Emacs commands that are customised to make the best use of ivy.

Key bindingCommandDescription
M-xM-x counsel-M-xIvy version of execute-extended-command.
C-M-iM-x counsel-imenuJump to a buffer position indexed by imenu.
C-x C-fM-x counsel-find-fileCounsel, forward to find-file.
C-c bM-x counsel-bookmarkForward to bookmark-jump or bookmark-set if bookmark does not exist.
C-c cM-x counsel-compileCall compile completing with smart suggestions, optionally for DIR.
C-c dM-x counsel-dired-jumpJump to a directory below the current directory.
C-c FM-x counsel-org-fileBrowse all attachments for current Org file.
C-c gM-x counsel-gitFind file in the current git repository.
C-c jM-x counsel-git-grepGrep for a string in the current Git repository.
C-c LM-x counsel-git-logCall the git log --grep shell command.
C-c JM-x counsel-file-jumpJump to a file below the current directory..
C-c kM-x counsel-agGrep for a string in a root directory using ag.
C-c lM-x counsel-locateCall a “locate” style shell command.
M-yM-x counsel-yank-popIvy replacement for yank-pop.
C-h fM-x counsel-describe-functionForward to describe-function.
C-h iM-x counsel-info-lookup-symbolForward SYMBOL to info-lookup-symbol with ivy completion.
C-h jM-x counsel-set-variableSet a variable SYM with completion.
C-h lM-x counsel-find-libraryFind Emacs Lisp source. Forward to find-library.
C-h uM-x counsel-unicode-charInsert COUNT copies of a unicode char at point.
C-h vM-x counsel-describe-variableForward to describe-function.
C-rM-x counsel-minibuffer-historyBrowse minibuffer history.
C-rM-x counsel-expression-historyIn read-expression-map

Amx

It provides several enhancements over the ordinary execute-extended-command, such as prioritizing your most-used commands in the completion list and showing keyboard shortcuts.

Key bindingCommandDescription
H-m H-x xM-x amx-major-mode-commandsRuns Amx, limited to commands that are relevant to the active major mode.
H-m H-x mM-x amx-modeToggle amx-mode.
H-m H-x uM-x amx-show-unbound-commandsShows frequently used commands that have no key bindings.

Frog jumping

The package frog-jump-buffer is the spiritual successor to ace-jump-buffer and is powered by avy via frog-menu. Just like ace-jump-buffer, it allows you to hop to any Emacs buffer in 2-3 key strokes.

Key bindingCommandDescription
H-bM-x frog-jump-bufferPresents a frog-menu for jumping to an open buffer.
H-BM-x frog-jump-buffer-other-windowPresents a frog-menu for jumping to an open buffer in other window.

Company

Company is a text completion framework for Emacs. The name stands for “complete anything”. It uses pluggable back-ends and front-ends to retrieve and display completion candidates.

It comes with several back-ends such as Elisp, Clang, Semantic, Eclim, Ropemacs, Ispell, CMake, BBDB, YASnippet, dabbrev, etags, gtags, files, keywords and a few others.

See also:

Key bindingCommandDescription
C-nM-x company-select-nextNext completion.
C-pM-x company-select-previousPrevious completion.
ESCM-x company-abortAbort completion.
TABM-x company-complete-selectionComplete Selection.

Company-try-hard

company-try-hard is a package that enhances the company-mode. It provides a company-complete alternative that tries much harder to find completions. If none of the current completions look good, call the command again to try the next backend.

Key bindingCommandDescription
H-m <tab>M-x company-try-hardTry hard to find a completion. If none of the current completions look good, call the command again to try the next backend.

Snippets

The package Yasnippet provides a template system for Emacs. It allows you to type an abbreviation and automatically expand it into function templates.

Bundled language templates include:

See also:

Key bindingCommandDescription
H-x xM-x yas-insert-snippetChoose a snippet to expand, popup a list of choices according.
C-c & C-nM-x yas-new-snippetCreates a new buffer with a template for making a new snippet.
C-c & C-vM-x yas-visit-snippet-filePrompts you for possible snippet expansions and takes you directly to the snippet definition’s file, if it exists.
C-c C-lM-x yas-load-snippet-bufferPrompts for a snippet table and loads the snippet currently being edited.
C-c C-cM-x yas-load-snippet-buffer-and-closePrompts for a snippet table and loads the snippet currently being edited. Also saves the snippet and calls quit-window. The destination is decided based on the chosen snippet table and snippet collection directly.
C-c C-tM-x yas-tryout-snippetWhen editing a snippet, this opens a new empty buffer, sets it to the appropriate major mode and inserts the snippet there, so you can see what it looks like.

Auto-YASnippet

Auto-YASnippet is a hybrid of keyboard macros and YASnippet. You create the snippet on the go and it’ll be ready to use immediately. Because you’re not leaving the current buffer the workflow is very fast.

Key bindingCommandDescription
H-m C-y wM-x aya-createCreate a snippet from the text between BEG and END.
H-m C-y TABM-x aya-expandInsert the last yasnippet created by aya-create.
H-m C-y SPCM-x aya-expand-from-historySelect and insert a yasnippet from the aya-history.
H-m C-y dM-x aya-delete-from-historySelect and delete one or more snippets from aya-history.
H-m C-y cM-x aya-clear-historyClear aya-history.
H-m C-y nM-x aya-next-in-historySet aya-current to the next item in history. Wraps at the end of history.
H-m C-y pM-x aya-previous-in-historySet aya-current to the previous item in history. Wraps around at start of history.
H-m C-y sM-x aya-persist-snippetSave the current auto-snippet to a user snippets folder. The current major-mode name will be used to determine the snippets sub-directory to store the snippet.
H-m C-y oM-x aya-open-lineGeneric expansion function. It will either expand or move to the next field depending on the context.

Treemacs

Treemacs is a tree layout file explorer for Emacs.

Key bindingsDescription
?Summon the helpful hydra.
nNext item.
pPrevious item.
M-nNext item on same level.
M-pPrevious item on same level.
uParent item.
C-nNext project.
C-pPrevious project.
oOpen…
qQuit treemacs.
Key bindingCommandDescription
H-m C-x C-tM-x treemacsOpen treemacs.
H-m C-x t tM-x treemacs-select-windowSelect the treemacs window.
H-m C-x t 1M-x treemacs-delete-other-windowsSame as delete-other-window but does not delete the treemacs window.
H-m C-x t BM-x treemacs-bookmarkFind a bookmark in treemacs.
H-m C-x t C-tM-x treemacs-find-fileFind and focus the current file in the current treemacs window.
H-m C-x t M-tM-x treemacs-find-tagFind and move the point to the tag at point in the treemacs view.

Neotree

Package Neotree provides a file tree browser for Emacs. File tree browser.

Bindings in the Neotree buffer:

Key bindingsDescription
nNext item.
pPrevious item.
SPCOpen current item if it is a file. Fold/Unfold current item if it is a directory.
RETSame as SPC.
TABSame as SPC and RET.
ORecursively open a directory.
UUp diretory.
gRefresh.
AMaximize/Minimize Neotree window.
HToggle display of hidden files.
C-c C-nCreate a file or create a directory if filename ends with a ‘/’.
C-c C-dDelete a file or directory.
C-c C-rRename a file or directory.
C-c C-cChange the root directory.
C-c C-pCopy a file or directory.

Global bindings:

Key bindingCommandDescription
H-m C-x C-nM-x neotree-toggleOpen Neotree.

Projectile

Project management is important in order to be able to work with projects that consist of many files and that have special project related rules.

One of the most important thing to install at first is projectile, for manage projects in Emacs.

Projectile is a project interaction library for Emacs. Its goal is to provide a nice set of features operating on a project level without introducing external dependencies. This library provides easy project management and navigation.

The concept of a project is pretty basic - just a folder containing special file.

See also:

Only the basic commands:

Key bindingCommandDescription
C-c p fM-x projectile-find-fileFind file in current project
C-c p pM-x projectile-switch-projectSwitch project
C-c p s gM-x projectile-grepGrep in project
C-c p rM-x projectile-replaceReplace in project
C-c p mM-x projectile-commanderInvoke a command via the Projectile Commander

All bound commands:

Key bindingCommandDescription
C-c p fM-x projectile-find-fileDisplay a list of all files in the project. With a prefix argument it will clear the cache first.Find file in current project.
C-c p FM-x projectile-find-file-in-known-projectsDisplay a list of all files in all known projects.
C-c p gM-x projectile-find-file-dwimDisplay a list of all files at point in the project. With a prefix argument it will clear the cache first.
C-c p 4 fM-x projectile-find-file-other-windowJump to a project’s file using completion and show it in another window.
C-c p 4 gM-x projectile-find-file-dwim-other-windowJump to a project’s file based on context at point and show it in another window.
C-c p 5 fM-x projectile-find-file-other-frameJump to a project’s file using completion and show it in another frame.
C-c p 5 gM-x projectile-find-file-dwim-other-frameJump to a project’s file based on context at point and show it in another frame.
C-c p aM-x projectile-find-other-fileSwitch between files with the same name but different extensions.
C-c p 4 aM-x projectile-find-other-file-other-windowSwitch between files with the same name but different extensions in other window.
C-c p 5 aM-x projectile-find-other-file-other-frameSwitch between files with the same name but different extensions in other frame.
C-c p lM-x projectile-find-file-in-directoryDisplay a list of all files in a directory (that’s not necessarily a project).
C-c p eM-x projectile-recentfShows a list of recently visited project files.
C-c p dM-x projectile-find-dirDisplay a list of all directories in the project. With a prefix argument it will clear the cache first.
C-c p 4 dM-x projectile-find-dir-other-windowSwitch to a project directory and show it in another window.
C-c p 5 dM-x projectile-find-dir-other-frameSwitch to a project directory and show it in another frame.
C-c p DM-x projectile-diredOpens the root of the project in dired.
C-c p 4 DM-x projectile-dired-other-windowOpens the root of the project in dired in another window.
C-c p 5 DM-x projectile-dired-other-frameOpens the root of the project in dired in another frame.
C-c p jM-x projectile-find-tagFind tag in project.
C-c p TM-x projectile-find-test-fileDisplay a list of all test files(specs, features, etc) in the project.
C-c p s gM-x projectile-grepRun grep on the files in the project.
M-- C-c p s gRun grep on projectile-grep-default-files in the project.
C-c p vM-x projectile-vcRun vc-dir on the root directory of the project.
C-c p VM-x projectile-browse-dirty-projectsBrowse dirty version controlled projects.
C-c p IM-x projectile-ibufferOpen an IBuffer window showing all buffers in the current project.
C-c p bM-x projectile-switch-to-bufferDisplay a list of all project buffers currently open.
C-c p 4 bM-x projectile-switch-to-buffer-other-windowSwitch to a project buffer and show it in another window.
C-c p 5 bM-x projectile-switch-to-buffer-other-frameSwitch to a project buffer and show it in another frame.
C-c p 4 C-oM-x projectile-display-bufferDisplay a project buffer in another window without selecting it.
C-c p kM-x projectile-kill-bufferKills all project buffers.
C-c p oM-x projectile-multi-occurRuns multi-occur on all project buffers currently open.
C-c p rM-x projectile-replaceRuns interactive query-replace on all files in the projects.
C-c p RM-x projectile-regenerate-tagsRegenerate the project’s tags.
C-c p s rM-x projectile-ripgrepRun a Ripgrep search with ‘SEARCH-TERM’ at current root.
C-c p iM-x projectile-invalidate-cacheInvalidates the project cache (if existing).
C-c p pM-x projectile-switch-projectDisplay a list of known projects you can switch to.
C-c p SM-x projectile-save-project-buffersSave all project buffers.
C-c p <left>M-x projectile-previous-project-bufferSwitch to the previous project buffer.
C-c p <right>M-x projectile-next-project-bufferSwitch to the next project buffer.
C-c p qM-x projectile-switch-open-projectSwitch to a project we have currently opened.
C-c p ESCM-x projectile-project-buffers-other-bufferSwitch to the most recently selected Projectile buffer.
C-c p EM-x projectile-edit-dir-localsOpens the root dir-locals-file of the project.
C-c p s sM-x projectile-agRuns ag on the project, performing a literal search.
C-c p !M-x projectile-run-shell-command-in-rootRuns shell-command in the root directory of the project.
C-c p x sM-x projectile-run-shellInvoke ‘shell’ in the project’s root.
C-c p x vM-x projectile-run-vtermInvoke ‘vterm’ in the project’s root.
C-c p x eM-x projectile-run-eshellInvoke ‘eshell’ in the project’s root.
C-c p uM-x projectile-run-projectRun project run command.
C-c p PM-x projectile-test-projectRun project test command.
C-c p x gM-x projectile-run-gdbInvoke ‘gdb’ in the project root.
C-c p &M-x projectile-run-async-shell-command-in-rootRuns async-shell-command in the root directory of the project.
C-c p CM-x projectile-configure-projectRuns a standard configure command for your type of project.
C-c p cM-x projectile-compile-projectRuns a standard compilation command for your type of project.
C-c p LM-x projectile-install-projectRun project install command.
C-c p KM-x projectile-package-projectRun project package command.
C-c p tM-x projectile-toggle-between-implementation-and-testToggle between an implementation file and its test file.
C-c p 4 tM-x projectile-find-implementation-or-test-other-windowJump to implementation or test file in other window.
C-c p 5 tM-x projectile-find-implementation-or-test-other-frameJump to implementation or test file in other frame.
C-c p zM-x projectile-cache-current-fileAdds the currently visited file to the cache.
C-c p mM-x projectile-commanderExecute a Projectile command with a single letter.
C-c p C-e e cM-x psimacs/projectile/create-projectile-envrc-emscriptenWrite a .projectile-envrc file for Emscripten support into the current projectile project root.
C-c p C-e e dM-x psimacs/projectile/destroy-projectile-envrc-emscriptenRemove the .projectile-envrc file for Emscripten from the current projectile project root.

Special global commands:

Key bindingCommandDescription
C-c p C-nM-x psimacs/projectile/create-empty-projectile-fileChoose diretory and create an empty ‘.projectile’ file.

projectile-envrc

The package projectile-envrc allows setting, modifying and removing of process environment variables from a simple ‘.projectile-envrc’ description file that resides in the projectile project root directory.

The file format for ‘.projectile-envrc’ is quite simple: Only lines that begin with ‘+’, ‘-‘, ’:’ or ‘:’ are considered. Everything else is ignored.

SpecifierDescription
+Add variable/value to the process environent.
-Remove variable from the process environent.
*:Prepend to the process environment variable.
:*Append to the process environment variable.

Example ‘.projectile-envrc’ file:

#
# Hi there this is ignored
#

+TIK = Hallo World
+TAK = "A small test"
*:PATH = c:/utils/testA
*:PATH = c:/utils/testB
:*PATH = c:/utils/testC
:*PATH = c:/utils/testD
+TOK   = c:/utils/testE
-OSG_LOG_FILE
+TOE   = c:/utils/testF

projectile-cmake

The package projectile-cmake gives fine grained support of CMake with Emacs projectile.

Key bindingCommandDescription
C-c C-p s CM-x projectile-cmake-select-configurationSelect the cmake configuration data. Convenience function calling other select functions.
C-c C-p s dM-x projectile-cmake-select-build-dirSelect the current project build dir.
C-c C-p s tM-x projectile-cmake-select-build-typeSelect the current project build type.
C-c C-p s gM-x projectile-cmake-select-generatorSelect the current project configuration generator.
C-c C-p s aM-x projectile-cmake-select-architectureSelect the current project configuration architecture.
C-c C-p s sM-x projectile-cmake-select-toolsetSelect the current project configuration toolset.
C-c C-p s cM-x projectile-cmake-select-toolchainSelect the current project configuration toolchain.
C-c C-p s r gM-x projectile-cmake-select-run-fileSelect the file that should be run for the project.
C-c C-p s r dM-x projectile-cmake-select-run-file-debugSelect the file that should be run for the debug project.
C-c C-p s r rM-x projectile-cmake-select-run-file-releaseSelect the file that should be run for the release project.
C-c C-p s r iM-x projectile-cmake-select-run-file-release-with-debug-infoSelect the file that should be run for the release with debug info project.
C-c C-p s r mM-x projectile-cmake-select-run-file-minimal-size-releaseSelect the file that should be run for the minimal size release project.
C-c C-p t dM-x projectile-cmake-toggle-run-in-build-dirToggle the run in build directory flag variable.
C-c C-p hM-x hydra-projectile-cmake/bodyHydra for projectile-cmake.

Treemacs-projectile

The package treemacs-projectile is a small package that contains some utility functions that simplify adding your projectile projects to treemacs.

Key bindingCommandDescription
H-m C-x t pM-x treemacs-projectileAdd one of projectile-known-projects to the treemacs workspace.

Dashboard

The dashboard is an extensible Emacs startup screen showing you what’s most important.

Key bindingCommandDescription
C-<f8>M-x psimacs/dashboard/open-dashboardOpen the dashboard.
HM-x psimacs/dashboard/homepageOpen the Psimacs homepage.
RM-x psimacs/dashboard/restore-previous-sessionRestore previous session.
LM-x psimacs/dashboard/restore-sessionRestore session.
SM-x psimacs/dashboard/open-custom-fileOpen the Custom.el file.
q QM-x psimacs/dashboard/quit-dashboardQuit the dashboard.
hM-x psimacs/hydra/dashboard/bodyOpen dashboard hydra.
?M-x psimacs/hydra/dashboard/bodyOpen dashboard hydra.
rM-x psimacs/dashboard/goto-recent-filesGoto recent file section.
mM-x psimacs/dashboard/goto-bookmarksGoto bookmarks section.
pM-x psimacs/dashboard/goto-projectsGoto projects section.
aM-x psimacs/dashboard/goto-agendasGoto agenda section.
eM-x psimacs/dashboard/goto-registersGoto register section.
<ret>M-x dashboard-returnOpen item.
<tab> C-iM-x widget-forwardNext item.
S-<tab>M-x widget-backwardPrevious item.
j C-nM-x dashboard-next-lineNext line.
k C-pM-x dashboard-previous-linePrevious line.

Dashboard hyda bindings:

Key bindingCommandDescription
HM-x psimacs/dashboard/homepageOpen the Psimacs homepage.
RM-x psimacs/dashboard/restore-previous-sessionRestore previous session.
LM-x psimacs/dashboard/restore-sessionRestore session.
SM-x psimacs/dashboard/open-custom-fileOpen the Custom.el file.
qQuit hydra
rM-x psimacs/dashboard/goto-recent-filesGoto recent file section.
mM-x psimacs/dashboard/goto-bookmarksGoto bookmarks section.
pM-x psimacs/dashboard/goto-projectsGoto projects section.
aM-x psimacs/dashboard/goto-agendasGoto agenda section.
eM-x psimacs/dashboard/goto-registersGoto register section.
<ret>M-x dashboard-returnOpen item.
<tab> C-iM-x widget-forwardNext item.
S-<tab>M-x widget-backwardPrevious item.
j C-nM-x dashboard-next-lineNext line.
k C-pM-x dashboard-previous-linePrevious line.
C-<f8>M-x psimacs/dashboard/open-dashboardOpen the dashboard.
gM-x dashboard-refresh-bufferRefresh dashboard contents.
QM-x psimacs/dashboard/quit-dashboardQuit dashboard.

Page-break lines

The page-break-lines package provides a global mode which displays ugly form feed characters as tidy horizontal rules.

Key bindingCommandDescription
C-x ]M-x forward-pageMove forward to page boundary.
C-x [M-x backward-pageMove backward to page boundary.

Magit

Magit is an interface to the version control system Git , implemented as an Emacs package.

Magit is a complete text-based user interface to Git. It fills the glaring gap between the Git command-line interface and various GUIs, letting you perform trivial as well as elaborate version control tasks with just a couple of mnemonic key presses. Magit looks like a prettified version of what you get after running a few Git commands but in Magit every bit of visible information is also actionable to an extent that goes far beyond what any Git GUI provides and it takes care of automatically refreshing this output when it becomes outdated. In the background Magit just runs Git commands and if you wish you can see what exactly is being run, making it possible for you to learn the git command-line by using Magit.

Using Magit for a while will make you a more effective version control user. Magit supports and streamlines the use of Git features that most users and developers of other Git clients apparently thought could not be reasonably mapped to a non-command-line interface. Magit is both faster and more intuitive than either the command line or any GUI and these holds for both Git beginners and experts alike.

See also:

Key bindingCommandDescription
C-x gM-x magit-statusRun git status command.

Else Mode

Peter Milliken has created a minor mode for Emacs called the Emacs Language Sensitive Editor (ELSE).

ELSE is a minor mode for Emacs, designed to work with any major mode. The aim is to provide a seamless mechanism to generate language constructs easily and intuitively with a minimum of keystrokes and interference with the user. It’s primary application is a minor mode for any programming language (major mode) but it can be used for any editing task that involves generation of repetitive text/blocks of text e.g. there is a template file for Texinfo mode.

See also:

Key bindingCommandDescription
H-eM-x else-expandExpand the placeholder or any preceeding abbreviation at point.
H-EM-x else-expand-or-next-expandExpand if possible else move to next and expand this one.
H-nM-x else-nextMove ‘point’ to the ‘next’ placeholder.
H-pM-x else-previousMove `point’ to the (nth) previous placeholder.
H-NM-x else-expand-or-next-expandExpand if possible else move to next and expand this one.
H-PM-x else-expand-or-previous-expandExpand if possible else move to previous and expand this one.
H-C-nM-x else-kill-or-next-killKill if possible else move to next and kill this one.
H-C-pM-x else-kill-or-previous-killKill if possible else move to previous and kill this one.
H-kM-x else-killKill the placeholder at point.
H-KM-x psimacs/else/kill-alwaysLike else-kill but kills required placeholders without prompting.
H-m C-c mM-x else-modeEnable/disable else-mode.
H-m C-c eM-x else-expandExpand the placeholder or any preceeding abbreviation at point.
H-m C-c EM-x else-expand-or-next-expandExpand if possible else move to next and expand this one.
H-m C-c nM-x else-nextMove ‘point’ to the ‘next’ placeholder.
H-m C-c pM-x else-previousMove `point’ to the (nth) previous placeholder.
H-m C-c NM-x else-expand-or-next-expandExpand if possible else move to next and expand this one.
H-m C-c PM-x else-expand-or-previous-expandExpand if possible else move to previous and expand this one.
H-m C-c C-nM-x else-kill-or-next-killKill if possible else move to next and kill this one.
H-m C-c C-pM-x else-kill-or-previous-killKill if possible else move to previous and kill this one.
H-m C-c kM-x else-killKill the placeholder at point.
H-m C-c KM-x psimacs/else/kill-alwaysLike else-kill but kills required placeholders without prompting.
H-m C-c C-cM-x else-template-compile-bufferCompile the whole current buffer.
M-x else-compile-bufferCompile the language template definitions.
M-x else-extract-placeholderPlace the definition of an placeholder into the buffer at point.
M-x else-extract-allExtract the full language definition at point.
M-x else-show-placeholder-namesDisplay info on all Placeholders in the current language template set.

ELSE Grammar Compiler

ELSE, the Emacs Language Sensitive Editor, is a system for template generation aimed at reducing the amount of user typing and to operate seamlessly with a minimum of interference to the user. ELSE is implemented as a minor mode and can work with any major mode. As ELSE is invoked the first time for each major mode, it will load a template file specific to that mode.

The ELSE grammar compiler is a tool written specifically to generate these ELSE template files from an ANTLR language grammar specification.

The tools provided in this section provide a simple workflow for working on a ANTLR grammar file and creating a final ELSE template file ready to use in Psimacs.

Reference:

This simplistic ANTLRv4 major mode implementation allows to work on a ANTLRv4 file buffer. It provides syntax highlighting and supports the special annotation system that has been added to the ANTLRv4 specification in order to provide extra meta information for the ELSE framework.

Key bindingCommandDescription
C-c C-cM-x psimacs/antlrv4/create-else-grammarCreate a ELSE language specification from the ANTLRv4 grammar found in the current buffer.
C-c C-vM-x psimacs/antlrv4/create-visualization-from-grammarCreate a HTML visualization of the ANTLRv4 grammar found in the current buffer.

String Inflection

String-inflection is a nifty package to cycle through string case styles: camel, snake, kebab… The package includes a handful of cycling functions for different languages (Ruby, Python and Java), but it’s easy to mix and match to roll your own.

Key bindingCommandDescription
H-m H-l=M-x string-inflection-all-cyclefoo_bar => FOO_BAR => FooBar => fooBar => foo-bar => Foo_Bar => foo_bar.

Language Server Protcol LSP

The Language Server Protocol (v3.14) describes an client/server protocol for programming langugage servers and clients.

See also

Remarks:

  • cmake -H. -BDebug -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=YES
  • set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Dap-Mode

The package dap-mode provides an Emacs client library that allow the communication to a Debug server that supports the Debug Adapter Protocol, which is a wire protocol between the client and the Debug server. It’s similar to the Lsp-mode but provides integration with a debug server.

Dap-mode provides the following commands:

Key bindingCommandDescription
<f9>M-x dap-breakpoint-toggleToggle breakpoint at line.
S-<f9>M-x dap-breakpoint-deleteDelete breakpoint at line.
C-S-<f9>M-x dap-breakpoint-delete-allDelete all breakpoints.
C-<f9>M-x dap-breakpoint-addAdd breakpoint at line.
M-<f9>M-x dap-breakpoint-conditionSet/unset breakpoint condition.
C-M-<f9>M-x dap-breakpoint-hit-conditionSet/unset breakpoint hit condition.
S-M-<f9>M-x dap-breakpoint-log-messageSet/unset breakpoint log message.
M-x dap-evalEval string.
M-x dap-eval-regionEval region string.
M-x dap-eval-thing-at-pointEval symbol at point.
<f10>M-x dap-nextDebug next.
C-<f10>M-x psimacs/dap/run-to-cursorAdd breakpoint at point and continue.
<f11>M-x dap-step-inDebug step in.
S-<f11>M-x dap-step-outDebug step out.
M-x dap-stop-threadStop thread.
S-<f6>M-x dap-restart-frameRestarts current frame.
<f6>M-x dap-continueDebug continue.
S-<f5>M-x dap-disconnectCancel current debug session.
M-x dap-switch-stack-frameSwitch active stack frame.
M-x dap-switch-threadSwitch active thread.
M-x dap-switch-sessionSwitch active session.
M-x dap-debug-edit-templateGenerate run command.
<f5>M-x dap-debugCreate and run new configuration using the available templates.
M-<f5>M-x dap-debug-lastDebug previous configuration.
C-M-<f5>M-x dap-debug-recentSelect configuration to run from the previously started command.
C-S-<f5>M-x dap-debug-restartRestarts current frame.
M-x dap-go-to-output-bufferGo output buffer.
M-x dap-ui-sessionsShow active/terminated sessions view.
M-x dap-ui-localsShow locals view.
M-x dap-ui-expressionsShow expressions view.
M-x dap-ui-breakpointsShow breakpoints view.
M-x dap-ui-replDAP UI REPL.
M-x dap-ui-modeDisplay the DAP visuals.
M-x dap-ui-any-windows-modeShow/Hide the windows from dap-auto-configure-features.
M-x dap-ui-show-many-windowsShow auto configured feature windows.
M-x dap-ui-hide-many-windowsHide auto configured feature windows.
M-x dap-tm-loaded-sourcesLoaded sources can be viewed by invoking this command.
C-c-l <tab>M-x company-indent-or-complete-commonIndent the current line or region, or complete the common part.
<f7>M-x dap-hydraOpens a dap-mode hydra.
C-c l C-c h dM-x dap-hydraOpens a dap-mode hydra.
H-SPC dM-x dap-hydraOpens a dap-mode hydra.

Breakpoints can be viewed after invoking dap-ui-breakpoints with:

Key bindingCommandDescription
\-RETM-x dap-ui-breakpoints-gotoGo to breakpoint under cursor.
dM-x dap-ui-breakpoints-deleteDelete breakpoint under cursor.
DM-x dap-ui-breakpoints-delete-selectedDelete selected breakpoints.
mM-x bui-list-markMark breakpoint under point.
uM-x bui-list-unmarkUnmark breakpoint under point.
UM-x bui-list-unmark-allUnmark breakpoint under point.

Dap-mode supports launch.json files out of the box, and there is nothing that needs to be enabled. All that needs to be done is to add a launch.json file at the project root and to run dap-debug. All configurations stored in the launch.json will automatically show up in the selection. launch.json files in dap-mode are just like in VSCode and even support variables.

Remarks:

  • Running M-x dap-cpptools-setup is necessary at least once.
  • Running M-x dap-debug-edit-template shows a function template to edit for a particular configuration. It looks like the following examples.

LSP-Mode

Lsp-mode is a client for Language Server Protocol (v3.14). Lsp-mode aims to provide IDE-like experience by providing optional integration with the most popular Emacs packages like company, Flycheck and projectile.

Currently, Psimacs uses lsp-mode for the following language modes:

  • c-mode
  • c++-mode
  • cmake-mode

Python-mode is handled by elpy at the moment. That might be changed in the future.

When using lsp-mode most of the features depend on server capabilities.

Lsp-mode provides default bindings which are dynamically enabled/disabled based on the server functionality. All the commands are configured lsp-command-map which is bound to lsp-keymap-prefix.

Psimacs binds lsp-mode commands to key prefix C-c l.

Following a survey of the lsp-mode command bindings:

Key bindingCommandDescription
C-c l s sM-x lspEntry point for the server startup.
C-c l s rM-x lsp-workspace-restartRestart workspace and language server.
C-c l s qM-x lsp-workspace-shutdownShutdown workspace and language server.
C-c l s dM-x lsp-describe-sessionDescribes current session.
C-c l s DM-x lsp-disconnectDisconnect the buffer from the language server keeping the server running.
C-c l = =M-x lsp-format-bufferAsk the server to format this document.
C-c l = rM-x lsp-format-regionAsk the server to format the region, or if none is selected, the current line.
C-c l F aM-x lsp-workspace-folders-addAdd new project root to the list of workspace folders.
C-c l F rM-x lsp-workspace-folders-removeRemove project root from the list of workspace folders.
C-c l F bM-x lsp-workspace-blacklist-removeRemove project root from the workspace blacklist.
C-c l T aM-x lsp-modeline-code-actions-modeToggle code actions on modeline.
C-c l T bM-x lsp-headerline-breadcrumb-modeToggle breadcrumb on headerline.
C-c l T LM-x lsp-toggle-trace-ioToggle client-server protocol logging.
C-c l T hM-x lsp-toggle-symbol-highlightToggle symbol highlighting.
C-c l T SM-x lsp-ui-sideline-modeToggle minor mode for showing information for current line in sideline.
C-c l T dM-x lsp-ui-doc-modeToggle minor mode for showing hover information in child frame.
C-c l T sM-x lsp-toggle-signature-auto-activateToggle signature auto activate.
C-c l T fM-x lsp-toggle-on-type-formatiingToggle on type formatting.
C-c l T DM-x lsp-modeline-diagnostics-modeToggle diagnostics modeline.
C-c l T TM-x lsp-treemacs-sync-modeToggle global minor mode for synchronizing lsp-mode workspace folders and treemacs projects.
C-c l g gM-x lsp-find-definitionFind definitions of the symbol under point.
C-c l g rM-x lsp-find-referencesFind references of the symbol under point.
C-c l g eM-x lsp-treemacs-errors-listDisplay error list.
C-c l g dM-x lsp-find-declarationFind declarations of the symbol under point.
C-c l g hM-x lsp-treemacs-call-hierarchyShow the incoming call hierarchy for the symbol at point.
C-c l g aM-x xref-find-aproposFind all meaningful symbols that match pattern.
C-c l G sM-x lsp-ui-peak-find-workspace-symbolFind symbols in the workspace.
C-c l h hM-x lsp-describe-thing-at-pointDisplay the type signature and documentation of the thing at
C-c l h sM-x lsp-signature-activateActivate signature help.
C-c l h gM-x lsp-ui-doc-glanceTrigger display hover information popup and hide it on next typing.
C-c l r rM-x lsp-renameRename the symbol (and all references to it).
C-c l r oM-x lsp-organize-importsPerform the source.organizeImports code action, if available.
C-c l a aM-x lsp-execute-code-actionExecute code action.
C-c l a hM-x lsp-document-highlightHighlight all relevant references to the symbol at point.
C-c l G gM-x lsp-ui-peek-find-definitionsPeek definitions to the identifier at point.
C-c l G rM-x lsp-ui-peek-find-referencesPeek references to the identifier at point.
C-c l G sM-x lsp-ui-peek-workspace-symbolPeek symbols in the workspace.
C-c l C-c iM-x lsp-ui-peek-find-implementationFind implementation locations of the symbol at point.
C-c l C-c mM-x lsp-ui-imenuOpen ui-imenu in side window.
C-c l C-c dM-x psimacs/lsp-ui-mode/toggle-lsp-ui-docMinor mode for showing information in child frame.

Lisp

The package elisp-format format elisp code.

It provides the following commands:

Key bindingCommandDescription
M-x elisp-format-regionFormat region or defun.
M-x elisp-format-bufferFormat buffer.
M-x elisp-format-fileFormat file.
M-x elisp-format-file-batchFormat file with `batch’.
M-x elisp-format-directoryFormat recursive elisp files in directory.
M-x elisp-format-directory-batchFormat recursive elisp files in directory with `batch’.
M-x elisp-format-dired-mark-filesFormat dired marked files.
M-x elisp-format-libraryFormat library.

Python

See also:

Configuration of the build-in python mode.

Key bindingCommandDescription
H-M-bM-x python-nav-backward-blockMoves to the previous python block.
H-M-fM-x python-nav-forward-blockMoves to the next python block.
H-x C-c rM-x psimacs/python/remove-unused-importsRemoves unused imports and unused variables with autoflake.
H-x C-c RM-x psimacs/python/blackenReformat buffer with tool black.
H-x C-c YM-x psimacs/python/yapifyReformat buffer with tool yapf.

References:

CMake

CMake is an open-source, cross-platform family of tools designed to build, test and package software.

Cmake-mode provides syntax highlighting and indentation for CMakeLists.txt and *.cmake source files.

Deft

Deft is an Emacs mode for quickly browsing, filtering, and editing directories of plain text notes, inspired by Notational Velocity. It was designed for increased productivity when writing and taking notes by making it fast and simple to find the right file at the right time and by automating many of the usual tasks such as creating new files and saving files.

Key bindingCommandDescription
C-c n DM-x deftSwitch to Deft buffer and load files.
<Ret>M-x deft-completeOpen file.
C-oM-x deft-open-file-other-windowOpen file at point in other window.
C-u C-oC-u M-x deft-open-file-other-windowOpen file at point in other window and switch to window.
C-c C-cM-x deft-filter-clearClear the current filter string and refresh the file browser.
C-c C-qM-x quit-windowClose Deft window.
C-c C-gM-x deft-refreshUpdate the file cache, reapply the filter, and refresh the Deft buffer.
C-c C-tM-x deft-toggle-incremental-searchToggle the ‘deft-incremental-search’ setting.
C-c C-lM-x deft-filterUpdate the filter with STR and update the file browser.
C-c C-sM-x deft-toggle-sort-methodToggle file sorting method defined in ‘deft-current-sort-method’
C-c C-nM-X deft-new-fileCreate a new file quickly.
C-c C-dM-x deft-delete-fileDelete the file represented by the button at the point.
C-c C-rM-x deft-rename-fileRename the file represented by the button at the point.
C-c C-aM-x deft-archive-fileArchive the file represented by the button at the point.

BibTeX

Manage references and bibliographies with Emacs BibTeX mode.

Emacs ships with bibtex-mode to create and manage bibliographies. This mode, as the name suggests, uses the BibTeX file format as your literature database. BibTeX is a tool to manage literature and citations and is typically used for LaTeX typesetting.

A typical entry for a book will look like this:

@book{prevos_principles_2019,
  title        = {Principles of Strategic Data Science},
  author       = {Prevos, Peter},
  year         = 2019,
  publisher    = {Packt Publishing},
  isbn         = {978-1-83898-529-5},
  file         = {:/prevos-2019.pdf},
  keywords     = {data science, strategy}
}

See also: Manage your literature with Emacs BibTeX Mode

Ivy-BibTeX

Ivy-bibtex allows you to search and manage your BibTeX bibliography. The main selling points are efficient search in large bibliographies using powerful search expressions and tight integration into your Emacs workflows.

Key bindingCommandDescription
C-c i bM-x ivy-bibtexIvy layer for bibtex.

LaTeX

Support for writing text with LaTeX. Psimacs uses the AUCTeX package for assisting the LaTeX text editing. On default, Psimacs generates PDF-files and configures the free SumatraPDF application for viewing these files.

Key bindingCommandDescription
C-c C-cM-x TeX-command-masterYou get a list of actions to choose from.
C-c i gM-x pdf-sync-forward-search

Following an unsorted list if references:

Remark:

Key bindings used for org mode.

In this section the key bindings for the Psimacs org-mode configuration are defined.

Key bindingCommandDescription
C-c C-.M-x org-time-stamp-inactiveInsert an inactive time stamp.
H-x C-c C-c iM-x psimacs/org/copy-id-to-clipboardCopy an ID link with the headline to killring, if no ID is there then create a new unique ID.
H-x C-c C-x iM-x psimacs/org/ids-to-headlines-in-fileAdd ID properties to all headlines in the current file which do not already have one.
H-x C-c C-k iM-x org-table-insert-rowInsert a new row above the current line into the table.
H-x C-c C-k hM-x org-table-insert-hlineInsert a horizontal-line below the current line into the table.
H-x C-c S-C-k pM-x psimacs/org/table-create-preamble-keybinding-command-descriptionThis function creates a three column table with header ‘Key binding’, ‘Command’ and ‘Description’.
H-x C-c S-C-k iM-x psimacs/org/table-insert-row-keybinding-command-descriptionThis function inserts a three column row template above the current line into the table.
H-x C-c S-C-k aM-x psimacs/org/table-append-row-keybinding-command-descriptionThis function appends a three column row template to the current table.
H-x aM-x org-agendaDispatch agenda commands to collect entries to the agenda buffer.
H-x lM-x org-store-linkStore a link to the current location.
H-x cM-x org-captureCapture something.
H-x &M-x org-mark-ring-gotoJump to the previous position in the mark ring.

Insert links from the clipboard

The org-cliplink package inserts org-mode links from the clipboard.

A simple command C-x p i that takes a URL from the clipboard and inserts an org-mode link with a title of a page found by the URL into the current buffer.

See also: org-cliplink

Key bindingCommandDescription
C-x p iM-x org-cliplinkInsert org-mode links from the clipboard.

Completions of structured templates.

Org tempo reimplements completions of structure template before point.

Key bindingDescription
<a TAB#+begin_export ascii ... #+end_export
<c TAB#+begin_center ... #+end_center
<C TAB#+begin_comment ... #+end_comment
<e TAB#+begin_example ... #+end_example
<E TAB#+begin_export ... #+end_export
<h TAB#+begin_export html ... #+end_export
<l TAB#+begin_export latex ... #+end_export
<q TAB#+begin_quote ... #+end_quote
<s TAB#+begin_src ... #+end_src
<v TAB#+begin_verse ... #+end_verse

Jupyter Notebook Integration

emacs-jupyter provides REPL and org-mode source block frontends to Jupyter kernels. Kernel interactions integrated with Emacs’s built-in features.

Key bindingCommandDescription
H-SPC jM-x psimacs/hydra/jupyter/open-hydraShow hydra for jupyter notebooks commands.
H-RETM-x jupyter-org-execute-and-next-blockExecute jupyter block and move to next block.
C-S-H-<return>M-x psimacs/jupyter/execute-all-jupyter-src-blocksExecute all jupyter blocks.
H-m nM-x psimacs/jupyter/next-jupyter-src-blockMove point into the next jupyter src block.
H-m pM-x psimacs/jupyter/previous-jupyter-src-blockMove point into the previous jupyter src block.
H-m i dM-x org-display-inline-imagesDisplay inline images.
H-m i rM-x org-redisplay-inline-imagesRedisplay inline images.
H-m i tM-x org-toogle-inline-imagesToogle inline images.

The following commands are defined only if point is in an org-babel source block.

Key bindingCommandDescription
C-RETM-x org-ctrl-c-ctrl-cExecute block.
S-RETM-x jupyter-org-execute-and-next-blockExecute block and move to next block.
M-RETExecute block and add a new block.
C-M-RETM-x jupyter-org-execute-to-pointExecute block to point.
S-C-RETM-x org-babel-execute-bufferExecute all blocks of buffer.
H-M-RETM-x jupyter-org-execute-subtreeExecute subree to point.
C-M-xM-x jupyter-eval-defunEvaluate the function at point.
M-iM-x jupyter-inspect-at-pointInspect the code at point.
C-c C-bM-x jupyter-eval-bufferEvaluate the whole buffer.
C-c C-cM-x jupyter-eval-line-or-regionEvaluate line or region.
C-c C-iM-x jupyter-repl-interrupt-kernelInterrupt the kernel if possible.
C-c C-rM-x jupyter-repl-restart-kernelRestart the kernel.
C-c C-sM-x jupyter-repl-scratch-bufferSwitch to a scratch buffer connected to the current REPL in another window.
C-c C-oM-x jupyter-eval-remove-overlaysRemove all evaluation result overlays in the buffer.
C-c M-:M-x jupyter-eval-stringEvaluate string.
Key bindingDescription
<bsh TABBash shell source code block.
<sh TABShell source code block.
<el TABEmacs lisp source code block.
<ell TABLexical Emacs lisp source code block.
<p TABPython source code block.
<ip TABIPython source code block.
<jp TABJupyter source code block.
<jps TABJupyter session source code block.
<sl TABSource block with language choice.
sbh TABGet source header value snippet.

Org-roam

Org-roam is a plain-text personal knowledge management system.

Org-roam allows for effortless non-hierarchical note-taking: with Org-roam, notes flow naturally, making note-taking fun and easy. Org-roam augments the Org-mode syntax, and will work for anyone already using org-mode for their personal wiki.

The goal of org-roam is to create a web of notes linked between each other. By linking notes in a non-hierarchical way, one can make connections between topics and remember them without going through the hassle of creating a hierarchical tag system where it’s never clear if a note should belong to tag A or its parent B, etc.

References:

Brains:

Key bindingCommandDescription
C-c n AM-x psimacs/org-roam/refresh-agenda-listLet be the org-agenda files the ones that have tag <Project>.
C-c n DM-x deftSwitch to Deft buffer and load files.
C-c n RM-x org-roam-node-randomFind and open a random Org-roam node.
C-c n cM-x org-roam-captureLaunches an ‘org-capture’ process for a new or existing node.
C-c n fM-x org-roam-node-findFind and open an Org-roam node by its title or alias.
C-c n oM-x org-id-get-createCreate an ID for the current entry and return it.
C-c n i iM-x org-roam-node-insertFind an Org-roam node and insert (where the point is) an “id:” link to it.
C-c n i DM-x psimacs/org-roam/node-insert-immediate-defaultImmediate node insertion using the default capture template.
C-c n i IM-x psimacs/org-roam/node-insert-immediateImmediate node insertion but let you choose the capture template.
C-c n p fM-x psimacs/org-roam/find-projectFind org roam node files which have tag <Project>.
C-c n p nM-x psimacs/org-roam/project-capture-noteSelect or create project node and capture note.
C-c n p rM-x psimacs/org-roam/project-capture-referenceSelect or create project node and capture reference.
C-c n p sM-x psimacs/org-roam/project-capture-resourceSelect or create project node and capture resource.
C-c n p tM-x psimacs/org-roam/project-capture-taskSelect or create project node and capture task.
C-c n x iM-x psimacs/org-roam/capture-inboxCreate a inbox capture node.
C-c n r fM-x org-roam-ref-findFind and open an Org-roam node that’s dedicated to a specific ref.
C-c n a aM-x org-roam-alias-addAdd ALIAS to the node at point.
C-c n a rM-x org-roam-ref-addAdd REF to the node at point.
C-c n a tM-x org-roam-tag-addAdd TAGS to the node at point.
C-c n g gM-x org-roam-graphBuild and possibly display a graph for NODE.
C-c n g uM-x org-roam-ui-modeEnable org-roam-ui.
C-c n b dM-x org-roam-buffer-display-dedicatedLaunch NODE dedicated Org-roam buffer.
C-c n b tM-x org-roam-buffer-toggleToggle display of the persistent ‘org-roam-buffer’.
C-c n d fM-x org-roam-dailies-find-directoryFind and open ‘org-roam-dailies-directory’.
C-c n d cM-x org-roam-dailies-goto-dateFind the daily-note for a date using the calendar, creating it if necessary.
C-c n d CM-x org-roam-dailies-capture-dateCreate an entry in the daily-note for a date using the calendar.
C-c n d dM-x org-roam-dailies-goto-todayFind the daily-note for today, creating it if necessary.
C-c n d DM-x org-roam-dailies-capture-todayCreate an entry in the daily-note for today.
C-c n d nM-x org-roam-dailies-goto-next-noteFind next daily-note.
C-c n d pM-x org-roam-dailies-goto-previous-noteFind previous daily-note.
C-c n d tM-x org-roam-dailies-goto-tomorrowFind the daily-note for tomorrow, creating it if necessary.
C-c n d TM-x org-roam-dailies-capture-tomorrowCreate an entry in the daily-note for tomorrow.
C-c n d yM-x org-roam-dailies-goto-yesterdayFind the daily-note for yesterday, creating it if necessary.
C-c n d YM-x org-roam-dailies-capture-yesterdayCreate an entry in the daily-note for yesteday.
C-c n TABM-x psimacs/org/roam-screenshotsMove screenshot images to org roam image directory.

Org-Noter

The package org-noter allows you to take notes in org-mode files that stay in sync with pdf document files. It integrates also with the org-roam package.

Working with org-noter:

Key bindingCommandDescription
H-x nM-x org-noterStart ‘org-noter’ session.
M-x org-noter-start-from-diredIn Dired, open sessions for marked files or file at point.
M-x org-noter-set-doc-split-fractionSet the fraction of the frame that the document window will occupy when split.
M-x org-noter-set-notes-window-locationSet the notes window default location for the current session.
M-x org-noter-create-skeletonCreate notes skeleton based on the outline of the document.
M-x org-noter-pdf-set-columnsInteractively set the COLUMN_EDGES property for the current heading.
M-TM-x org-noter-toggle-notes-window-locationToggle between side- and bottom-notes window location.
M-qM-x org-noter-kill-sessionKill an ‘org-noter’ session.
M-x org-noter-set-hide-otherToggle hiding other headings for the current session.
M-x org-noter-set-hide-otherToggle hiding other headings for the current session.

Keybindings for the pdf buffer in org-noter-mode:

Key bindingCommandDescription
SPC n <PageDown> <down>To move forward in document.
BACKSPACE p <PageUp> <up>To move back in document.
iM-x org-noter-insert-precise-noteInsert a note associated with a specific location (x,y).
IM-x org-noter-insert-precise-note-toggle-no-questionsInsert a note associated with a specific location (x,y). Note is always create with the default title.
C-i TABM-x org-noter-insert-noteInserts a note linked to the current page.
C-S-i M-TABM-x org-noter-insert-note-toggle-no-questionsInserts a note linked to the current page. Note is always create with the default title.
M-pM-x org-noter-sync-prev-noteGo to the location of the previous note, in relation to where the point is.
M-nM-x org-noter-sync-next-noteGo to the location of the next note, in relation to where the point is.
M-.M-x org-noter-sync-current-noteGo the location of the selected note, in relation to where the point is.
C-M-pM-x org-noter-sync-prev-page-or-chapterShow previous page or chapter that has notes.
C-M-nM-x org-noter-sync-next-page-or-chapterShow next page or chapter that has notes.
C-M-.M-x org-noter-sync-current-page-or-chapterShow current page or chapter notes.
M-TM-x org-noter-toggle-notes-window-locationToggle between side- and bottom-notes window location.
M-qM-x org-noter-kill-sessionKill an ‘org-noter’ session.

Keybinding for the org note buffer in org-noter-mode:

Key bindingCommandDescription
M-pM-x org-noter-sync-prev-noteGo to the location of the previous note, in relation to where the point is.
M-nM-x org-noter-sync-next-noteGo to the location of the next note, in relation to where the point is.
M-.M-x org-noter-sync-current-noteGo the location of the selected note, in relation to where the point is.
C-M-pM-x org-noter-sync-prev-page-or-chapterShow previous page or chapter that has notes.
C-M-nM-x org-noter-sync-next-page-or-chapterShow previous page or chapter that has notes.
C-M-.M-x org-noter-sync-current-page-or-chapterShow current page or chapter notes.
M-TM-x org-noter-toggle-notes-window-locationToggle between side- and bottom-notes window location.
M-qM-x org-noter-kill-sessionKill an ‘org-noter’ session.

Additional key bindings for Psimacs:

Key bindingCommandDescription
C-TABM-x psimacs/buffer/next-user-bufferSwitch to the next user buffer. Buffer name starts with *, it’s not considered a user buffer.
C-S-TABM-x psimacs/buffer/previous-user-bufferSwitch to the previous user buffer. Buffer name starts with *, it’s not considered a user buffer.
H-TABM-x psimacs/buffer/next-emacs-bufferSwitch to the next emacs buffer, i.e. that starts with *.
H-S-TABM-x psimacs/buffer/previous-emacs-bufferSwitch to the previous emacs buffer, i.e. that starts with *.
C-x <right>M-x next-bufferSwitch to the next buffer.
C-x <left>M-x previous-bufferSwitch to the previous buffer.
H-<up>M-x psimacs/movement/move-text-upMove region or line up.
H-<down>M-x psimacs/movement/move-text-downMove region or line down.
H-m C-v C-oM-x psimacs/shell/open-file-in-visual-studioOpen the given file argument in the MS Visual Studion session.
H-m C-v C-iM-x psimacs/shell/import-file-in-visual-studioImport the given file argument in the MS Visual Studion session.
H-m C-f C-a cM-x find-file <psimacs/config/org-capture-coding-diary-file>Find coding diary file in agenda directory.
H-m C-f C-a dM-x find-file <Diary.org>Find diary file in agenda directory.
H-m C-f C-a jM-x find-file <Journal.org>Find journal file in agenda directory.
H-m C-f C-a lM-x find-file <TimeLog.org>Find time log file in agenda directory.
H-m C-f C-fM-x find-functionFind the definition of function near point
H-m C-e C-m vM-x visual-line-modeLine wrapping. See Visual Line Mode.
H-m C-p C-bM-x psimacs/pair/bounce-sexpWill bounce between matching parens.
H-m C-x s bM-x psimacs/convenience/bind-f6-to-last-commandBind function key F6 to the last command used.
H-x C-c C-e s hM-x psimacs/sphinx/org-sphinx-buildRun the sphinx-build tool for the current org buffer.
H-x C-c C-e s HM-x psimacs/sphinx/buildRun the sphinx-build tool for the given file.