diff --git a/lua/nvim-compe/lua.lua b/lua/nvim-compe/lua.lua index 743bc32..79bdc8a 100644 --- a/lua/nvim-compe/lua.lua +++ b/lua/nvim-compe/lua.lua @@ -43,7 +43,20 @@ _G.s_tab_complete = function() end end --- mappings +-- mappings + vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", {expr = true}) vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", {expr = true}) + +function _G.completions() + local npairs = require("nvim-autopairs") + if vim.fn.pumvisible() == 1 then + if vim.fn.complete_info()["selected"] ~= -1 then + return vim.fn["compe#confirm"]("") + end + end + return npairs.check_break_line_char() +end + +vim.api.nvim_set_keymap("i", "", "v:lua.completions()", {expr = true})