Skip to content

Mappings

Keybindings in Neovim

Neovim keybindings enhance editor efficiency and user control. They assign essential actions to specific keystrokes, reducing repetitive operations and enabling immediate access to core features. This customization results in an intuitive editing environment that aligns with individual workflows.

An effective mapping system targets fundamental operations. Users manage buffers, browse code, manipulate text, and integrate tools with minimal input.
Core actions such as saving files, switching buffers, and searching text require fewer keystrokes. Advanced tasks, including LSP interactions, Git commands, terminal access, and diagnostic toggles, by using single keystrokes.

Structuring mappings by function maintains a streamlined and productive configuration. Context-sensitive mappings adjust behavior according to file type or active plugins, while complex operations resolve into straightforward shortcuts.

The result is a responsive editor that supports both basic text editing and advanced development with accuracy and efficiency.

Modifier keys

Neovim mappings use modifier keys to create a hierarchical command structure, significantly expanding the editor's functionality without increasing cognitive load.
By combining modifiers with base keys, users gain access to a comprehensive set of actions through memorable, ergonomic key sequences.

The standard notation for these modifiers in mapping definitions includes:

<C> - Ctrl Typically used for fundamental operations and system-level commands

<S> - Shift Often employed to extend basic commands with alternative functions

<A> - Alt Enables secondary command layers and plugin-specific functions

<leader> - Space Serves as a namespace for user-defined and plugin commands

This system allows power users to sustain flow state by providing immediate access to all essential functions without compromising the editor's minimalist interface.

Operating modes

Neovim structures editing functionality by using distinct operational states. Each mode targets specific tasks and defines how keystrokes map to actions:

NORMAL
The primary state for commands and movement. Users trigger editing commands, move through buffers, and activate mappings. This mode functions as the central hub for all non-text-entry operations.

INSERT
Dedicated to text entry and modification.
All keystrokes directly insert characters or perform insert-specific operations. Users enter this mode explicitly and return to Normal mode upon completion of text entry tasks.

VISUAL
Enables text selection and manipulation.
Character-wise (v): Selects individual characters
Line-wise (V): Operates on entire lines

SELECT (gh)
Similar to Visual mode but replaces selection with typed characters, mimicking conventional editor behaviors.

COMMAND (:)
Provides access to Ex commands for advanced operations, configuration changes, and file management.

TERMINAL (<A-t>)
Creates an interactive terminal session within Neovim, supporting shell commands and REPL interactions.

REPLACE (R)
Overwrites existing text character-by-character without extending the buffer.

Make the transition between modes occurs through deliberate commands, creating a rhythm that experienced users internalize for maximum efficiency.

The modal approach eliminates the need for modifier-heavy combinations during intensive editing sessions while maintaining all functionality through intentional state changes.

Rocksmarker mappings

Editor tasks

<C-s>
Ctrl+s Saves the current buffer in both insert and normal modes.
Ensures quick preservation of changes without interrupting the workflow.
<C-a>
Ctrl+a Saves all open buffers in both insert and normal modes.
Enables simultaneous saving of modifications across all open buffers with a single command.
<leader>b
Space+b Creates a new empty buffer.
Provides a quick way to start fresh notes or edits.
<leader>x
Space+x Closes the current buffer.
Helps to keep a clean workspace by removing unnecessary buffers.
<leader>X
Space+X Closes all open buffers.
Resets the workspace efficiently for new tasks.
<TAB>
Tab Cycles to the next buffer in the buffer line.
Enables seamless navigation between open files.
<S-TAB>
Shift+Tab Cycles to the earlier buffer in the buffer line.
Facilitates bidirectional buffer navigation.
<leader>bp
Space+b+p Opens a buffer picker for selecting an open buffer.
Allows direct access to any open buffer through a visual interface.
<leader>fb
Space+f+b Displays a list of all open buffers in a structured picker.
Provides an overview for buffer switching and management.
<leader>q
Space+q Quit the editor.
Close the nvim session.
<C-e>
Ctrl+e Open the file manager picker.
Browse and select files within the project directory.
<C-f>
Ctrl+f Open the file search picker.
Fuzzy-search and open files across the project.
<leader>fo
Ctrl+f+o Open the recent files picker.
Access recent files.
<F8> (Markdown files only)
F8 Open the Markdown headers picker.
Jump to headers within the current Markdown file.
<F6> (Markdown files only)
F6 Open the Markdown diagnostics picker.
Review issues specific to the Markdown buffer.
<leader>F
Space+F Format the current buffer.
Apply consistent code styling using LSP or fallback formatters.
<C-c> (Visual Mode)
Ctrl+c Copy selected text to the system clipboard.
Share or transfer text outside Neovim.
<C-x> (Visual Mode)
Ctrl+x Cut selected text to the system clipboard.
Delete and copy text for external use.
<S-c> (Normal Mode)
Shift+c Copy the entire line to the system clipboard.
Duplicate or export lines effortlessly.
<S-x> (Normal Mode)
Shift+x Cut the entire line to the system clipboard.
Move or delete lines while preserving them in the clipboard.
<C-v> (Visual/Normal Mode/Insert Mode)
Ctrl+v Paste over selected text from the system clipboard.
Replace text with clipboard content.
<CS-v> (Visual Mode)
Ctrl+Shift+v Paste without overwriting the current register.
Preserve the default register during paste operations.
y (Visual Mode)
y Yank text and preserve cursor position.
Copy text while maintaining workflow continuity.
p (Visual Mode)
p Paste text and preserve cursor position.
Insert text without disrupting cursor placement.
J (Visual Mode)
J Move the selected block down.
Rearrange code or text blocks efficiently.
K (Visual Mode)
K Move the selected block up.
Adjust block positioning with minimal effort.
<A-s>
Alt+s Open the session selector.
Choose and load a saved session.
<A-l>
Alt+l Load the last session.
Restore the last workspace state.
<leader>ss
Space+s+s Save the current session.
Preserve open buffers, layouts, and workspace configuration.
<leader>sl
Space+s+l Load the last saved session.
Quickly resume the prior workspace.
<leader>st
Space+s+t Stop the current session.
Close the active session while retaining its data.
<leader>sd
Space+s+d Delete a saved session.
Remove unwanted sessions from the list.
<leader>R
Space+R Opens the search and replace interface.
Enables global search and replacement across your project.
<leader>rw
Space+r+w Searches for the word under the cursor globally.
Pre-fills the search field with the current word, streamlining project-wide replacements.
<leader>rp
Space+r+p Searches for the word under the cursor in the current file.
Focuses the search and replace operation on the active buffer, improving precision.
<Esc>
Esc Clear search highlights.
Remove visual remnants after searching.

