Skip to content

Commit

Permalink
fix(nvim): Don't complete pairs if the matching character is already …
Browse files Browse the repository at this point in the history
…present in the next position
  • Loading branch information
mrjones2014 committed Sep 8, 2023
1 parent 5ad0440 commit b0d1ca1
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion nvim/lua/my/configure/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,26 @@ return {
{ 'tpope/vim-sleuth', event = 'BufReadPre' },
{ 'mrjones2014/iconpicker.nvim' },
{ 'mrjones2014/lua-gf.nvim', dev = true, ft = 'lua' },
{ 'echasnovski/mini.pairs', event = 'InsertEnter', opts = {} },
{
'echasnovski/mini.pairs',
event = 'InsertEnter',
opts = {
mappings = {
-- source: https://old.reddit.com/r/neovim/comments/163rzex/how_to_avoid_autocompleting_right_parentheses/jy4zwp8/
-- disable if a matching character is in an adjacent position (eg. fixes
-- markdown triple ticks) neigh_pattern: a pattern for *two* neighboring
-- characters (before and after). Use dot `.` to allow any character.
-- Here, we disable the functionality instead of inserting a matching quote
-- if there is an adjacent non-space character
['`'] = { action = 'closeopen', pair = '``', neigh_pattern = '[^%S][^%S]', register = { cr = false } },
['"'] = { action = 'closeopen', pair = '""', neigh_pattern = '[^%S][^%S]', register = { cr = false } },
["'"] = { action = 'closeopen', pair = "''", neigh_pattern = '[^%S][^%S]', register = { cr = false } },
['['] = { action = 'closeopen', pair = '[]', neigh_pattern = '[^%S][^%S]', register = { cr = false } },
['{'] = { action = 'closeopen', pair = '{}', neigh_pattern = '[^%S][^%S]', register = { cr = false } },
['('] = { action = 'closeopen', pair = '()', neigh_pattern = '[^%S][^%S]', register = { cr = false } },
},
},
},
{ 'echasnovski/mini.trailspace', event = 'BufRead', opts = {} },
{ 'max397574/better-escape.nvim', event = 'InsertEnter', opts = {} },
{
Expand Down

0 comments on commit b0d1ca1

Please sign in to comment.