Skip to content

Keymappings

hαrsh vαirαgi edited this page Jul 17, 2025 · 6 revisions

Keyboard shortcuts for code-editor

Customizations

You can edit the file ~/.code-editor/src/lua/user/keymaps.lua, if you really need to change some key mappings. Make sure to test that key mappings do not conflict with each other.

Default keyboard shortcuts

These are the instructions and shortcut keys in various modes.

Normal Mode

These are some of the shortcut keys mentioned here for normal mode.

Shortcut Description
. Repeat last command or shortcut key
~ Change case of character under cursor
dd Cut current line
>> Add indent (shift right) to current line
<< Remove indent (shift left) from current line
f Folds current block of code into single line
space Unfolds current block of code
ctrl + f Folds all block into their specific blocks
ctrl + j Unfolds all block of codes.
alt + e Open file explorer
alt + r Run current file
ctrl + q Close current file
alt + q Close all files
ctrl + t Open terminal like vscode
shift + r rename all references of selected document

These are some shortcuts that work on the file explorer tab.

Shortcut Description
enter or ctrl + o Open the file
right Open the folder
left Close the folder
q Close the file explorer
ctrl + n Create new file
ctrl + x Cut file
ctrl + c Copy file
ctrl + v Paste file
ctrl + d Delete file

Insert Mode

These are some of the shortcut keys mentioned here for insert mode.

Shortcut Description
i To use insert mode
a To use insert mode (cursor shift one letter forward)
o To use insert mode (cursor shift to a new blank line)
ctrl + c Copy whole line
ctrl + v Paste
ctrl + up Shift the current line upwards (use arrow key)
ctrl + down Shift the current line downwards (use arrow key)
ctrl + u Undo
ctrl + r Redo
ctrl + d Duplicate current line
ctrl + s Save
ctrl + q Save and exit

These shortcut keys work when auto completions will start displaying from language servers.

Shortcut Description
alt + up Scroll autocompletion upwards
alt + down Scroll autocompletion downwards
alt + c Abort autocompletions
enter Select autocompletion option

Visual Mode

These are some of the shortcut keys mentioned here for visual mode after selecting or highlighting text.

Shortcut Description
d or backspace Delete selected text
y Copy selected text
> Indent selected lines
< Unindent selected lines

Visual Block Mode

These are some instructions mentioned here for visual block mode because visual block mode has no keyboard shortcuts but instructions only.

Multiline Editing with Visual Block Mode

Visual Block mode is a game-changer when you need to make the same changes to multiple lines at once. Here's how to add or remove text in a block:

  • Enter Visual Block Mode: Position the cursor at the beginning of the first line you want to modify. Press ctrl-v.
  • Select the Block: Use the down and up arrow keys to extend the selection vertically to include all the lines you want to modify. The width of the selection will be determined by how far you move the cursor horizontally from the starting position.
Click here to see multiline text adding (at the beginning)
  • Press I or shift + i. This enters Insert mode, but with a special behavior: the text you type will be inserted at the beginning of each selected line.
  • Type the text you want to add.
  • Press esc, code-editor will automatically apply the text to the beginning of all the selected lines.
Click here to see multiline text adding (at the end)
  • Press A or shift + a. This enters Insert mode, but the text you type will be appended at the end of each selected line.
  • Type the text you want to add.
  • Press esc, code-editor will automatically append the text to the end of all the selected lines.
Click here to see multiline text removing
  • Position the cursor at the beginning of the first character you want to remove.
  • Use the down and up arrow keys to extend the selection vertically to include all the lines you want to modify. Use the left and right arrow keys to select the characters you want to remove horizontally.
  • Press d. The selected block of text will be removed from all the selected lines.

Terminal Mode

These are some of the shortcut keys mentioned here for terminal mode.

Shortcut Description
ctrl + d Remove the terminal window
Clone this wiki locally