feat: new keymap
parent
71ecec2bbb
commit
c7924022ba
|
@ -50,11 +50,6 @@
|
|||
All configs are in
|
||||
<a href="https://github.com/haunt98/dotfiles">my dotfiles</a>.
|
||||
</p>
|
||||
<p>Use both <code>\</code> and <code>;</code> as leader key:</p>
|
||||
<div class="highlight highlight-source-lua">
|
||||
<pre>vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>;<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span><leader><span class="pl-pds">"</span></span>, { remap <span class="pl-k">=</span> <span class="pl-c1">true</span> })
|
||||
vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>'<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span><leader><span class="pl-pds">"</span></span>, { remap <span class="pl-k">=</span> <span class="pl-c1">true</span> })</pre>
|
||||
</div>
|
||||
<p>Search multiple words:</p>
|
||||
<div class="highlight highlight-source-viml">
|
||||
<pre>:/<span class="pl-cce">\v</span>word1|word2|word3</pre>
|
||||
|
@ -102,22 +97,43 @@ vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span clas
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Keymap for plugin (sync with dotfiles):</p>
|
||||
<p>Use both <code>\</code> and <code>;</code> as leader key:</p>
|
||||
<div class="highlight highlight-source-lua">
|
||||
<pre>vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span><leader>f<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>:FZF<CR><span class="pl-pds">"</span></span>)
|
||||
vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span><leader>rg<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>:FZFRg<CR><span class="pl-pds">"</span></span>)
|
||||
vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span><leader>cm<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>:FZFCommands<CR><span class="pl-pds">"</span></span>)
|
||||
vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span><C-n><span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>:NvimTreeToggle<CR><span class="pl-pds">"</span></span>)
|
||||
vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span><leader>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>:NvimTreeFindFile<CR><span class="pl-pds">"</span></span>)
|
||||
vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span><leader>tr<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>:lua MiniTrailspace.trim()<CR><span class="pl-pds">"</span></span>)</pre>
|
||||
<pre>vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>;<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span><Leader><span class="pl-pds">"</span></span>, { remap <span class="pl-k">=</span> <span class="pl-c1">true</span> })
|
||||
vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>'<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span><Leader><span class="pl-pds">"</span></span>, { remap <span class="pl-k">=</span> <span class="pl-c1">true</span> })
|
||||
vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>q<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>:q<CR><span class="pl-pds">"</span></span>)</pre>
|
||||
</div>
|
||||
<ul>
|
||||
<li>
|
||||
With
|
||||
<a href="https://github.com/nvim-tree/nvim-tree.lua"
|
||||
>nvim-tree/nvim-tree.lua</a
|
||||
>, inside nvim-tree:
|
||||
<p><code><Leader></code> prefix: prefer global keymap</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
<code><Space></code> prefix: prefer lsp keymap, for coding of
|
||||
course :D
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
With
|
||||
<a href="https://github.com/ibhagwan/fzf-lua">ibhagwan/fzf-lua</a>:
|
||||
</p>
|
||||
<ul>
|
||||
<li><code><Leader>f</code>: find files</li>
|
||||
<li><code><Leader>rg</code>: grep files</li>
|
||||
<li><code><Space>s</code>: find lsp symbols</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
With
|
||||
<a href="https://github.com/nvim-tree/nvim-tree.lua"
|
||||
>nvim-tree/nvim-tree.lua</a
|
||||
>, inside nvim-tree:
|
||||
</p>
|
||||
<ul>
|
||||
<li><code><C-n></code>: toggle</li>
|
||||
<li><code><Leader>n</code>: locate file</li>
|
||||
<li><code>a</code>: create</li>
|
||||
<li><code>d</code>: delete</li>
|
||||
<li><code>r</code>: rename</li>
|
||||
|
@ -128,19 +144,32 @@ vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span clas
|
|||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
With
|
||||
<a href="https://github.com/lewis6991/gitsigns.nvim"
|
||||
>lewis6991/gitsigns.nvim</a
|
||||
>:
|
||||
<p>
|
||||
With
|
||||
<a href="https://github.com/hrsh7th/nvim-cmp">hrsh7th/nvim-cmp</a>:
|
||||
</p>
|
||||
<ul>
|
||||
<li><code><C-Space></code>: trigger completion</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
With
|
||||
<a href="https://github.com/lewis6991/gitsigns.nvim"
|
||||
>lewis6991/gitsigns.nvim</a
|
||||
>:
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>]c</code>, <code>[c</code>: next/previous git change</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
With
|
||||
<a href="https://github.com/echasnovski/mini.nvim"
|
||||
>echasnovski/mini.nvim</a
|
||||
>
|
||||
<p>
|
||||
With
|
||||
<a href="https://github.com/echasnovski/mini.nvim"
|
||||
>echasnovski/mini.nvim</a
|
||||
>
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
With mini-bracketed
|
||||
|
@ -175,20 +204,28 @@ vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span clas
|
|||
<li><code>sr</code>: replace surround</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
With mini-trailspace
|
||||
<ul>
|
||||
<li><code><Leader>tr</code>: trim trailing whitespace</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
With
|
||||
<a href="https://github.com/neovim/nvim-lspconfig"
|
||||
>neovim/nvim-lspconfig</a
|
||||
>
|
||||
<p>
|
||||
With
|
||||
<a href="https://github.com/neovim/nvim-lspconfig"
|
||||
>neovim/nvim-lspconfig</a
|
||||
>
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>gd</code>: go to definition</li>
|
||||
<li><code>gr</code>: go to references</li>
|
||||
<li><code>K</code>: hover</li>
|
||||
<li><code><Space>gd</code>: go to definition</li>
|
||||
<li><code><Space>k</code>: hover</li>
|
||||
<li><code><F2></code>: rename</li>
|
||||
<li><code><space>f</code>: format</li>
|
||||
<li><code><space>ca</code>: code action</li>
|
||||
<li><code><Space>ca</code>: code action</li>
|
||||
<li><code><Space>gr</code>: go to references</li>
|
||||
<li><code><Space>f</code>: format</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -4,13 +4,6 @@
|
|||
|
||||
All configs are in [my dotfiles](https://github.com/haunt98/dotfiles).
|
||||
|
||||
Use both `\` and `;` as leader key:
|
||||
|
||||
```lua
|
||||
vim.keymap.set("n", ";", "<leader>", { remap = true })
|
||||
vim.keymap.set("n", "'", "<leader>", { remap = true })
|
||||
```
|
||||
|
||||
Search multiple words:
|
||||
|
||||
```vim
|
||||
|
@ -46,18 +39,24 @@ Jump advance:
|
|||
- `CTRL-]`, `CTRL-T`: jump to tag/jump back from tag
|
||||
- Support jump to Go definition with [fatih/vim-go](https://github.com/fatih/vim-go).
|
||||
|
||||
Keymap for plugin (sync with dotfiles):
|
||||
Use both `\` and `;` as leader key:
|
||||
|
||||
```lua
|
||||
vim.keymap.set("n", "<leader>f", ":FZF<CR>")
|
||||
vim.keymap.set("n", "<leader>rg", ":FZFRg<CR>")
|
||||
vim.keymap.set("n", "<leader>cm", ":FZFCommands<CR>")
|
||||
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>")
|
||||
vim.keymap.set("n", "<leader>n", ":NvimTreeFindFile<CR>")
|
||||
vim.keymap.set("n", "<leader>tr", ":lua MiniTrailspace.trim()<CR>")
|
||||
vim.keymap.set("n", ";", "<Leader>", { remap = true })
|
||||
vim.keymap.set("n", "'", "<Leader>", { remap = true })
|
||||
vim.keymap.set("n", "q", ":q<CR>")
|
||||
```
|
||||
|
||||
- `<Leader>` prefix: prefer global keymap
|
||||
- `<Space>` prefix: prefer lsp keymap, for coding of course :D
|
||||
|
||||
- With [ibhagwan/fzf-lua](https://github.com/ibhagwan/fzf-lua):
|
||||
- `<Leader>f`: find files
|
||||
- `<Leader>rg`: grep files
|
||||
- `<Space>s`: find lsp symbols
|
||||
- With [nvim-tree/nvim-tree.lua](https://github.com/nvim-tree/nvim-tree.lua), inside nvim-tree:
|
||||
- `<C-n>`: toggle
|
||||
- `<Leader>n`: locate file
|
||||
- `a`: create
|
||||
- `d`: delete
|
||||
- `r`: rename
|
||||
|
@ -65,6 +64,8 @@ vim.keymap.set("n", "<leader>tr", ":lua MiniTrailspace.trim()<CR>")
|
|||
- `c`: copy
|
||||
- `p`: paste
|
||||
- `U`: toggle hidden
|
||||
- With [hrsh7th/nvim-cmp](https://github.com/hrsh7th/nvim-cmp):
|
||||
- `<C-Space>`: trigger completion
|
||||
- With [lewis6991/gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim):
|
||||
- `]c`, `[c`: next/previous git change
|
||||
- With [echasnovski/mini.nvim](https://github.com/echasnovski/mini.nvim)
|
||||
|
@ -79,13 +80,15 @@ vim.keymap.set("n", "<leader>tr", ":lua MiniTrailspace.trim()<CR>")
|
|||
- `sa`: add surround
|
||||
- `sd`: delete surround
|
||||
- `sr`: replace surround
|
||||
- With mini-trailspace
|
||||
- `<Leader>tr`: trim trailing whitespace
|
||||
- With [neovim/nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
|
||||
- `gd`: go to definition
|
||||
- `gr`: go to references
|
||||
- `K`: hover
|
||||
- `<Space>gd`: go to definition
|
||||
- `<Space>k`: hover
|
||||
- `<F2>`: rename
|
||||
- `<space>f`: format
|
||||
- `<space>ca`: code action
|
||||
- `<Space>ca`: code action
|
||||
- `<Space>gr`: go to references
|
||||
- `<Space>f`: format
|
||||
|
||||
## Reference
|
||||
|
||||
|
|
Loading…
Reference in New Issue