Skip to content

Commit

Permalink
fix(nvim): Fix <> autopairs for Rust generics
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Jun 17, 2024
1 parent 448c8a8 commit 0168bba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nvim/lua/my/configure/autopairs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ return {
local npairs = require('nvim-autopairs')
local cond = require('nvim-autopairs.conds')
npairs.setup({})
-- <> pair for generics and stuff
npairs.add_rule(Rule('<', '>'):with_pair(cond.before_regex('%a+')):with_move(function(opts)
-- <> pair for generics and stuff,
-- complete <> if the preceding text is alphanumeric or :: for Rust
npairs.add_rule(Rule('<', '>'):with_pair(cond.before_regex('%a+:?:?', 3)):with_move(function(opts)
return opts.char == '>'
end))
end,
Expand Down

0 comments on commit 0168bba

Please sign in to comment.