From 5b27863d0345318bf1703ebc58389994e6fa15a2 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sat, 20 Nov 2021 16:02:59 +0100 Subject: [PATCH] [nvim] feat: add lua maps + cmp hierarchy --- .config/nvim/lua/maps.lua | 8 ++++++++ .config/nvim/lua/plugin/cmp.lua | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.config/nvim/lua/maps.lua b/.config/nvim/lua/maps.lua index 0764807..69a36c5 100644 --- a/.config/nvim/lua/maps.lua +++ b/.config/nvim/lua/maps.lua @@ -26,3 +26,11 @@ utils.map("n", "tl", "Telescope live_grep") -- colorscheme utils.map("n", "", "lua require(\"astronomy\").toggle_variant()") + +-- snippets +utils.map("i", "", "v:lua.tab_complete()", {expr = true}) +utils.map("s", "", "v:lua.tab_complete()", {expr = true}) +utils.map("i", "", "v:lua.s_tab_complete()", {expr = true}) +utils.map("s", "", "v:lua.s_tab_complete()", {expr = true}) +utils.map("i", "", "luasnip-next-choice", {}) +utils.map("s", "", "luasnip-next-choice", {}) diff --git a/.config/nvim/lua/plugin/cmp.lua b/.config/nvim/lua/plugin/cmp.lua index c620fec..1a98ad7 100644 --- a/.config/nvim/lua/plugin/cmp.lua +++ b/.config/nvim/lua/plugin/cmp.lua @@ -27,18 +27,20 @@ cmp.setup { }, sources = { { name = "path" }, - { name = "buffer" }, + { name = "luasnip" }, { name = "nvim_lsp" }, + { name = "buffer" }, { name = "nvim_lua" }, - { name = "treesitter" }, { name = "calc" }, { name = "spell" }, + { name = "treesitter" }, }, formatting = { format = function(entry, vim_item) vim_item.menu = ({ nvim_lsp = "[lsp]", nvim_lua = "[nvim]", + luasnip = "[snip]", path = "[path]", buffer = "[buff]", calc = "[calc]",