From 4978fa3cec4db2f06cb938ba14d62091e1a6d7aa Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 6 Jul 2021 10:23:12 -0400 Subject: [PATCH] refact: move expr to a lua table for compe mappings --- lua/doom/core/keybindings/init.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lua/doom/core/keybindings/init.lua b/lua/doom/core/keybindings/init.lua index 565e673..a2198eb 100644 --- a/lua/doom/core/keybindings/init.lua +++ b/lua/doom/core/keybindings/init.lua @@ -46,15 +46,16 @@ utils.map('n', '', ':WhichKey ', opts) ---[[-----------------]]--- -- LSP Keybindings -- ---]]-----------------[[--- --- If the LSP group is not disabled or the nvim-compe plugin is not disabled --- then set its mappings. +-- If the LSP is not disabled and compe is installed then set its mappings. if functions.check_plugin('nvim-compe', 'opt') then + local compe_opts = vim.tbl_extend('force', opts, { expr = true }) + -- https://github.com/hrsh7th/nvim-compe#mappings - utils.map('i', ' ', 'compe#complete()', opts) - utils.map('i', ' ', 'compe#confirm("")', opts) - utils.map('i', ' ', 'compe#close("")', opts) - utils.map('i', ' ', 'compe#scroll({ "delta": +4 })', opts) - utils.map('i', ' ', 'compe#scroll({ "delta": -4 })', opts) + utils.map('i', '', 'compe#complete()', compe_opts) + utils.map('i', '', 'compe#confirm("")', compe_opts) + utils.map('i', '', 'compe#close("")', compe_opts) + utils.map('i', '', 'compe#scroll({ "delta": +4 })', compe_opts) + utils.map('i', '', 'compe#scroll({ "delta": -4 })', compe_opts) utils.map('n', 'gd', ':lua vim.lsp.buf.definition()', opts) -- gd: jump to definition utils.map('n', 'gr', ':lua vim.lsp.buf.references()', opts) -- gr: go to reference utils.map('n', 'gi', ':lua vim.lsp.buf.implementation()', opts) -- gi: buf implementation