Skip to content

Commit

Permalink
pref(cmp)!: update keymap for cmp.close
Browse files Browse the repository at this point in the history
This commit changes the keymap for `cmp.close` from `<C-e>` to `<C-w>`.

This way:
* Makes the keymap more intuitive and easier to memorize
    (`<C-w>` -> Close the focused window on most platforms)
* Makes `cmp.close` easier to type _(`w` is closer to `<CTRL>` than `e`)_

As this change does not conflict with `<C-w>` in normal mode, no
conflicting keymap was found for the time being.
  • Loading branch information
Jint-lzxy committed Mar 26, 2023
1 parent 441321b commit 109881e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dots.tutor
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The completion window will always show no matter what file you are editing.
You can use `<Tab>`{normal} and `<S-Tab>`{normal} to select next and previous candidate in
the completion window and use `<CR>`{normal} to confirm completion. You can also use
`<C-n>`{normal} and `<C-p>`{normal} and `<C-y>`{normal} to do it. Sometimes you don't want confirm
completion but just want to new a line, you can use `<C-e>`{normal} to close the
completion but just want to new a line, you can use `<C-w>`{normal} to close the
window manually.

There are more functions provided by lsp besides code completion.
Expand Down
2 changes: 1 addition & 1 deletion lua/modules/configs/completion/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ return function()
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.close(),
["<C-w>"] = cmp.mapping.close(),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
Expand Down

0 comments on commit 109881e

Please sign in to comment.