ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.91k stars 458 forks source link

In Inerst mode use <C-BS> mapping <C-w> not work #1167

Closed ycpss91255 closed 7 months ago

ycpss91255 commented 7 months ago

Version confirmation

Following prerequisites

Neovim version

NVIM v0.9.4

Branch info

main (Default/Latest)

Minimal (user) folder structure required to reproduce the issue

lua/user/keymap/core.lua

Minimal config with steps on how to reproduce the issue

This is my config('core.lua'):

return {
    ["i|<C-BS>"] = map_cmd("<C-w>"):with_noremap():with_desc(""),
    ["i|<C-H>"] = map_cmd("<C-w>"):with_noremap():with_desc(""),
}

Expected behavior

Equivalent to in insert mode. I can use nvim command mode and enter :imoremap <C-H> <C-w> and it will be successful.

Additional information

No response

ayamir commented 7 months ago

Hi, it's because the imap of <C-h> is overrided to empty keymap by autoclose.nvim (check this by verbose imap <C-H>). image If you remap imap <C-H> <C-W> after this plugin loaded, it will works normally. (PS: <C-BS> is the same with <C-H>, just set <C-H> then the both work well.) Workaround: modify lua/user/event.lua

local definitions = {
    -- Example
    bufs = {
        { "BufWritePre", "COMMIT_EDITMSG", "setlocal noundofile" },
    },
    inserts = {
        { "InsertEnter", "*", "imap <C-H> <C-w>" },
    },
}

return definitions
ycpss91255 commented 7 months ago

Thank you for your reply, but I want to ask, using inoremap does not work properly, how to modify it? lua/user/enent.lua

local definitions = {
    -- Example
    bufs = {
        { "BufWritePre", "COMMIT_EDITMSG", "setlocal noundofile" },
    },
    inserts = {
        { "InsertEnter", "*", "inoremap <C-H> <C-w>" },
    },
}

return definitions
ayamir commented 7 months ago

inoremap works for me too.

ycpss91255 commented 7 months ago

Suddenly I cam do it too, thank you