Lem
GitHubDiscord Matrix Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Keybindings

Lem 2.0 keybindings

This is the full list of Lem 2.0 keybindings.

You can get this list in Lem itself with M-x documentation-describe-bindings (new after Lem 2.0).

The up to date list it to be found on Github: https://github.com/lem-project/lem/blob/main/docs/default-keybindings.md

Move

Note: this doesn’t list vi-mode keys.

CommandKey bindingsDocumentation
next-lineC-n, DownMove the cursor to next line.
next-logical-lineMove the cursor to the next logical line.
previous-lineC-p, UpMove the cursor to the previous line.
previous-logical-lineMove the cursor to the previous logical line.
forward-charC-f, RightMove the cursor to the next character.
backward-charC-b, LeftMove the cursor to the previous character.
move-to-beginning-of-bufferM-<Move the cursor to the beginning of the buffer.
move-to-end-of-bufferM->Move the cursor to the end of the buffer.
move-to-beginning-of-lineC-a, HomeMove the cursor to the beginning of the line.
move-to-beginning-of-logical-lineMove the cursor to the beginning of the logical line.
move-to-end-of-lineC-e, EndMove the cursor to the end of the line.
move-to-end-of-logical-lineMove the cursor to the end of the logical line.
next-pageC-v, PageDownMove the cursor to the next page by one page.
previous-pageM-v, PageUpMove the cursor to the previous page by one page.
next-page-charC-x ]Move the cursor to the next page character (^L).
previous-page-charC-x [Move the cursor to the previous page character (^L).
goto-lineM-gMove the cursor to the specified line number.

Edit

CommandKey bindingsDocumentation
self-insertInsert the input character.
newlineReturnInsert a new line.
open-lineC-oInsert a new line without moving the cursor position.
quoted-insertC-qInsert the next entered key (including control characters).
delete-next-charC-d, DeleteDelete the next character.
delete-previous-charC-h, BackspaceDelete the previous character.
copy-regionM-wCopy the text of region.
copy-region-to-clipboardCopy the selected text to the clipboard.
kill-regionC-wKill the text of region.
kill-region-to-clipboardKill the text of region and copy to the clipboard.
kill-lineC-kKill from the current cursor position to the end of the line.
kill-whole-lineC-Shift-BackspaceKill the entire line and the remaining whitespace
yankC-yPaste the copied text.
yank-popM-yReplaces the immediately pasted text with the next text in the killring.
yank-pop-nextReplaces the immediately preceding yank-pop text with the text before the kill ring.
yank-to-clipboardCopy the text of the killring to the clipboard.
paste-from-clipboardInserts text from the clipboard.
entab-lineReplaces the indent of the current line from space to tab.
detab-lineReplaces the indent of the current line from tab to space.
delete-blank-linesC-x C-oDelete blank lines before and after the cursor.
just-one-spaceM-SpaceCombines consecutive whitespace before and after the cursor into one.
delete-indentationM-^Merge the current line with the previous line.
transpose-charactersC-tSwaps the characters before and after the cursor.
undoC-\Undo.
redoC-_, C-/Redo.
delete-trailing-whitespaceRemoves all end-of-line and end-of-buffer whitespace from the current buffer.

Mark

CommandKey bindingsDocumentation
mark-setC-@, C-SpaceSets a mark at the current cursor position.
exchange-point-markC-x C-xExchange the current cursor position with the marked position.
mark-set-whole-bufferC-x hSelect the whole buffer as a region.

Word

CommandKey bindingsDocumentation
forward-wordM-f, C-RightMove to cursor to next word.
previous-wordM-b, C-LeftMove to cursor to previous word
delete-wordM-d, C-DeleteDelete the next word.
backward-delete-wordM-C-h, M-Backspace, C-BackspaceDelete the previous word.
downcase-regionC-x C-lReplaces the selected region with a downcase.
uppercase-regionC-x C-uReplaces the selected region with a uppercase.
capitalize-wordM-cReplace the following word with capital-case.
lowercase-wordM-lReplace the following word with lowercase.
uppercase-wordM-uReplace the following word with uppercase.
forward-paragraphM-}Move cursor to forward paragraph.
backward-paragraphM-{Move cursor to backward paragraph.
kill-paragraphM-kKill the forward paragraph.
count-wordsM-=Count the number of lines/words/characters in the buffer.

S-Expression

CommandKey bindingsDocumentation
forward-sexpM-C-fMove the cursor to the forward expression.
backward-sexpM-C-bMove the cursor to the backward expression.
forward-listM-C-nMove the cursor to the forward list.
backward-listM-C-pMove the cursor to the backward list.
down-listM-C-dMove the cursor to the inner expression.
backward-up-listM-C-uMove the cursor to the outer expression.
mark-sexpM-C-@, M-C-SpaceSelect the forward expression as a region.
kill-sexpM-C-kKill the forward expression as a region.
transpose-sexpsM-C-tSwaps the expression before and after the cursor.

File

CommandKey bindingsDocumentation
find-fileC-x C-fOpen the file.
find-file-recursivelyOpen a file, from the list of all files present under the buffer’s direcotry, recursively.
read-fileC-x C-rOpen the file as a read-only.
save-current-bufferC-x C-sSaves the current buffer text to a file
write-fileC-x C-wSaves the text in the current buffer to the specified file
write-region-fileSaves the region of text to the specified file
insert-fileC-x TabInserts the contents of the file into the current buffer.
save-some-buffersC-x sSave some files in the open buffer.
revert-bufferRestores the buffer. Normally this command will cause the contents of the file to be reflected in the buffer.
change-directoryChange directories associated with the buffer.

Project

CommandKey bindingsDocumentation
project-find-fileOpen a file, from the list of all files in this project.
project-rootDisplay this buffer’s project directory.
project-root-directoryOpen this project’s root directory.
project-delete-buffersDelete all this project’s buffers, except: if *delete-repl-buffer* is non t, we don’t delete the REPL buffer, if *delete-last-buffer* is non nil, we will delete the last buffer. This would cause Lem to exit.

Buffer

CommandKey bindingsDocumentation
toggle-read-onlyC-x C-qToggle the buffer read-only.
rename-bufferRename the buffer.
unmark-bufferM-~Remove the mark where the buffer was changed.

Window

CommandKey bindingsDocumentation
select-bufferC-x bSwitches to the selected buffer.
kill-bufferC-x kDelete buffer.
previous-bufferC-x LeftSwitches to the previous buffer.
next-bufferC-x RightSwitches to the next buffer.
recenterC-lScroll so that the cursor is in the middle.
split-active-window-verticallyC-x 2Split the current window vertically.
split-active-window-horizontallyC-x 3Split the current window horizontally.
other-windowC-x o, M-oGo to the next window.
switch-to-last-focused-windowGo to the window that was last in focus.
window-move-downGo to the window on the down.
window-move-upGo to the window on the up.
window-move-rightGo to the window on the right.
window-move-leftGo to the window on the left.
delete-other-windowsC-x 1Delete all other windows.
delete-active-windowC-x 0Delete the active window.
quit-active-windowQuit the active window. This is a command for a popped-up window.
grow-windowC-x ^Grow the window’s height.
shrink-windowC-x C-zShrink the window’s height.
grow-window-horizontallyC-x }Grow the window’s width.
shrink-window-horizontallyC-x {Shrink the window’s width.
scroll-downC-Down, M-DownScroll down.
scroll-upC-Up, M-UpScroll up.
find-file-other-windowC-x 4 fOpen a file in another window. Split the screen vertically if needed.
read-file-other-windowC-x 4 rRead a file in another window.
select-buffer-other-windowC-x 4 bSelect a buffer in another window.
compare-windows

Multiple-Cursors

CommandKey bindingsDocumentation
add-cursors-to-next-lineM-CDuplicates the cursor under the currently existing cursors.

Process

CommandKey bindingsDocumentation
filter-bufferC-x #Replaces the contents of the buffer with the result of executing the command entered.
pipe-commandC-x @Run a command and displays the output.

Help

CommandKey bindingsDocumentation
describe-keyC-x ?Tell what is the command associated to a keybinding.
describe-bindingsDescribe the bindings of the buffer’s current major mode.
list-modesOutput all available major and minor modes.
apropos-commandFind all symbols in the running Lisp image whose names match a given string.
lem-versionDisplay Lem’s version.

Font

CommandKey bindingsDocumentation
font-size-increaseC-+Make the font larger (this currently only works with SDL2 frontend)
font-size-decreaseC–Make the font smaller (this currently only works with SDL2 frontend)

Other

CommandKey bindingsDocumentation
nop-commandNopKey
undefined-keySignal undefined key error.
keyboard-quitC-gSignal a quit condition.
escapeEscapeSignal a quit condition silently.
exit-lemC-x C-cAsk for modified buffers before exiting lem.
quick-exitExit the lem job and kill it.
execute-commandM-xRead a command name, then read the ARG and call the command.
show-context-menuShift-F10, M-h
load-libraryLoad the Lisp library named NAME.