dotfiles/nvim/.config/nvim/lua/plug/_autopair.lua
Marty Oehme e64df2ec3d
nvim: Switch deprecated nvim-compe
Switched out the deprecated nvim-compe for nvim-cmp and re-added most of
the plugins that the earlier one supported.

The handling is very similar and it supports the same snippet engine
(vsnip in this case).
2021-12-15 17:42:23 +01:00

18 lines
701 B
Lua

require('nvim-autopairs').setup({check_ts = true})
--- Auto-space rules
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)
}
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on('confirm_done',
cmp_autopairs.on_confirm_done({map_char = {tex = ''}}))
-- add a lisp filetype (wrap my-function), FYI: Hardcoded = { "clojure", "clojurescript", "fennel", "janet" }
cmp_autopairs.lisp[#cmp_autopairs.lisp + 1] = "racket"