From 2b6ae8473e1b0fb8cc0bd16aa8c485a77ee5e847 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Tue, 16 Mar 2021 21:54:42 +0100 Subject: renaming, treesitter buggy --- .config/nvim/lua/_autopairs/init.lua | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .config/nvim/lua/_autopairs/init.lua (limited to '.config/nvim/lua/_autopairs') diff --git a/.config/nvim/lua/_autopairs/init.lua b/.config/nvim/lua/_autopairs/init.lua new file mode 100644 index 0000000..6810a77 --- /dev/null +++ b/.config/nvim/lua/_autopairs/init.lua @@ -0,0 +1,40 @@ +require('nvim-autopairs').setup() + +local pairs_map = { + ["'"] = "'", + ['"'] = '"', + ['('] = ')', + ['['] = ']', + ['{'] = '}', + ['`'] = '`', +} +local disable_filetype = { "TelescopePrompt" } +local break_line_filetype = nil -- mean all file type +local html_break_line_filetype = {'html' , 'vue' , 'typescriptreact' , 'svelte' , 'javascriptreact'} +local ignored_next_char = "%w" + +local remap = vim.api.nvim_set_keymap +local npairs = require('nvim-autopairs') + +-- skip it, if you use another global object +_G.MUtils= {} + +vim.g.completion_confirm_key = "" +MUtils.completion_confirm=function() + if vim.fn.pumvisible() ~= 0 then + if vim.fn.complete_info()["selected"] ~= -1 then + vim.fn["compe#confirm"]() + return npairs.esc("") + else + vim.defer_fn(function() + vim.fn["compe#confirm"]("") + end, 20) + return npairs.esc("") + end + else + return npairs.check_break_line_char() + end +end + + +remap('i' , '','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true}) -- cgit v1.2.3-70-g09d2