Skip to content
Smitesh Patil edited this page May 21, 2021 · 29 revisions

This page contains custom rules, that can be added to your neovim config using add_rules method.

Add spaces between parentheses

Before Insert After
(|) ( |) ( | )
local npairs = require'nvim-autopairs'
local Rule   = require'nvim-autopairs.rule'

npairs.add_rules {
  Rule(' ', ' ')
    :with_pair(function (opts)
      local pair = opts.line:sub(opts.col, opts.col + 1)
      return vim.tbl_contains({ '()', '[]', '{}' }, pair)
    end)
}
Clone this wiki locally