From 36763ac5f6a2b799536596e6011d2604a234681c Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Wed, 4 Oct 2023 05:44:45 +0200 Subject: [PATCH] feat(nvim): snippet config --- nvimrc | 2 ++ vim/lua/nvim_cmp_config.lua | 1 - vim/lua/snippet_config.lua | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 vim/lua/snippet_config.lua diff --git a/nvimrc b/nvimrc index ccdde5e..3c46f0e 100644 --- a/nvimrc +++ b/nvimrc @@ -300,6 +300,7 @@ lua require "copilot_config" packadd! nvim-cmp " https://github.com/hrsh7th/nvim-cmp.git packadd! copilot-cmp " https://github.com/zbirenbaum/copilot-cmp.git packadd! vim-vsnip " https://github.com/hrsh7th/vim-vsnip.git +packadd! vim-vsnip-integ " https://github.com/hrsh7th/vim-vsnip-integ.git packadd! cmp-vsnip " https://github.com/hrsh7th/cmp-vsnip.git packadd! cmp-nvim-lsp " https://github.com/hrsh7th/cmp-nvim-lsp.git packadd! cmp-buffer " https://github.com/hrsh7th/cmp-buffer.git @@ -307,6 +308,7 @@ packadd! cmp-path " https://github.com/hrsh7th/cmp-path.git packadd! cmp-calc " https://github.com/hrsh7th/cmp-calc lua require "nvim_cmp_config" +lua require "snippet_config" " LSP: packadd! nvim-lspconfig " https://github.com/neovim/nvim-lspconfig.git diff --git a/vim/lua/nvim_cmp_config.lua b/vim/lua/nvim_cmp_config.lua index 4ebc000..ce63a8d 100644 --- a/vim/lua/nvim_cmp_config.lua +++ b/vim/lua/nvim_cmp_config.lua @@ -1,5 +1,4 @@ local cmp = require("cmp") --- local cmp_buffer = require("cmp_buffer") -- https://github.com/zbirenbaum/copilot-cmp#tab-completion-configuration-highly-recommended local has_words_before = function() diff --git a/vim/lua/snippet_config.lua b/vim/lua/snippet_config.lua new file mode 100644 index 0000000..5eb8bb7 --- /dev/null +++ b/vim/lua/snippet_config.lua @@ -0,0 +1,4 @@ +vim.api.nvim_set_keymap("i", "", [[vsnip#jumpable(1) ? '(vsnip-jump-next)' : '']], { expr = true }) +vim.api.nvim_set_keymap("s", "", [[vsnip#jumpable(1) ? '(vsnip-jump-next)' : '']], { expr = true }) +vim.api.nvim_set_keymap("i", "", [[vsnip#jumpable(1) ? '(vsnip-jump-prev)' : '']], { expr = true }) +vim.api.nvim_set_keymap("s", "", [[vsnip#jumpable(1) ? '(vsnip-jump-prev)' : '']], { expr = true })