diff options
author | Yigit Sever | 2024-02-09 01:40:58 +0300 |
---|---|---|
committer | Yigit Sever | 2024-02-09 01:40:58 +0300 |
commit | 8aecc1b1a2b11065099060f6695682420ffaac1e (patch) | |
tree | d216da280a786ff20c96b69a8d81c682aa2097df /.config/nvim/lua | |
parent | c818bf2a6758580063aecf97860bdb1d02789d60 (diff) | |
download | dotfiles-8aecc1b1a2b11065099060f6695682420ffaac1e.tar.gz dotfiles-8aecc1b1a2b11065099060f6695682420ffaac1e.tar.bz2 dotfiles-8aecc1b1a2b11065099060f6695682420ffaac1e.zip |
nvim: switch to vim-snippets luasnip fork
https://www.reddit.com/r/neovim/comments/18w0ule/luasnip_snippet_collection_from_vimsnippets/
Diffstat (limited to '.config/nvim/lua')
-rw-r--r-- | .config/nvim/lua/plugins/cmp.lua | 39 | ||||
-rw-r--r-- | .config/nvim/lua/plugins/lsp.lua | 3 |
2 files changed, 26 insertions, 16 deletions
diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua index 6a93009..2e8fade 100644 --- a/.config/nvim/lua/plugins/cmp.lua +++ b/.config/nvim/lua/plugins/cmp.lua | |||
@@ -10,7 +10,6 @@ return { | |||
10 | "hrsh7th/cmp-nvim-lsp-signature-help", | 10 | "hrsh7th/cmp-nvim-lsp-signature-help", |
11 | "L3MON4D3/LuaSnip", | 11 | "L3MON4D3/LuaSnip", |
12 | "saadparwaiz1/cmp_luasnip", | 12 | "saadparwaiz1/cmp_luasnip", |
13 | "honza/vim-snippets", | ||
14 | }, | 13 | }, |
15 | config = function() | 14 | config = function() |
16 | local cmp = require("cmp") | 15 | local cmp = require("cmp") |
@@ -142,27 +141,41 @@ return { | |||
142 | end, | 141 | end, |
143 | }, | 142 | }, |
144 | { | 143 | { |
144 | 'mireq/luasnip-snippets', | ||
145 | dependencies = {'L3MON4D3/LuaSnip'}, | ||
146 | init = function() | ||
147 | require('luasnip_snippets.common.snip_utils').setup() | ||
148 | end | ||
149 | |||
150 | }, | ||
151 | { | ||
145 | "L3MON4D3/LuaSnip", | 152 | "L3MON4D3/LuaSnip", |
146 | version = "v2.*", | 153 | version = "v2.*", |
147 | dependencies = { | 154 | dependencies = { |
148 | "honza/vim-snippets", | 155 | 'nvim-treesitter/nvim-treesitter', |
149 | }, | 156 | }, |
150 | build = "make install_jsregexp", | 157 | build = "make install_jsregexp", |
151 | keys = { | ||
152 | { | ||
153 | "<C-l>", | ||
154 | function() require("luasnip").expand_or_jump() end, | ||
155 | mode = { "i", "s" }, | ||
156 | }, | ||
157 | }, | ||
158 | opts = { | 158 | opts = { |
159 | history = false, | 159 | history = false, |
160 | region_check_events = 'InsertEnter', | 160 | region_check_events = 'InsertEnter', |
161 | delete_check_events = 'InsertLeave', | 161 | delete_check_events = 'InsertLeave', |
162 | }, | 162 | }, |
163 | config = function(_, opts) | 163 | init = function() |
164 | require("luasnip").setup(opts) | 164 | local ls = require('luasnip') |
165 | require("luasnip.loaders.from_snipmate").lazy_load() | 165 | ls.setup({ |
166 | end, | 166 | -- Required to automatically include base snippets, like "c" snippets for "cpp" |
167 | load_ft_func = require('luasnip_snippets.common.snip_utils').load_ft_func, | ||
168 | ft_func = require('luasnip_snippets.common.snip_utils').ft_func, | ||
169 | -- To enable auto expansin | ||
170 | enable_autosnippets = true, | ||
171 | -- Uncomment to enable visual snippets triggered using <c-x> | ||
172 | -- store_selection_keys = '<c-x>', | ||
173 | }) | ||
174 | -- LuaSnip key bindings | ||
175 | vim.keymap.set({"i", "s"}, "<C-l>", function() if ls.expand_or_jumpable() then ls.expand_or_jump() else vim.api.nvim_input('<C-l>') end end, {silent = true}) | ||
176 | vim.keymap.set({"i", "s"}, "<C-k>", function() ls.jump(-1) end, {silent = true}) | ||
177 | vim.keymap.set({"i", "s"}, "<C-E>", function() if ls.choice_active() then ls.change_choice(1) end end, {silent = true}) | ||
178 | end | ||
179 | |||
167 | }, | 180 | }, |
168 | } | 181 | } |
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 95f09f1..029a0f1 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua | |||
@@ -72,9 +72,6 @@ return { | |||
72 | local capabilities = vim.lsp.protocol.make_client_capabilities() | 72 | local capabilities = vim.lsp.protocol.make_client_capabilities() |
73 | capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) | 73 | capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) |
74 | 74 | ||
75 | -- pkgbuild | ||
76 | require("lspconfig").pkgbuild_language_server.setup({}) | ||
77 | |||
78 | -- lua | 75 | -- lua |
79 | require("lspconfig")["lua_ls"].setup({ | 76 | require("lspconfig")["lua_ls"].setup({ |
80 | on_attach = on_attach, | 77 | on_attach = on_attach, |