comparison dot_config/nvim/init.lua @ 447:aa15d8b06f04

Configure autopairs for cmp
author Zeger Van de Vannet <zegervdv@me.com>
date Thu, 02 Sep 2021 12:07:11 +0200
parents 9c575d146453
children d847c4df584b
comparison
equal deleted inserted replaced
446:9c575d146453 447:aa15d8b06f04
92 use { 92 use {
93 'windwp/nvim-autopairs', 93 'windwp/nvim-autopairs',
94 config = function() 94 config = function()
95 local npairs = require 'nvim-autopairs' 95 local npairs = require 'nvim-autopairs'
96 local Rule = require 'nvim-autopairs.rule' 96 local Rule = require 'nvim-autopairs.rule'
97
98 require("nvim-autopairs.completion.cmp").setup {
99 map_cr = true, -- map <CR> on insert mode
100 map_complete = true, -- it will auto insert `(` after select function or method item
101 auto_select = false, -- automatically select the first item
102 }
97 103
98 npairs.setup { 104 npairs.setup {
99 ignored_next_char = string.gsub([[ [%w%%%'%[%.] ]], '%s+', ''), 105 ignored_next_char = string.gsub([[ [%w%%%'%[%.] ]], '%s+', ''),
100 } 106 }
101 107
136 142
137 npairs.get_rule("'"):with_pair(function() 143 npairs.get_rule("'"):with_pair(function()
138 return vim.bo.filetype ~= 'systemverilog' 144 return vim.bo.filetype ~= 'systemverilog'
139 end) 145 end)
140 end, 146 end,
147 after = { 'nvim-cmp' }
141 } 148 }
142 149
143 -- Moving around within lines 150 -- Moving around within lines
144 use { 'wellle/targets.vim', event = 'InsertEnter *' } 151 use { 'wellle/targets.vim', event = 'InsertEnter *' }
145 152