mirror of
https://github.com/ilyakooo0/nvim-autopairs.git
synced 2024-09-11 07:15:44 +03:00
Feat: Add the option mapping <C-h> to deleting a pair
This commit is contained in:
parent
04cd1779f8
commit
4406e94ba6
@ -21,6 +21,7 @@ local enable_afterquote = true -- add bracket pairs after quote
|
|||||||
local enable_check_bracket_line = true --- check bracket in same line
|
local enable_check_bracket_line = true --- check bracket in same line
|
||||||
local check_ts = false
|
local check_ts = false
|
||||||
local map_bs = true -- map the <BS> key
|
local map_bs = true -- map the <BS> key
|
||||||
|
local map_c_h = false -- Map the <C-h> key to delete a pair
|
||||||
local map_c_w = false -- map <c-w> to delete a pair if possible
|
local map_c_w = false -- map <c-w> to delete a pair if possible
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -13,6 +13,7 @@ M.state = {
|
|||||||
|
|
||||||
local default = {
|
local default = {
|
||||||
map_bs = true,
|
map_bs = true,
|
||||||
|
map_c_h = false,
|
||||||
map_c_w = false,
|
map_c_w = false,
|
||||||
map_cr = true,
|
map_cr = true,
|
||||||
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
|
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
|
||||||
@ -317,6 +318,17 @@ M.on_attach = function(bufnr)
|
|||||||
{ expr = true, noremap = true }
|
{ expr = true, noremap = true }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if M.config.map_c_h then
|
||||||
|
api.nvim_buf_set_keymap(
|
||||||
|
bufnr,
|
||||||
|
"i",
|
||||||
|
utils.key.c_h,
|
||||||
|
string.format("v:lua.MPairs.autopairs_c_h(%d)", bufnr),
|
||||||
|
{expr = true, noremap = true}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
if M.config.map_c_w then
|
if M.config.map_c_w then
|
||||||
api.nvim_buf_set_keymap(
|
api.nvim_buf_set_keymap(
|
||||||
bufnr,
|
bufnr,
|
||||||
@ -374,6 +386,10 @@ M.autopairs_c_w = function(bufnr)
|
|||||||
return autopairs_delete(bufnr, '<c-g>U<c-w>')
|
return autopairs_delete(bufnr, '<c-g>U<c-w>')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.autopairs_c_h = function(bufnr)
|
||||||
|
return autopairs_delete(bufnr, utils.key.c_h)
|
||||||
|
end
|
||||||
|
|
||||||
M.autopairs_bs = function(bufnr)
|
M.autopairs_bs = function(bufnr)
|
||||||
return autopairs_delete(bufnr, utils.key.bs)
|
return autopairs_delete(bufnr, utils.key.bs)
|
||||||
end
|
end
|
||||||
|
@ -5,6 +5,7 @@ local log = require('nvim-autopairs._log')
|
|||||||
M.key = {
|
M.key = {
|
||||||
del = "<del>",
|
del = "<del>",
|
||||||
bs = "<bs>",
|
bs = "<bs>",
|
||||||
|
c_h = "<C-h>",
|
||||||
left = "<left>",
|
left = "<left>",
|
||||||
right = "<right>",
|
right = "<right>",
|
||||||
join_left = "<c-g>U<left>",
|
join_left = "<c-g>U<left>",
|
||||||
|
@ -514,6 +514,15 @@ local data = {
|
|||||||
after = [[{{("It doesn't name %s", ''), 'ErrorMsg''|' }}, ]],
|
after = [[{{("It doesn't name %s", ''), 'ErrorMsg''|' }}, ]],
|
||||||
end_cursor = 41
|
end_cursor = 41
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
setup_func = function()
|
||||||
|
npairs.setup({map_c_h = true})
|
||||||
|
end,
|
||||||
|
name = "map <c-h>",
|
||||||
|
key = "<c-h>",
|
||||||
|
before = [[aa'|' ]],
|
||||||
|
after = [[aa| ]],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
setup_func = function()
|
setup_func = function()
|
||||||
npairs.setup({
|
npairs.setup({
|
||||||
|
Loading…
Reference in New Issue
Block a user