From 8aecc1b1a2b11065099060f6695682420ffaac1e Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 9 Feb 2024 01:40:58 +0300 Subject: nvim: switch to vim-snippets luasnip fork https://www.reddit.com/r/neovim/comments/18w0ule/luasnip_snippet_collection_from_vimsnippets/ --- .config/nvim/lazy-lock.json | 54 ++++++++++++++++++++-------------------- .config/nvim/lua/plugins/cmp.lua | 39 +++++++++++++++++++---------- .config/nvim/lua/plugins/lsp.lua | 3 --- 3 files changed, 53 insertions(+), 43 deletions(-) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 4cb8082..12bfba2 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,8 +1,8 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, - "barbar.nvim": { "branch": "master", "commit": "4ba9ac54f0c5d82131905160afff94172e3325e6" }, - "catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" }, + "barbar.nvim": { "branch": "master", "commit": "71ac376acd000743146b1e08e62151b4d887bbac" }, + "catppuccin": { "branch": "main", "commit": "c2034f7b549152e5cc757820426341ea5000bc7a" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, @@ -10,45 +10,45 @@ "cmp-omni": { "branch": "main", "commit": "4ef610bbd85a5ee4e97e09450c0daecbdc60de86" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" }, + "dashboard-nvim": { "branch": "master", "commit": "04a48b2e230bc5e50dd099d839443703023b0472" }, "dial.nvim": { "branch": "master", "commit": "27eb570085db2ef44bff4f620d3806039184651c" }, - "fidget.nvim": { "branch": "main", "commit": "a4a7edfea37e557dbff5509ee374ffb57051bba9" }, - "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" }, - "indent-blankline.nvim": { "branch": "master", "commit": "5da5546947f3125dfd6aa85ab21074dc83f776d5" }, - "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, - "leap.nvim": { "branch": "main", "commit": "2d6bb13978482e1220dd5903d8f72a75a0b6623b" }, - "ltex-extra.nvim": { "branch": "master", "commit": "9bed99b2b8488cc2daf66c76d2e0cf051ee80d13" }, - "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, - "neodev.nvim": { "branch": "main", "commit": "7cb4f7f29c6bf6f1d21a37f6dd6d12ba64266b09" }, - "nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" }, - "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, - "nvim-lspconfig": { "branch": "master", "commit": "9bedcfed749755e43fc8bed46f85ce2044fe3b77" }, + "fidget.nvim": { "branch": "main", "commit": "ad8873c16faa123fe3f9fd6539c41dfb0f97a9e9" }, + "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, + "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, + "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, + "leap.nvim": { "branch": "main", "commit": "46e9b1a1d7438ac72794b0857b20cad4390b827c" }, + "ltex-extra.nvim": { "branch": "master", "commit": "42dd3572cb09b52a137e91e515f2dff5eb631b1e" }, + "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, + "luasnip-snippets": { "branch": "main", "commit": "26eba1b626fea8747babead4c20ee164c3b10b03" }, + "neodev.nvim": { "branch": "main", "commit": "0ee95ecefc8ea45898a0383364f736e098c8703f" }, + "nvim-autopairs": { "branch": "master", "commit": "096d0baecc34f6c5d8a6dd25851e9d5ad338209b" }, + "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, + "nvim-lspconfig": { "branch": "master", "commit": "1bc83418927003552505ec66fa5d6cffae953f6a" }, "nvim-surround": { "branch": "main", "commit": "703ec63aa798e5e07d309b35e42def34bebe0174" }, - "nvim-tree.lua": { "branch": "master", "commit": "f1b3e6a7eb92da492bd693257367d9256839ed3d" }, - "nvim-treesitter": { "branch": "master", "commit": "e49f1e8ef3e8450a8446cb1f2bbb53c919f60b6d" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" }, - "nvim-ufo": { "branch": "main", "commit": "c6d88523f574024b788f1c3400c5d5b9bb1a0407" }, - "nvim-web-devicons": { "branch": "master", "commit": "cff25ce621e6d15fae0b0bfe38c00be50ce38468" }, - "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "nvim-tree.lua": { "branch": "master", "commit": "8cbb1db8e90b62fc56f379992e622e9f919792ce" }, + "nvim-treesitter": { "branch": "master", "commit": "cbf0dfd92f3149a378164ab781d0b0a13da5b04a" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "dd0b2036c3a27cb6e6486f8bd24188c6ca43af0b" }, + "nvim-ufo": { "branch": "main", "commit": "b0741a647efd98d9abb6cb653e056d24a07e4581" }, + "nvim-web-devicons": { "branch": "master", "commit": "313d9e7193354c5de7cdb1724f9e2d3f442780b0" }, + "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, "promise-async": { "branch": "main", "commit": "94f6f03c6c1e2aab551aacdf0c1e597a7269abb6" }, - "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, + "rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" }, "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, "targets.vim": { "branch": "master", "commit": "642d3a4ce306264b05ea3219920b13ea80931767" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "master", "commit": "3466159b0fcc1876483f6f53587562628664d850" }, + "telescope.nvim": { "branch": "master", "commit": "236083884cfe6c874e03e6cb4e7cb08809c1333c" }, "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, "turkish-deasciifier.vim": { "branch": "master", "commit": "5b3a0bfef7424d218df7ab3dac8ee9dab42a105e" }, "vim-characterize": { "branch": "master", "commit": "7fc5b75e7a9e46676cf736b56d99dd32004ff3d6" }, "vim-cutlass": { "branch": "master", "commit": "7afd649415541634c8ce317fafbc31cd19d57589" }, - "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }, - "vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" }, + "vim-fugitive": { "branch": "master", "commit": "fab00f7c0f3a08e860e39c7adeb8fbe849921a98" }, + "vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" }, "vim-move": { "branch": "master", "commit": "3c4195de0748da9bba25c54d78d959d349e93c55" }, "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, - "vim-snippets": { "branch": "master", "commit": "ba72b08e04e184ecd0a2a1b8012a81ddb040dbc3" }, "vim-unimpaired": { "branch": "master", "commit": "6d44a6dc2ec34607c41ec78acf81657248580bf1" }, - "vimtex": { "branch": "master", "commit": "930804866f1fecd0b337c0f3e7333c6dd46ba149" }, + "vimtex": { "branch": "master", "commit": "cb0fd1b437a6b3797ed4dfd01a0aa0ae97b23871" }, "vimwiki": { "branch": "dev", "commit": "5f0a6c7523df3a15cc0331dc050a680ee4ddff04" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, - "yanky.nvim": { "branch": "main", "commit": "6bb9ffd3cad4c9876bda54e19d0659de28a4f84f" } + "yanky.nvim": { "branch": "main", "commit": "7c5cbf0122ff2dfbb6a92f14885894f65949cc8b" } } \ No newline at end of file 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 { "hrsh7th/cmp-nvim-lsp-signature-help", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip", - "honza/vim-snippets", }, config = function() local cmp = require("cmp") @@ -141,28 +140,42 @@ return { }) end, }, + { + 'mireq/luasnip-snippets', + dependencies = {'L3MON4D3/LuaSnip'}, + init = function() + require('luasnip_snippets.common.snip_utils').setup() + end + + }, { "L3MON4D3/LuaSnip", version = "v2.*", dependencies = { - "honza/vim-snippets", + 'nvim-treesitter/nvim-treesitter', }, build = "make install_jsregexp", - keys = { - { - "", - function() require("luasnip").expand_or_jump() end, - mode = { "i", "s" }, - }, - }, opts = { history = false, region_check_events = 'InsertEnter', delete_check_events = 'InsertLeave', }, - config = function(_, opts) - require("luasnip").setup(opts) - require("luasnip.loaders.from_snipmate").lazy_load() - end, + init = function() + local ls = require('luasnip') + ls.setup({ + -- Required to automatically include base snippets, like "c" snippets for "cpp" + load_ft_func = require('luasnip_snippets.common.snip_utils').load_ft_func, + ft_func = require('luasnip_snippets.common.snip_utils').ft_func, + -- To enable auto expansin + enable_autosnippets = true, + -- Uncomment to enable visual snippets triggered using + -- store_selection_keys = '', + }) + -- LuaSnip key bindings + vim.keymap.set({"i", "s"}, "", function() if ls.expand_or_jumpable() then ls.expand_or_jump() else vim.api.nvim_input('') end end, {silent = true}) + vim.keymap.set({"i", "s"}, "", function() ls.jump(-1) end, {silent = true}) + vim.keymap.set({"i", "s"}, "", function() if ls.choice_active() then ls.change_choice(1) end end, {silent = true}) + end + }, } 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 { local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) - -- pkgbuild - require("lspconfig").pkgbuild_language_server.setup({}) - -- lua require("lspconfig")["lua_ls"].setup({ on_attach = on_attach, -- cgit v1.2.3-70-g09d2