feat: rework nvim keymap

main
sudo pacman -Syu 2024-05-10 01:30:55 +07:00
parent 8810ffe62a
commit 881feb4981
2 changed files with 75 additions and 77 deletions

View File

@ -166,20 +166,6 @@
</ul>
</li>
</ul>
<div class="markdown-heading">
<h2 class="heading-element">Fold</h2>
<a
id="user-content-fold"
class="anchor"
aria-label="Permalink: Fold"
href="#fold"
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li><code>zR</code>: open all folds.</li>
<li><code>za</code>, <code>zA</code>: toggle fold</li>
</ul>
<div class="markdown-heading">
<h2 class="heading-element">Keymap</h2>
<a
@ -206,6 +192,14 @@
course :D
</p>
</li>
<li>
<p>Black hole register:</p>
<ul>
<li><code>&lt;Leader&gt;d</code>: <code>d</code> without yank</li>
<li><code>&lt;Leader&gt;c</code>: <code>c</code> without yank</li>
<li><code>&lt;Leader&gt;x</code>: <code>x</code> without yank</li>
</ul>
</li>
<li>
<p>
With
@ -215,6 +209,7 @@
<li><code>&lt;Leader&gt;f</code>: find files</li>
<li><code>&lt;Leader&gt;l</code>: find lines</li>
<li><code>&lt;Leader&gt;rg</code>: grep files</li>
<li><code>&lt;Leader&gt;g</code>: git status</li>
<li>
With
<a href="https://github.com/neovim/nvim-lspconfig"
@ -222,14 +217,27 @@
>
helps:
<ul>
<li><code>&lt;Space&gt;s</code>: find lsp symbols</li>
<li><code>&lt;Space&gt;d</code>: go to definition</li>
<li><code>&lt;Space&gt;r</code>: go to references</li>
<li><code>&lt;Space&gt;i</code>: go to implementation</li>
<li><code>&lt;Space&gt;s</code>: list lsp symbols</li>
<li>
<code>&lt;Space&gt;r</code>, <code>gr</code>: list references
</li>
<li>
<code>&lt;Space&gt;i</code>, <code>gi</code>: list
implementation
</li>
<li><code>&lt;Space&gt;ca</code>: list code action</li>
</ul>
</li>
</ul>
</li>
<li>
<p>
With <a href="https://github.com/ms-jpq/coq_nvim">ms-jpq/coq_nvim</a>:
</p>
<ul>
<li><code>&lt;C-Space&gt;</code>: trigger completion</li>
</ul>
</li>
<li>
<p>
With
@ -279,31 +287,6 @@
>
</p>
<ul>
<li>
With mini-bracketed
<ul>
<li>
<code>[D</code>, <code>]D</code>, <code>[d</code>,
<code>]d</code>: diagnostic backward/forward
</li>
<li>
<code>[Q</code>, <code>]Q</code>, <code>[q</code>,
<code>]q</code>: quickfix backward/forward
</li>
<li>
<code>[T</code>, <code>]T</code>, <code>[t</code>,
<code>]t</code>: tree-sitter backward/forward
<ul>
<li>
Support more languages with
<a href="https://github.com/nvim-treesitter/nvim-treesitter"
>nvim-treesitter/nvim-treesitter</a
>
</li>
</ul>
</li>
</ul>
</li>
<li>
With mini-comment
<ul>
@ -311,12 +294,6 @@
<li><code>gc</code>: comment/uncomment selected lines</li>
</ul>
</li>
<li>
With mini-completion
<ul>
<li><code>&lt;C-Space&gt;</code>: trigger completion</li>
</ul>
</li>
<li>
With mini-surround
<ul>
@ -327,6 +304,17 @@
</li>
</ul>
</li>
<li>
<p>
With
<a href="https://github.com/stevearc/conform.nvim"
>stevearc/conform.nvim</a
>:
</p>
<ul>
<li><code>&lt;Space&gt;f</code>: format code</li>
</ul>
</li>
<li>
<p>
With
@ -335,12 +323,24 @@
>:
</p>
<ul>
<li><code>&lt;Space&gt;e</code>: float diagnostic</li>
<li><code>&lt;Space&gt;k</code>: hover</li>
<li><code>]d</code>, <code>[d</code>: next/previous diagnostic</li>
<li><code>&lt;Space&gt;e</code>: current diagnostic</li>
<li><code>&lt;Space&gt;lr</code>: restart lsp server</li>
<li><code>gd</code>: go to definition</li>
<li><code>&lt;Space&gt;k</code>, <code>gk</code>: hover</li>
<li><code>&lt;F2&gt;</code>: rename</li>
<li><code>&lt;Space&gt;f</code>: format code</li>
<li><code>&lt;Space&gt;ca</code>: code action</li>
<li><code>&lt;Space&gt;ci</code>: organize imports</li>
</ul>
</li>
<li>
<p>
With
<a href="https://github.com/github/copilot.vim">github/copilot.vim</a
>:
</p>
<ul>
<li>
<code>&lt;M-Right&gt;</code>: completion, replace <code>Tab</code>
</li>
</ul>
</li>
</ul>

View File

@ -84,11 +84,6 @@ Advance:
- Support jump to Go definition with
[fatih/vim-go](https://github.com/fatih/vim-go).
## Fold
- `zR`: open all folds.
- `za`, `zA`: toggle fold
## Keymap
Use both `\` and `;` as leader key:
@ -103,16 +98,23 @@ Ground rules:
- `<Leader>` prefix: prefer global keymap
- `<Space>` prefix: prefer lsp keymap, for coding of course :D
- Black hole register:
- `<Leader>d`: `d` without yank
- `<Leader>c`: `c` without yank
- `<Leader>x`: `x` without yank
- With [ibhagwan/fzf-lua](https://github.com/ibhagwan/fzf-lua):
- `<Leader>f`: find files
- `<Leader>l`: find lines
- `<Leader>rg`: grep files
- `<Leader>g`: git status
- With [neovim/nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
helps:
- `<Space>s`: find lsp symbols
- `<Space>d`: go to definition
- `<Space>r`: go to references
- `<Space>i`: go to implementation
- `<Space>s`: list lsp symbols
- `<Space>r`, `gr`: list references
- `<Space>i`, `gi`: list implementation
- `<Space>ca`: list code action
- With [ms-jpq/coq_nvim](https://github.com/ms-jpq/coq_nvim):
- `<C-Space>`: trigger completion
- With [nvim-tree/nvim-tree.lua](https://github.com/nvim-tree/nvim-tree.lua),
inside nvim-tree:
- `<C-n>`: toggle
@ -129,28 +131,24 @@ Ground rules:
- With [tpope/vim-projectionist](https://github.com/tpope/vim-projectionist)
- `:A`: open alternate file
- With [echasnovski/mini.nvim](https://github.com/echasnovski/mini.nvim)
- With mini-bracketed
- `[D`, `]D`, `[d`, `]d`: diagnostic backward/forward
- `[Q`, `]Q`, `[q`, `]q`: quickfix backward/forward
- `[T`, `]T`, `[t`, `]t`: tree-sitter backward/forward
- Support more languages with
[nvim-treesitter/nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- With mini-comment
- `gcc`: comment/uncomment current line
- `gc`: comment/uncomment selected lines
- With mini-completion
- `<C-Space>`: trigger completion
- With mini-surround
- `sa`: add surround
- `sd`: delete surround
- `sr`: replace surround
- With [neovim/nvim-lspconfig](https://github.com/neovim/nvim-lspconfig):
- `<Space>e`: float diagnostic
- `<Space>k`: hover
- `<F2>`: rename
- With [stevearc/conform.nvim](https://github.com/stevearc/conform.nvim):
- `<Space>f`: format code
- `<Space>ca`: code action
- `<Space>ci`: organize imports
- With [neovim/nvim-lspconfig](https://github.com/neovim/nvim-lspconfig):
- `]d`, `[d`: next/previous diagnostic
- `<Space>e`: current diagnostic
- `<Space>lr`: restart lsp server
- `gd`: go to definition
- `<Space>k`, `gk`: hover
- `<F2>`: rename
- With [github/copilot.vim](https://github.com/github/copilot.vim):
- `<M-Right>`: completion, replace `Tab`
## References / Thanks