docs: updated keymaps

This commit is contained in:
Folke Lemaitre
2023-01-16 22:04:13 +01:00
parent b0a83a5816
commit aa47cc862b

102
README.md
View File

@ -399,6 +399,58 @@ return {
},
},
},
-- Use <tab> for completion and snippets (supertab)
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
{
"L3MON4D3/LuaSnip",
keys = function()
return {}
end,
},
-- then: setup supertab in cmp
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-emoji",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
})
end,
},
}
```
@ -419,7 +471,7 @@ possible keymaps starting with `<space>`.
<details><summary>General</summary>
| Key | Description | Mode |
| -------------------- | -------------------------- | -------------------------- |
| -------------------- | ------------------------------------- | -------------------------- |
| `<C-h>` | Go to left window | **n** |
| `<C-j>` | Go to lower window | **n** |
| `<C-k>` | Go to upper window | **n** |
@ -433,7 +485,7 @@ possible keymaps starting with `<space>`.
| `<leader>bb` | Switch to Other Buffer | **n** |
| `` <leader>` `` | Switch to Other Buffer | **n** |
| `<esc>` | Escape and clear hlsearch | **i**, **n** |
| `<leader>ur` | Redraw and clear hlsearch | **n** |
| `<leader>ur` | Redraw / clear hlsearch / diff update | **n** |
| `n` | Next search result | **n**, **x**, **o** |
| `N` | Prev search result | **n**, **x**, **o** |
| `<C-s>` | Save file | **i**, **v**, **n**, **s** |
@ -454,10 +506,12 @@ possible keymaps starting with `<space>`.
| `<leader>ft` | Terminal (root dir) | **n** |
| `<leader>fT` | Terminal (cwd) | **n** |
| `<esc><esc>` | Enter Normal Mode | **t** |
| `<leader>ww` | other-window | **n** |
| `<leader>wd` | delete-window | **n** |
| `<leader>w-` | split-window-below | **n** |
| `<leader>w\|` | split-window-right | **n** |
| `<leader>ww` | Other window | **n** |
| `<leader>wd` | Delete window | **n** |
| `<leader>w-` | Split window below | **n** |
| `<leader>w\|` | Split window right | **n** |
| `<leader>-` | Split window below | **n** |
| `<leader>\|` | Split window right | **n** |
| `<leader><tab>l` | Last | **n** |
| `<leader><tab>f` | First | **n** |
| `<leader><tab><tab>` | New Tab | **n** |
@ -481,8 +535,9 @@ possible keymaps starting with `<space>`.
| `gt` | Goto Type Definition | **n** |
| `K` | Hover | **n** |
| `gK` | Signature Help | **n** |
| `[d` | Next Diagnostic | **n** |
| `]d` | Prev Diagnostic | **n** |
| `<c-k>` | Signature Help | **i** |
| `]d` | Next Diagnostic | **n** |
| `[d` | Prev Diagnostic | **n** |
| `]e` | Next Error | **n** |
| `[e` | Prev Error | **n** |
| `]w` | Next Warning | **n** |
@ -497,10 +552,17 @@ possible keymaps starting with `<space>`.
<details><summary>Plugins</summary>
| Key | Description | Mode |
| ----------------- | ----------------------------------------------------------------------------------------------- | ----- |
| ----------------- | ------------------------------------------------------------------------------------------------------ | ------------ |
| `<leader>cm` | [mason.nvim](https://github.com/williamboman/mason.nvim.git) Mason | **n** |
| `<leader>bd` | [mini.bufremove](https://github.com/echasnovski/mini.bufremove.git) Delete Buffer | **n** |
| `<leader>bD` | [mini.bufremove](https://github.com/echasnovski/mini.bufremove.git) Delete Buffer (Force) | **n** |
| `gza` | [mini.surround](https://github.com/echasnovski/mini.surround.git) Add surrounding | **n**, **v** |
| `gzd` | [mini.surround](https://github.com/echasnovski/mini.surround.git) Delete surrounding | **n** |
| `gzf` | [mini.surround](https://github.com/echasnovski/mini.surround.git) Find right surrounding | **n** |
| `gzF` | [mini.surround](https://github.com/echasnovski/mini.surround.git) Find left surrounding | **n** |
| `gzh` | [mini.surround](https://github.com/echasnovski/mini.surround.git) Highlight surrounding | **n** |
| `gzr` | [mini.surround](https://github.com/echasnovski/mini.surround.git) Replace surrounding | **n** |
| `gzn` | [mini.surround](https://github.com/echasnovski/mini.surround.git) Update `MiniSurround.config.n_lines` | **n** |
| `<leader>fe` | [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim.git) Explorer NeoTree (root dir) | **n** |
| `<leader>fE` | [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim.git) Explorer NeoTree (cwd) | **n** |
| `<leader>e` | [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim.git) Explorer NeoTree (root dir) | **n** |
@ -513,6 +575,8 @@ possible keymaps starting with `<space>`.
| `<c-b>` | [noice.nvim](https://github.com/folke/noice.nvim.git) Scroll backward | **n** |
| `<leader>un` | [nvim-notify](https://github.com/rcarriga/nvim-notify.git) Delete all Notifications | **n** |
| `<leader>sr` | [nvim-spectre](https://github.com/windwp/nvim-spectre.git) Replace in files (Spectre) | **n** |
| `<c-space>` | [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter.git) Increment selection | **n** |
| `<c-bs>` | [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter.git) Schrink selection | **n** |
| `<leader>qs` | [persistence.nvim](https://github.com/folke/persistence.nvim.git) Restore Session | **n** |
| `<leader>ql` | [persistence.nvim](https://github.com/folke/persistence.nvim.git) Restore Last Session | **n** |
| `<leader>qd` | [persistence.nvim](https://github.com/folke/persistence.nvim.git) Don't Save Current Session | **n** |
@ -520,25 +584,28 @@ possible keymaps starting with `<space>`.
| `<leader>/` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Find in Files (Grep) | **n** |
| `<leader>:` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Command History | **n** |
| `<leader><space>` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Find Files (root dir) | **n** |
| `<leader>fF` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Find Files (cwd) | **n** |
| `<leader>fb` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Buffers | **n** |
| `<leader>ff` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Find Files (root dir) | **n** |
| `<leader>fF` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Find Files (cwd) | **n** |
| `<leader>fr` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Recent | **n** |
| `<leader>gc` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) commits | **n** |
| `<leader>gs` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) status | **n** |
| `<leader>sa` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Auto Commands | **n** |
| `<leader>sC` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Commands | **n** |
| `<leader>so` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Options | **n** |
| `<leader>st` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Telescope | **n** |
| `<leader>sh` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Search Highlight Groups | **n** |
| `<leader>sG` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Grep (cwd) | **n** |
| `<leader>sk` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Key Maps | **n** |
| `<leader>sM` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Man Pages | **n** |
| `<leader>sb` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Buffer | **n** |
| `<leader>sc` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Command History | **n** |
| `<leader>sC` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Commands | **n** |
| `<leader>sg` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Grep (root dir) | **n** |
| `<leader>sG` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Grep (cwd) | **n** |
| `<leader>sh` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Help Pages | **n** |
| `<leader>sH` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Search Highlight Groups | **n** |
| `<leader>sk` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Key Maps | **n** |
| `<leader>sM` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Man Pages | **n** |
| `<leader>sm` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Jump to Mark | **n** |
| `<leader>so` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Options | **n** |
| `<leader>st` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Telescope | **n** |
| `<leader>sw` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Word (root dir) | **n** |
| `<leader>sW` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Word (cwd) | **n** |
| `<leader>uC` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Colorscheme with preview | **n** |
| `<leader>ss` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Goto Symbol | **n** |
| `]t` | [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git) Next todo comment | **n** |
| `[t` | [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git) Previous todo comment | **n** |
@ -607,6 +674,7 @@ possible keymaps starting with `<space>`.
- [tokyonight.nvim](https://github.com/folke/tokyonight.nvim)
- [trouble.nvim](https://github.com/folke/trouble.nvim)
- [vim-illuminate](https://github.com/RRethy/vim-illuminate)
- [vim-repeat](https://github.com/tpope/vim-repeat)
- [vim-startuptime](https://github.com/dstein64/vim-startuptime)
- [which-key.nvim](https://github.com/folke/which-key.nvim)