Advanced tasks

<leader>gm
Space+g+m Open Neogit for the workspace.
To manage Git operations at the project level.
<leader>gM
Space+g+M Open Neogit for the current buffer's directory.
Focus Git operations on the active file's directory.
<leader>gl
Space+g+l Open the Git commit log picker for the repository.
Review the project's commit history.
<leader>gb
Space+g+b Open the Git commit log picker for the current buffer.
Track changes specific to the active file.
<leader>gd
Space+g+d Open the Git diff picker for the current buffer.
Review modifications in the active file.
<leader>gs
Space+g+s Open the Git status picker.
View modified, staged, and untracked files.
<leader>ca
Space+c+a Trigger code actions.
Apply quick fixes, refactors, or source actions suggested by the LSP.
K
K Show hover documentation.
Display type information, signatures, or documentation for the symbol under the cursor.
gd
g+d Go to definition.
Jump to the symbol definition location.
<leader>ls
Space+l+s Open the document symbols picker.
Browse symbols within the current file.
<C-k>
Ctrl+k Show signature documentation.
View parameter hints and function signatures.
<leader>lR
Space+l+R Rename symbol.
Refactor symbol names across the project.
<leader>lr
Space+l+r Open the LSP references picker.
Find all references to the symbol under the cursor.
<leader>lI
Space+l+I Open the LSP implementations picker.
Jump to implementations of the symbol.
<leader>lD
Space+l+D Go to type definition.
Browse to the type definition of the symbol.
<leader>lw
Space+l+w Open the workspace symbols picker.
Search for symbols across the entire project.
<leader>lh
Space+l+h Toggle document highlight.
Highlight all references to the symbol under the cursor.
<leader>li
Space+l+i Toggle inlay hints.
Show or hide inline type hints and parameter names.
<leader>dw
Space+d+w Open the workspace diagnostics picker.
Review errors, warnings, and issues across the entire project.
<leader>db
Space+d+b Open the buffer diagnostics picker.
Focus on issues within the active file.
<leader>dd
Space+d+d Toggle diagnostic virtual text.
Show or hide inline diagnostic messages in the buffer.
<leader>th
Space+t+h Toggle Harper grammar checker.
Enable or disable real-time grammar and writing style suggestions.
<a-t> (Normal/Insert)
Alt+t Toggle the integrated terminal.
Open or close the terminal pane for command-line tasks.

Utilities

<leader>hl
Space+h+l Open the help search picker.
Quickly search and browse Neovim's documentation.
<F7>
F7 Open the syntax highlights picker.
Inspect and change color schemes or highlight groups in the current buffer.
<a-z> (Normal Mode)
Alt+z Toggle Zen mode.
Enter a focused, distraction-free editing environment.

Keybinding optimization for Markdown

This setup minimizes repetitive manual input and accelerates navigation, text manipulation, and project management within Markdown documents.

The configuration leverages Neovim's extensible architecture, allowing incremental customization. As workflows evolve, mappings can be refined to keep alignment with efficiency goals. The result is a responsive, adaptable foundation that supports both immediate productivity and long-term flexibility.