From 7a4cdd69229929ef059bfe6e15d69f752703889a Mon Sep 17 00:00:00 2001 From: juan Date: Sun, 26 Sep 2021 11:35:15 +0800 Subject: [PATCH] sign with gpg and update autopairs things. --- lua/plugins/nvim-autopairs.lua | 52 ++++++++++++++-------------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/lua/plugins/nvim-autopairs.lua b/lua/plugins/nvim-autopairs.lua index f74aeb5..3bfae94 100644 --- a/lua/plugins/nvim-autopairs.lua +++ b/lua/plugins/nvim-autopairs.lua @@ -1,47 +1,37 @@ local remap = vim.api.nvim_set_keymap local npairs = require('nvim-autopairs') -npairs.setup({map_bs = false}) +npairs.setup({ map_bs = false }) -vim.g.coq_settings = { - auto_start = true, - clients = {tabnine = {enabled = true}}, - keymap = {recommended = false} -} +vim.g.coq_settings = { keymap = { recommended = false } } -- these mappings are coq recommended mappings unrelated to nvim-autopairs -remap('i', '', [[pumvisible() ? "" : ""]], - {expr = true, noremap = true}) -remap('i', '', [[pumvisible() ? "" : ""]], - {expr = true, noremap = true}) -remap('i', '', [[pumvisible() ? "" : ""]], - {expr = true, noremap = true}) -remap('i', '', [[pumvisible() ? "" : ""]], - {expr = true, noremap = true}) +remap('i', '', [[pumvisible() ? "" : ""]], { expr = true, noremap = true }) +remap('i', '', [[pumvisible() ? "" : ""]], { expr = true, noremap = true }) +remap('i', '', [[pumvisible() ? "" : ""]], { expr = true, noremap = true }) +remap('i', '', [[pumvisible() ? "" : ""]], { expr = true, noremap = true }) -- skip it, if you use another global object -_G.MUtils = {} +_G.MUtils= {} MUtils.CR = function() - if vim.fn.pumvisible() ~= 0 then - if vim.fn.complete_info({'selected'}).selected ~= -1 then - return npairs.esc('') - else - -- you can change to if you don't use other i_CTRL-X modes - return npairs.esc('') .. npairs.autopairs_cr() - end + if vim.fn.pumvisible() ~= 0 then + if vim.fn.complete_info({ 'selected' }).selected ~= -1 then + return npairs.esc('') else - return npairs.autopairs_cr() + return npairs.esc('') .. npairs.autopairs_cr() end + else + return npairs.autopairs_cr() + end end -remap('i', '', 'v:lua.MUtils.CR()', {expr = true, noremap = true}) +remap('i', '', 'v:lua.MUtils.CR()', { expr = true, noremap = true }) MUtils.BS = function() - if vim.fn.pumvisible() ~= 0 and vim.fn.complete_info({'mode'}).mode == - 'eval' then - return npairs.esc('') .. npairs.autopairs_bs() - else - return npairs.autopairs_bs() - end + if vim.fn.pumvisible() ~= 0 and vim.fn.complete_info({ 'mode' }).mode == 'eval' then + return npairs.esc('') .. npairs.autopairs_bs() + else + return npairs.autopairs_bs() + end end -remap('i', '', 'v:lua.MUtils.BS()', {expr = true, noremap = true}) +remap('i', '', 'v:lua.MUtils.BS()', { expr = true, noremap = true })