Skip to content

feat/keybinds and cheatsheet #1676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ test.sh
nvim

spell/
lazy-lock.json
140 changes: 140 additions & 0 deletions Cheatsheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
### Neovim Keybinds Cheatsheet

This cheatsheet provides a structured overview of keybindings found in your Neovim configuration files.

#### General Keymaps

* `<Esc>`: Clear highlights on search.

* `<leader>q`: Open diagnostic Quickfix list.

* `<Esc><Esc>`: Exit terminal mode.

* `<left>`: Echo "Use h to move left!!".

* `<right>`: Echo "Use l to move right!!".

* `<up>`: Echo "Use k to move up!!".

* `<down>`: Echo "Use j to move down!!".

* `<C-h>`: Move focus to the left window.

* `<C-l>`: Move focus to the right window.

* `<C-j>`: Move focus to the lower window.

* `<C-k>`: Move focus to the upper window.

#### GitSigns Keymaps

* `n`\]c\`: Jump to next git change (normal mode).

* `n`\[`c`: Jump to previous git change (normal mode).

* `v`<leader>hs\`: Stage hunk (visual mode).

* `v`<leader>hr\`: Reset hunk (visual mode).

* `n`<leader>hs\`: Stage hunk (normal mode).

* `n`<leader>hr\`: Reset hunk (normal mode).

* `n`<leader>hS\`: Stage buffer (normal mode).

* `n`<leader>hu\`: Undo stage hunk (normal mode).

* `n`<leader>hR\`: Reset buffer (normal mode).

* `n`<leader>hp\`: Preview hunk (normal mode).

* `n`<leader>hb\`: Blame line (normal mode).

* `n`<leader>hd\`: Diff against index (normal mode).

* `n`<leader>hD\`: Diff against last commit (normal mode).

* `n`<leader>tb\`: Toggle git show blame line (normal mode).

* `n`<leader>tD\`: Toggle git show Deleted (normal mode).

#### Debugging Keymaps

* `<F5>`: Start/Continue debugging.

* `<F1>`: Step Into.

* `<F2>`: Step Over.

* `<F3>`: Step Out.

* `<leader>b`: Toggle Breakpoint.

* `<leader>B`: Set Breakpoint (with condition prompt).

* `<F7>`: See last session result.

#### Telescope Keymaps

* `<leader>sh`: Search Help.

* `<leader>sk`: Search Keymaps.

* `<leader>sf`: Search Files.

* `<leader>ss`: Select Telescope Builtins.

* `<leader>sw`: Search current Word.

* `<leader>sg`: Search by Grep.

* `<leader>sd`: Search Diagnostics.

* `<leader>sr`: Resume last search.

* `<leader>s.`: Search Recent Files.

* `<leader><leader>`: Find existing buffers.

* `<leader>/`: Fuzzily search in current buffer.

* `<leader>s/`: Live Grep in Open Files.

* `<leader>sn`: Search Neovim files (in config directory).

#### LSP (Language Server Protocol) Keymaps

* `grn`: \[R\]e\[n\]ame.

* `gra`: \[G\]oto Code \[A\]ction (normal and visual modes).

* `grr`: \[G\]oto \[R\]eferences.

* `gri`: \[G\]oto \[I\]mplementation.

* `grd`: \[G\]oto \[D\]efinition.

* `grD`: \[G\]oto \[D\]eclaration.

* `gO`: Open Document Symbols.

* `gW`: Open Workspace Symbols.

* `grt`: \[G\]oto \[T\]ype Definition.

* `<leader>th`: [T]oggle Inlay [H]ints.

#### Neo-tree Keymaps

* `<leader>e`: Toggle Neo-tree.

* `<leader>E`: Reveal current file in Neo-tree.

* `<leader>b`: Toggle Neo-tree (buffers).

* `<leader>g`: Toggle Neo-tree (git_status).

#### Conform (Autoformat) Keymaps

* `<leader>f`: Format buffer.

Binary file added Cheatsheet.pdf
Binary file not shown.
32 changes: 20 additions & 12 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '

-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false
vim.g.have_nerd_font = true

-- [[ Setting options ]]
-- See `:help vim.o`
Expand All @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
vim.o.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.o.relativenumber = true
vim.o.relativenumber = true

-- Enable mouse mode, can be useful for resizing splits for example!
vim.o.mouse = 'a'
Expand Down Expand Up @@ -185,10 +185,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })

-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move left!!"<CR>')
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move right!!"<CR>')
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move up!!"<CR>')
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move down!!"<CR>')

-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
Expand Down Expand Up @@ -437,6 +437,14 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })

-- Neo-tree Keymaps (add these to your init.lua)
-- These are common mappings often found in Kickstart.nvim configurations for Neo-tree.
-- Ensure nvim-neo-tree/neo-tree.nvim is correctly installed and loaded.
vim.keymap.set('n', '<leader>e', ':Neotree toggle<CR>', { desc = 'Toggle Neo-tree' })
vim.keymap.set('n', '<leader>E', ':Neotree reveal<CR>', { desc = 'Reveal current file in Neo-tree' })
vim.keymap.set('n', '<leader>b', ':Neotree buffers<CR>', { desc = 'Toggle Neo-tree (buffers)' })
vim.keymap.set('n', '<leader>g', ':Neotree git_status<CR>', { desc = 'Toggle Neo-tree (git_status)' })

-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
Expand Down Expand Up @@ -973,12 +981,12 @@ require('lazy').setup({
-- Here are some example plugins that I've included in the Kickstart repository.
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
--
-- require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line',
-- require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs',
-- require 'kickstart.plugins.neo-tree',
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
require 'kickstart.plugins.debug',
require 'kickstart.plugins.indent_line',
require 'kickstart.plugins.lint',
require 'kickstart.plugins.autopairs',
require 'kickstart.plugins.neo-tree',
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps

-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- This is the easiest way to modularize your config.
Expand Down
34 changes: 34 additions & 0 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
"blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" },
"conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" },
"fidget.nvim": { "branch": "main", "commit": "c1725fbadd99c810273b202d67dbfedf66e61eaf" },
"gitsigns.nvim": { "branch": "main", "commit": "b01433169be710d6c69f7b4ee264d9670698b831" },
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "f2fa60409630ec2d24acf84494fb55e1d28d593c" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "86389a3dd687cfaa647b6f44731e492970034baa" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
"mason.nvim": { "branch": "main", "commit": "3671ab0d40aa5bd24b1686562bd0a23391ecf76a" },
"mini.nvim": { "branch": "main", "commit": "c122e852517adaf7257688e435369c050da113b1" },
"neo-tree.nvim": { "branch": "main", "commit": "cea666ef965884414b1b71f6b39a537f9238bdb2" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-dap": { "branch": "master", "commit": "5dd4d50f2e6a2eaf9e57fad023d294ef371bda35" },
"nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-lint": { "branch": "master", "commit": "9c6207559297b24f0b7c32829f8e45f7d65b991f" },
"nvim-lspconfig": { "branch": "master", "commit": "177be29e7b9c084c9200ee4033eb66e04ac536ec" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "4a8369f4c78ef6f6f895f0cec349e48f74330574" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}
24 changes: 12 additions & 12 deletions lua/kickstart/plugins/neo-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ return {
'MunifTanjim/nui.nvim',
},
lazy = false,
keys = {
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
},
opts = {
filesystem = {
window = {
mappings = {
['\\'] = 'close_window',
},
},
},
},
-- keys = {
-- { '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
--},
-- opts = {
-- filesystem = {
-- window = {
-- mappings = {
-- ['\\'] = 'close_window',
-- },
-- },
-- },
--},
}