Skip to content

Commit 44bd1f0

Browse files
committed
refactor(nvim): explicitly define key mappings for surround
1 parent 09724d7 commit 44bd1f0

1 file changed

Lines changed: 23 additions & 10 deletions

File tree

  • home/dot_config/exact_nvim/exact_lua/exact_specs

home/dot_config/exact_nvim/exact_lua/exact_specs/surround.lua

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,28 @@ Plugin.version = '*'
55

66
Plugin.event = 'VeryLazy'
77

8-
Plugin.opts = {
9-
keymaps = {
10-
normal = 'sa',
11-
visual = 'sa',
12-
delete = 'sd',
13-
change = 'sr',
14-
insert = false,
15-
insert_line = false,
16-
},
17-
}
8+
Plugin.opts = {}
9+
10+
Plugin.init = function(_, opts)
11+
local surround = require('nvim-surround')
12+
13+
-- Disable default key mappings.
14+
vim.g.nvim_surround_no_normal_mappings = true
15+
16+
surround.setup(opts)
17+
18+
vim.keymap.set('n', 'sa', '<Plug>(nvim-surround-normal)', {
19+
desc = 'Add a surrounding pair around a motion',
20+
})
21+
vim.keymap.set('x', 'sa', '<Plug>(nvim-surround-visual)', {
22+
desc = 'Add a surrounding pair around a visual selection',
23+
})
24+
vim.keymap.set('n', 'sd', '<Plug>(nvim-surround-delete)', {
25+
desc = 'Delete a surrounding pair',
26+
})
27+
vim.keymap.set('n', 'sr', '<Plug>(nvim-surround-change)', {
28+
desc = 'Change a surrounding pair',
29+
})
30+
end
1831

1932
return Plugin

0 commit comments

Comments
 (0)