Skip to content

Commit eddfb0a

Browse files
committed
add some keybindgs, better rust support and add more keybinding documentation
1 parent 2140d00 commit eddfb0a

File tree

5 files changed

+91
-14
lines changed

5 files changed

+91
-14
lines changed

README.md

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ I've customized my ZSH/Tmux/Alacritty too much, so it might not work properly
2828
- [Plugins Included](#plugins-included)
2929
- [Optional Plugins](#optional-plugins)
3030
- [Custom Key-mappings](#custom-key-mappings)
31+
- [Editor UI](#ui)
32+
- [Motions](#motion)
33+
- [LSP](#lsp)
34+
- [Plugin: Gitsigns](#plugin-gitsigns)
35+
- [Plugin: LazyGit](#plugin-lazygit)
36+
- [Plugin: Telescope](#plugin-telescope)
37+
- [Plugin: Harpoon](#plugin-harpoon)
38+
- [Plugin: Neogen](#plugin-neogen)
39+
- [Plugin: Persistence](#plugin-persistence)
40+
- [Plugin: Bufferline](#plugin-bufferline)
3141

3242
<!-- vim-markdown-toc -->
3343
</details>
@@ -387,9 +397,39 @@ Note that,
387397
| <kbd>Space</kbd>+<kbd>h</kbd> | 𝐍 | Remove highlight | <small>`nohlsearch<`</small> |
388398
| <kbd>Space</kbd>+<kbd>/</kbd> | 𝐍 | Toggle comment | <small>Comment.nvim</small> |
389399
| <kbd>Space</kbd>+<kbd>?</kbd> | 𝐍 | Open cheats | <small>cheat.sh</small> |
400+
| <kbd>Space</kbd>+<kbd>'</kbd> | 𝐍 | Open marks | <small>which-key marks</small> |
390401
| <kbd>Space</kbd>+<kbd>z</kbd> | 𝐍 | Zen mode | <small>zen-mode.nvim</small> |
391402
| <kbd>Space</kbd>+<kbd>P</kbd> | 𝐍 | Projects | <small>project.nvim</small> |
392403

404+
### Motion
405+
406+
| Key | Mode | Action | Plugin or Mapping |
407+
| ------------ | :--: | ------------------------- | ----------------------------- |
408+
| <kbd>f</kbd> | 𝐍 | find next chacharacter | <small>HopChar1LineAC</small> |
409+
| <kbd>F</kbd> | 𝐍 | find prprevious character | <small>HopChar1LineBC</small> |
410+
| <kbd>s</kbd> | 𝐍 | find chacharacter | <small>HopChar2</small> |
411+
| <kbd>F</kbd> | 𝐍 | find word | <small>HopWord</small> |
412+
413+
### LSP
414+
415+
| Key | Mode | Action |
416+
| ---------------------------------------------------------------------------------------- | :--: | ----------------------------------- |
417+
| <kbd>Tab</kbd> / <kbd>Shift-Tab</kbd> | 𝐈 | Navigate completion-menu |
418+
| <kbd>Enter</kbd> | 𝐈 | Select completion or expand snippet |
419+
| <kbd>Up</kbd>or <kbd>Down</kbd> | 𝐈 | Movement in completion pop-up |
420+
| <kbd>Space</kbd>+<kbd>l</kbd>+<kbd>j</kbd> or <kbd>Space</kbd>+<kbd>l</kbd>+<kbd>k</kbd> | 𝐍 | Next/previous LSP diagnostic |
421+
| <kbd>Ctrl</kbd>+<kbd>e</kbd> | 𝐈 | Close pop-up |
422+
| <kbd>Tab</kbd> / <kbd>Shift-Tab</kbd> | 𝐈 𝐒 | Navigate snippet placeholders |
423+
| <kbd>Space</kbd>+<kbd>l</kbd> | 𝐍 | keybindings for lsp |
424+
| <kbd>g</kbd>+<kbd>a</kbd> | 𝐍 | code actions |
425+
| <kbd>g</kbd>+<kbd>d</kbd> | 𝐍 | goto definition |
426+
| <kbd>g</kbd>+<kbd>D</kbd> | 𝐍 | goto declaration |
427+
| <kbd>g</kbd>+<kbd>I</kbd> | 𝐍 | goto implementation |
428+
| <kbd>g</kbd>+<kbd>p</kbd> | 𝐍 | peek implementation |
429+
| <kbd>g</kbd>+<kbd>r</kbd> | 𝐍 | goto references |
430+
| <kbd>g</kbd>+<kbd>s</kbd> | 𝐍 | show signature help |
431+
| <kbd>Ctrl</kbd>+<kbd>s</kbd> | 𝐈 | show signature help |
432+
393433
### Plugin: Gitsigns
394434

395435
| Key | Mode | Action |
@@ -430,20 +470,44 @@ Note that,
430470
| <kbd>Space</kbd>+<kbd>F</kbd>+<kbd>p</kbd> | 𝐍 | Project search |
431471
| <kbd>Space</kbd>+<kbd>F</kbd>+<kbd>i</kbd> | 𝐍 | Installed plugins |
432472
| **Within _Telescope_ window** | |
433-
| <kbd>Escape</kbd> | 𝐈 | Exit telescope |
473+
| <kbd>Ctrl</kbd>+<kbd>c</kbd> | 𝐈 | Exit telescope |
434474
| <kbd>Ctrl</kbd>+<kbd>v</kbd> | 𝐍 | Open in a vertical split |
435475
| <kbd>Ctrl</kbd>+<kbd>s</kbd> | 𝐍 | Open in a split |
436476

437-
### Plugin: LSP
477+
### Plugin: Harpoon
438478

439-
| Key | Mode | Action |
440-
| ---------------------------------------------------------------------------------------- | :--: | ----------------------------------- |
441-
| <kbd>Tab</kbd> / <kbd>Shift-Tab</kbd> | 𝐈 | Navigate completion-menu |
442-
| <kbd>Enter</kbd> | 𝐈 | Select completion or expand snippet |
443-
| <kbd>Up</kbd>or <kbd>Down</kbd> | 𝐈 | Movement in completion pop-up |
444-
| <kbd>Space</kbd>+<kbd>l</kbd>+<kbd>j</kbd> or <kbd>Space</kbd>+<kbd>l</kbd>+<kbd>k</kbd> | 𝐍 | Next/previous LSP diagnostic |
445-
| <kbd>Ctrl</kbd>+<kbd>e</kbd> | 𝐈 | Close pop-up |
446-
| <kbd>Tab</kbd> / <kbd>Shift-Tab</kbd> | 𝐈 𝐒 | Navigate snippet placeholders |
479+
| Key | Mode | Action |
480+
| --------------------------------- | :--: | -------------------------------- |
481+
| <kbd>Space</kbd>+<kbd>Space</kbd> | 𝐍 | show harpoon shortlist |
482+
| <kbd>Space</kbd>+<kbd>a</kbd> | 𝐍 | add file to shortlist |
483+
| <kbd>Space</kbd>+<kbd>1</kbd> | 𝐍 | jump to first file on shortlist |
484+
| <kbd>Space</kbd>+<kbd>2</kbd> | 𝐍 | jump to second file on shortlist |
485+
| <kbd>Space</kbd>+<kbd>3</kbd> | 𝐍 | jump to third file on shortlist |
486+
| <kbd>Space</kbd>+<kbd>4</kbd> | 𝐍 | jump to forforthle on shortlist |
487+
488+
### Plugin: Neogen
489+
490+
| Key | Mode | Action |
491+
| ------------------------------------------ | :--: | ------------------------- |
492+
| <kbd>Space</kbd>+<kbd>n</kbd>+<kbd>c</kbd> | 𝐍 | class docdocumentation |
493+
| <kbd>Space</kbd>+<kbd>n</kbd>+<kbd>f</kbd> | 𝐍 | function docdocumentation |
494+
495+
### Plugin: Persistence
496+
497+
| Key | Mode | Action |
498+
| ------------------------------------------ | :--: | ------------------------------------- |
499+
| <kbd>Space</kbd>+<kbd>q</kbd>+<kbd>d</kbd> | 𝐍 | quit without saving session |
500+
| <kbd>Space</kbd>+<kbd>q</kbd>+<kbd>l</kbd> | 𝐍 | restore last session |
501+
| <kbd>Space</kbd>+<kbd>q</kbd>+<kbd>s</kbd> | 𝐍 | restore last session from current dir |
502+
503+
### Plugin: Bufferline
504+
505+
| Key | Mode | Action |
506+
| ------------------------------------------ | :--: | -------------------- |
507+
| <kbd>Space</kbd>+<kbd>b</kbd>+<kbd>f</kbd> | 𝐍 | find buffer |
508+
| <kbd>Space</kbd>+<kbd>b</kbd>+<kbd>b</kbd> | 𝐍 | toggle buffer groups |
509+
| <kbd>Space</kbd>+<kbd>b</kbd>+<kbd>p</kbd> | 𝐍 | pick buffer |
510+
| <kbd>Space</kbd>+<kbd>b</kbd>+<kbd>1</kbd> | 𝐍 | goto buffer 1 |
447511

448512
</details>
449513

lsp-settings/rust_analyzer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@
55
"rust-analyzer.lens.enable": true,
66
"rust-analyzer.inlayHints.enable": true,
77
"rust-analyzer.inlayHints.typeHints": true,
8-
"rust-analyzer.inlayHints.parameterHints": true
8+
"rust-analyzer.inlayHints.parameterHints": true,
9+
"rust-analyzer.lens.references": true,
10+
"rust-analyzer.lens.implementations": true,
11+
"rust-analyzer.lens.enumVariantReferences": true,
12+
"rust-analyzer.lens.methodReferences": true,
13+
"rust-analyzer.cargo.autoreload": true,
14+
"rust-analyzer.hoverActions.enable": true
915
}

lua/user/builtin.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ M.config = function()
183183
lvim.builtin.telescope.defaults.layout_config = require("user.telescope").layout_config()
184184
lvim.builtin.telescope.defaults.mappings = {
185185
i = {
186-
["<esc>"] = require("telescope.actions").close,
186+
["<C-c>"] = require("telescope.actions").close,
187187
["<C-y>"] = require("telescope.actions").which_key,
188188
},
189189
}

lua/user/hop.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ M.config = function()
66
return
77
end
88
hop.setup()
9-
vim.api.nvim_set_keymap("n", "s", ":HopChar2<cr>", { silent = true })
10-
vim.api.nvim_set_keymap("n", "S", ":HopWord<cr>", { silent = true })
9+
require("user.keybindings").set_hop_keymaps()
1110
end
1211

1312
return M

lua/user/keybindings.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ M.set_terminal_keymaps = function()
1010
vim.api.nvim_buf_set_keymap(0, "t", "<C-l>", [[<C-\><C-n><C-W>l]], opts)
1111
end
1212

13+
M.set_hop_keymaps = function()
14+
local opts = { noremap = true, silent = true }
15+
vim.api.nvim_set_keymap("n", "s", ":HopChar2<cr>", opts)
16+
vim.api.nvim_set_keymap("n", "S", ":HopWord<cr>", opts)
17+
vim.api.nvim_set_keymap("n", "f", ":HopChar1LineAC<cr>", opts)
18+
vim.api.nvim_set_keymap("n", "F", ":HopChar1LineBC<cr>", opts)
19+
end
20+
1321
M.config = function()
1422
-- Additional keybindings
1523
-- =========================================

0 commit comments

Comments
 (0)