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.

ShortcutDescription
.Repeat last command or shortcut key
~Change case of character under cursor
ddCut current line
>>Add indent (shift right) to current line
<<Remove indent (shift left) from current line
fFolds current block of code into single line
spaceUnfolds current block of code
ctrl + fFolds all block into their specific blocks
ctrl + jUnfolds all block of codes.
alt + eOpen file explorer
alt + rRun current file
ctrl + qClose current file
alt + qClose all files
ctrl + tOpen terminal like vscode
shift + rrename all references of selected document

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

ShortcutDescription
enter or ctrl + oOpen the file
rightOpen the folder
leftClose the folder
qClose the file explorer
ctrl + nCreate new file
ctrl + xCut file
ctrl + cCopy file
ctrl + vPaste file
ctrl + dDelete file

Insert Mode

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

ShortcutDescription
iTo use insert mode
aTo use insert mode (cursor shift one letter forward)
oTo use insert mode (cursor shift to a new blank line)
ctrl + cCopy whole line
ctrl + vPaste
ctrl + upShift the current line upwards (use arrow key)
ctrl + downShift the current line downwards (use arrow key)
ctrl + uUndo
ctrl + rRedo
ctrl + dDuplicate current line
ctrl + sSave
ctrl + qSave and exit

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

ShortcutDescription
alt + upScroll autocompletion upwards
alt + downScroll autocompletion downwards
alt + cAbort autocompletions
enterSelect autocompletion option

Visual Mode

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

ShortcutDescription
d or backspaceDelete selected text
yCopy 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.

ShortcutDescription
ctrl + dRemove the terminal window