# HG changeset patch # User Meredith Howard # Date 1691652757 18000 # Node ID fe77c5eed375e5e7d5f40efe5ea93fc5059006d2 # Parent 58490a30d6fbc981ed1ec348cbf45195e2b0ec36 Add autopairs with cr-only behavior, switch to treesitter-endwise diff --git a/.config/nvim/after/indent/ruby.vim b/.config/nvim/after/indent/ruby.vim --- a/.config/nvim/after/indent/ruby.vim +++ b/.config/nvim/after/indent/ruby.vim @@ -1,1 +1,2 @@ -setl indentkeys-=. +" Fix annoying outdent behaviors +setl indentkeys-=0{ indk-=. diff --git a/.config/nvim/lua/plugins/editing.lua b/.config/nvim/lua/plugins/editing.lua --- a/.config/nvim/lua/plugins/editing.lua +++ b/.config/nvim/lua/plugins/editing.lua @@ -42,7 +42,38 @@ return { "tpope/vim-unimpaired", "tomtom/tcomment_vim", - "tpope/vim-endwise", + + { + "windwp/nvim-autopairs", + event = { "InsertEnter" }, + config = function (_, _) + local npairs = require("nvim-autopairs") + npairs.setup({}) + local Rule = require("nvim-autopairs.rule") + + -- Only run autopairs for opening a multiline block + npairs.clear_rules() + for _,bracket in pairs { { '(', ')' }, { '[', ']' }, { '{', '}' } } do + npairs.add_rules { + Rule(bracket[1], bracket[2]) + :end_wise(function() return true end) + } + end + end, + }, + + -- "tpope/vim-endwise", + -- treesitter-endwise only applies if the parser is installed. do i want to + -- worry about a fallback? + { + "RRethy/nvim-treesitter-endwise", + config = function (_,_) + require("nvim-treesitter.configs").setup({ + endwise = { enable = true }, + }) + end, + }, + "godlygeek/tabular", { "mbbill/undotree", cmd = "UndotreeToggle" },