windwp / nvim-ts-autotag

Use treesitter to auto close and auto rename html tag
MIT License
1.63k stars 87 forks source link

[question] how to add custom mapping #27

Closed alexzanderr closed 2 years ago

alexzanderr commented 2 years ago

i saw that there is an map_c_w = true, its work fine for c-w.

but i want to map the auto delete double brackets for control+backspace

mine is mapped like this:

-- insert mode
inoremap("<c-bs>", "<c-w>")
inoremap("<c-h>", "<c-w>")

-- normal mode
nnoremap("<c-bs>", "i<c-w>")
nnoremap("<c-h>", "i<c-w>")

-- command mode
vim.cmd [[
noremap! <C-BS> <C-w>
noremap! <C-h> <C-w>
]]

these mappings work. for backwards delete. but i cant delete double brackets.

how do i create a custom rule to delete brackets with control+backspace

before            insert                         after
func(|)           ctrl+backspace        func

should i do a recursive map? is is possible with custom rule?

alexzanderr commented 2 years ago

ups. wrong repo. i was supposed to be fore auto pairs