Skip to content

Micro Cheatsheet

Micro is the default text editor of Garuda Linux. Unlike most of the distributions that provide vi or nano as default text editor, Garuda Linux ships micro because it is very user friendly, intuitive, has a beautiful UI and is easy to configure.

Micro editor

ActionKeybinding
Move cursorUp Arrow Down Arrow Right Arrow Left Arrow
Move lines up or downAlt + Up Arrow Alt + Down Arrow
Start of lineAlt + Left Arrow Home
End of lineAlt + Right Arrow End
Start of fileControl + Up Arrow Control + Home
End of fileControl + Down Arrow Control + End
Previous or next paragraphAlt + Left Curly Bracket Alt + Right Curly Bracket
Page up or downPageUp PageDown
Go to lineControl + L
ActionKeybinding
Select textShift + Up Arrow Shift + Down Arrow Shift + Left Arrow Shift + Right Arrow
Select word left or rightControl + Shift + Left Arrow Control + Shift + Right Arrow
Select to start of lineAlt + Shift + Left Arrow Shift + Home
Select to end of lineAlt + Shift + Right Arrow Shift + End
Select to start of fileControl + Shift + Up Arrow
Select to end of fileControl + Shift + Down Arrow
Select allControl + A
Multi-cursorControl + left click
ActionKeybinding
New lineEnter
Indent or autocompleteTab
OutdentShift + Tab
BackspaceBackspace Control + H
Delete word leftAlt + Backspace Alt + Control + H
DeleteDelete
Toggle overwrite modeInsert
CutControl + X
Cut lineControl + K
CopyControl + C
Copy lineControl + C (no selection)
PasteControl + V
Duplicate lineControl + D
UndoControl + Z
RedoControl + Y
Record or play macroControl + U records, Control + J plays
ActionKeybinding
Open fileControl + O
SaveControl + S
QuitControl + Q
New tabControl + T
Previous or next tabAlt + Comma Alt + Period Control + PageUp Control + PageDown
Switch splitControl + W
ActionKeybinding
FindControl + F
Find nextControl + N
Find previousControl + P
ActionKeybinding
Toggle helpControl + G
Toggle key menuAlt + G
Toggle rulerControl + R
Command modeControl + E
Shell modeControl + B
ScrollMouse wheel

Micro has many features that the tables above do not cover.

Press Control + E to open the command bar. Type part of a command and press Tab to complete it. Run help commands for the full list.

CommandPurpose
save [filename]Save as a new file. Without a name it works like Control + S.
replace foo bar [flags]Replace foo with bar. -a replaces all, -l searches literally.
replaceall foo barSame as replace foo bar -a.
goto 123Jump to line 123. A negative number counts from the end, so goto -10 is ten lines from the end.
vsplit [filename]Split the window vertically, optionally with a file.
hsplit [filename]Split the window horizontally, optionally with a file.
tab [filename]Open a file in a new tab.
term [command]Open a terminal inside Micro and run a command. Combine it with vsplit or hsplit.

Options change how Micro behaves. Use set to save a value to settings.json, setlocal to change it only for the current file, and show to print the current value.

set ruler false
setlocal ruler false
show ruler

Useful options:

OptionEffect
autosave=XSave the file every X seconds. The default 0 turns it off.
autosuUse sudo automatically when saving a file that needs root rights.
backupKeep backups of open buffers. Reopen the file to restore unsaved changes after a crash.
clipboardexternal uses the desktop clipboard (default). terminal also works over SSH. internal is Micro only.
softwrapWrap long lines at the edge of the window. Use wordwrap with it to wrap by word.
autoindentKeep the indentation of the previous line on a new line.

Run help options in the command bar for the full list.

Your changes live in two JSON files in ~/.config/micro/:

  • settings.json for options. Only add values that differ from the default.
  • bindings.json for key bindings.
{
"ruler": false
}

To change a key binding, use the bind command in the command bar. It writes to bindings.json for you. Capitalization matters, so use the names from help keybindings.

bind Ctrl-v Copy
bind Ctrl-c Paste
bind CtrlMouseLeft SelectLine

The cheatsheet lists Control + left click. Micro also has keyboard shortcuts for multiple cursors:

KeysPurpose
Alt + NAdd a cursor on the next match of the selection
Alt + Shift + Up Arrow Alt + Shift + Down ArrowAdd a cursor on the line above or below
Alt + MAdd a cursor at the start of every line in the selection
Alt + XSkip the current match
Alt + PRemove the last cursor
Alt + CRemove all cursors

The default comment plugin toggles comments on the selected lines with Alt + Slash. You can also run comment in the command bar. Set the comment style with set commenttype "// %s", or use setlocal for one file.

Micro has a plugin manager in the command bar:

  • plugin list shows installed plugins.
  • plugin search foobar searches the official channel.
  • plugin install foo, plugin remove foo and plugin update manage plugins.

Change the color scheme with set colorscheme gotham. Custom color schemes go into ~/.config/micro/colorschemes/. Copy a file from runtime/colorschemes in the Micro sources as a starting point.


Source: Mastering the Micro text editor on the Garuda forum.