My Neovim Configuration :
� This configuration is partially based on the setup by Hendrik Mi (https://github.com/hendrikmi). I have added custom configurations for auto-session management and STM32 Cortex-M debugging.
-- Plugins and Keymaps
-- Plugins are managed using a plugin manager (e.g., packer.nvim, lazy.nvim). -- Keymaps are optimized for productivity and ease of use.
The leader key is set to <Space>. This key is used as a prefix for many custom keybindings.
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '- Move through wrapped lines:
j: Move down (handls wrapped lines).k: Move up (handles wrapped lines).
<C-s>: Save the current file.<leader>sn: Save the file without auto-formatting.<C-q>: Quit the current buffer.
x: Delete a single character without copying it into the register.<leader>+: Increment the number under the cursor.<leader>-: Decrement the number under the cursor.
n: Find the next match and center the screen.N: Find the previous match and center the screen.<leader>j: Replace the word under the cursor (usescgn).
<leader>v: Split the window vertically.<leader>h: Split the window horizontally.<leader>se: Make all split windows equal in size.<leader>xs: Close the current split window.
<C-k>: Move to the split above.<C-j>: Move to the split below.<C-h>: Move to the split on the left.<C-l>: Move to the split on the right.
<Up>: Increase the height of the current split.<Down>: Decrease the height of the current split.<Left>: Decrease the width of the current split.<Right>: Increase the width of the current split.
<Tab>: Switch to the next buffer.<S-Tab>: Switch to the previous buffer.<leader>x: Close the current buffer.<leader>b: Open a new buffer.
<leader>to: Open a new tab.<leader>tx: Close the current tab.<leader>tn: Go to the next tab.<leader>tp: Go to the previous tab.
<: Decrease indentation.>: Increase indentation.
<A-j>: Move the selected lines down.<A-k>: Move the selected lines up.
p: Paste without overwriting the default register.
<leader>y: Yank the selected text to the system clipboard.<leader>Y: Yank the entire line to the system clipboard.
<leader>do: Toggle diagnostics on/off.
[d: Go to the previous diagnostic message.]d: Go to the next diagnostic message.<leader>d: Open a floating window with the diagnostic message.<leader>q: Open the diagnostics list.
<leader>ss: Save the current session to.session.vim.<leader>sl: Load the session from.session.vim.
<F5>: Start or continue debugging.<F1>: Step into a function.<F2>: Step over a function.<F3>: Step out of a function.<leader>b: Toggle a breakpoint.<leader>B: Set a conditional breakpoint (prompts for a condition).
<F7>: Toggle the DAP UI to see the last session result.
<leader>?: Find recently opened files.<leader>sb: Search existing buffers.<leader>sm: Search marks.<leader>sf: Search files.<leader>sh: Search help tags.<leader>sw: Search for the word under the cursor.<leader>sg: Live grep in the project.<leader>sd: Search diagnostics.<leader>sr: Resume the last search.<leader>s.: Search recent files.<leader>sds: Search LSP document symbols.<leader>/: Fuzzy search in the current buffer.
<leader>gf: Search Git files.<leader>gc: Search Git commits.<leader>gcf: Search Git commits for the current file.<leader>gb: Search Git branches.<leader>gs: Search Git status (diff view).
<leader>w: Toggle the floating Neo-tree window.<leader>e: Toggle the left Neo-tree window.<leader>ngs: Open the Git status window in Neo-tree.
<space>: Toggle a node in Neo-tree.<cr>: Open a file or directory.<esc>: Cancel or close the Neo-tree window.P: Toggle preview mode.l: Open a file or directory.S: Open a file in a horizontal split.s: Open a file in a vertical split.t: Open a file in a new tab.w: Open a file with the window picker.C: Close a node.z: Close all nodes.a: Add a file or directory.A: Add a directory.d: Delete a file or directory.r: Rename a file or directory.y: Copy to clipboard.x: Cut to clipboard.p: Paste from clipboard.c: Copy a file or directory.m: Move a file or directory.q: Close the Neo-tree window.R: Refresh the Neo-tree window.?: Show help.
<leader>asr: Search for a session.<leader>ass: Save the current session.<leader>asa: Toggle autosave for sessions.
Auto-session is configured with the following options:
- Session Lens: Enabled with Telescope integration.
- Mappings:
<C-D>: Delete a session.<C-S>: Alternate between sessions.<C-Y>: Copy a session.
- LSP: Language Server Protocol.
- Luasnip: Snippet engine.
- Buffer: Current buffer.
- Path: File paths.
-
Icons: Custom icons for different completion kinds.
-
Menu: Source of the completion item (e.g., LSP, Snippet, Buffer, Path).
-
<C-_>: Toggle linewise comment. -
<C-c>: Toggle linewise comment. -
<C-/>: Toggle linewise comment.
<C-_>: Toggle comment for the selected region.<C-c>: Toggle comment for the selected region.<C-/>: Toggle comment for the selected region.
<leader>M: Toggle the Harpoon quick menu.<leader>m: Add the current file to the Harpoon list.
<leader>1: Navigate to the first file in the Harpoon list.<leader>2: Navigate to the second file in the Harpoon list.<leader>3: Navigate to the third file in the Harpoon list.<leader>4: Navigate to the fourth file in the Harpoon list.
<leader>p: Navigate to the previous buffer in the Harpoon list.<leader>n: Navigate to the next buffer in the Harpoon list.
<C-j>: Select the next item.<C-k>: Select the previous item.<CR>: Confirm the selected completion.<C-c>: Manually trigger completion.
<C-l>: Jump to the next snippet placeholder.<C-h>: Jump to the previous snippet placeholder.
<Tab>: Select the next item or expand a snippet.<S-Tab>: Select the previous item or jump to the previous snippet placeholder.
- Use
<Space>as the leader key to access most custom keybindings. - For session management, use
<leader>asr,<leader>ass, and<leader>asa. - Use
<C-_>,<C-c>, and<C-/>to toggle comments. - Use
<leader>Mand<leader>mto manage files with Harpoon. - Use
<C-j>,<C-k>, and<CR>for autocompletion with nvim-cmp.