only do autopairs bracket endwise at end of line

Sun, 31 Dec 2023 04:23:36 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 31 Dec 2023 04:23:36 -0500
changeset 1141
00240c15eca5
parent 1140
40b6fc3abd44
child 1142
dd4f69be5e32

only do autopairs bracket endwise at end of line

.config/nvim/lua/plugins/editing.lua file | annotate | diff | comparison | revisions
--- a/.config/nvim/lua/plugins/editing.lua
+++ b/.config/nvim/lua/plugins/editing.lua
@@ -56,7 +56,9 @@ return {
       for _,bracket in pairs { { '(', ')' }, { '[', ']' }, { '{', '}' } } do
         npairs.add_rules {
           Rule(bracket[1], bracket[2])
-            :end_wise(function() return true end)
+            :end_wise(function(opts)
+              return opts.next_char == ''
+            end)
         }
       end
     end,

mercurial