diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index c52e64a..14ad6c3 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,11 +1,7 @@ { "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, - "catppuccin": { "branch": "main", "commit": "c9e205fe035d622b3c2d66ee42edf368c0c31fd5" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, - "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "blink.cmp": { "branch": "main", "commit": "ca05bb33eb071d916d33af08cae8034c3d8002b5" }, + "catppuccin": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" }, "conform.nvim": { "branch": "master", "commit": "6239d9986f51ca93ded99ecdb1af0e287eabb651" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "emmet-vim": { "branch": "master", "commit": "6c511a8d7d2863066f32e25543e2bb99d505172c" }, @@ -19,7 +15,6 @@ "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "nvim-ansible": { "branch": "main", "commit": "44dabdaa8a9193b7f564a8408ed6d7107705030a" }, "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, - "nvim-cmp": { "branch": "main", "commit": "3403e2e9391ed0a28c3afddd8612701b647c8e26" }, "nvim-highlight-colors": { "branch": "main", "commit": "e967e2ba13fd4ca731b41d0e5cc1ac2edcd6e25e" }, "nvim-lspconfig": { "branch": "master", "commit": "9f2c279cf9abe584f03bfeb37c6658d68e3ff49d" }, "nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" }, @@ -31,7 +26,7 @@ "rest.nvim": { "branch": "main", "commit": "e82dc524894b1b55bcc3296d3644f15c9e06d5ad" }, "typescript-tools.nvim": { "branch": "master", "commit": "f8c2e0b36b651c85f52ad5c5373ff8b07adc15a7" }, "vim-dadbod": { "branch": "master", "commit": "f740950d0703099e0f172016f10e0e39f50fd0ba" }, - "vim-dadbod-completion": { "branch": "master", "commit": "04485bfb53a629423233a4178d71cd4f8abf7406" }, + "vim-dadbod-completion": { "branch": "master", "commit": "9e354e86fcc67a5ec2c104f312e374ea2f89c799" }, "vim-dadbod-ssh": { "branch": "master", "commit": "9bce775ee76c3dd6d7508dcd9eb276b36133d710" }, "vim-dadbod-ui": { "branch": "master", "commit": "0fec59e3e1e619e302198cd491b7d27f8d398b7c" }, "vim-fugitive": { "branch": "master", "commit": "fcb4db52e7f65b95705aa58f0f2df1312c1f2df2" }, diff --git a/.config/nvim/lua/plugins/autopairs.lua b/.config/nvim/lua/plugins/autopairs.lua index 28d3d5d..bfa4ac4 100644 --- a/.config/nvim/lua/plugins/autopairs.lua +++ b/.config/nvim/lua/plugins/autopairs.lua @@ -1,10 +1,5 @@ return { "windwp/nvim-autopairs", event = "InsertEnter", - config = function() - require("nvim-autopairs").setup() - local cmp = require("cmp") - local cmp_autopairs = require("nvim-autopairs.completion.cmp") - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) - end, + opts = {}, } diff --git a/.config/nvim/lua/plugins/blink.lua b/.config/nvim/lua/plugins/blink.lua new file mode 100644 index 0000000..03ae690 --- /dev/null +++ b/.config/nvim/lua/plugins/blink.lua @@ -0,0 +1,56 @@ +return { + "saghen/blink.cmp", + event = "InsertEnter", + version = "*", + dependencies = { + { + "kristijanhusak/vim-dadbod-completion", + "rafamadriz/friendly-snippets", + { + "L3MON4D3/LuaSnip", + version = "*", + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").lazy_load({ paths = "./snippets" }) + end, + }, + }, + }, + opts = { + keymap = { preset = "enter" }, + snippets = { + expand = function(snippet) + require("luasnip").lsp_expand(snippet) + end, + active = function(filter) + if filter and filter.direction then + return require("luasnip").jumpable(filter.direction) + end + return require("luasnip").in_snippet() + end, + jump = function(direction) + require("luasnip").jump(direction) + end, + }, + sources = { + default = { "lsp", "path", "snippets", "buffer", "luasnip" }, + per_filetype = { + sql = { "dadbod" }, + }, + providers = { + dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" }, + }, + cmdline = {}, + }, + completion = { + documentation = { + auto_show = true, + auto_show_delay_ms = 0, + }, + ghost_text = { + enabled = true, + }, + }, + signature = { enabled = true }, + }, +} diff --git a/.config/nvim/lua/plugins/catppuccin.lua b/.config/nvim/lua/plugins/catppuccin.lua index 8a321cb..2466c01 100644 --- a/.config/nvim/lua/plugins/catppuccin.lua +++ b/.config/nvim/lua/plugins/catppuccin.lua @@ -1,7 +1,6 @@ return { "catppuccin/nvim", name = "catppuccin", - version = "*", lazy = false, priority = 1000, config = function() @@ -9,7 +8,8 @@ return { flavour = "frappe", integrations = { treesitter = true, - cmp = true, + cmp = false, + blink_cmp = true, gitsigns = true, telescope = false, dashboard = false, diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua deleted file mode 100644 index 7e17527..0000000 --- a/.config/nvim/lua/plugins/cmp.lua +++ /dev/null @@ -1,119 +0,0 @@ -local global = require("global") - -local M = { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-path" }, - { "saadparwaiz1/cmp_luasnip" }, - { "hrsh7th/cmp-buffer" }, - { "kristijanhusak/vim-dadbod-completion" }, - { "hrsh7th/cmp-nvim-lsp-signature-help" }, - }, -} - -function M.config() - local cmp = require("cmp") - local luasnip = require("luasnip") - - local cmp_kinds = { - Text = "", - Method = "", - Function = "", - Constructor = "", - Field = "", - Variable = "", - Class = "", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = " ", - Operator = "", - TypeParameter = "", - } - - local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - - cmp.setup({ - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "path" }, - { name = "vim-dadbod-completion" }, - { name = "orgmode" }, - { name = "nvim_lsp_signature_help" }, - { name = "buffer" }, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), - }), - formatting = { - format = function(_, vim_item) - if global.is_unix then - vim_item.kind = (cmp_kinds[vim_item.kind] or "") - end - return vim_item - end, - }, - sorting = { - comparators = { - cmp.config.compare.offset, - cmp.config.compare.exact, - cmp.config.compare.score, - cmp.config.compare.recently_used, - cmp.config.compare.kind, - }, - }, - }) -end - -return M diff --git a/.config/nvim/lua/plugins/lsp/init.lua b/.config/nvim/lua/plugins/lsp/init.lua index c027c8f..3705cad 100644 --- a/.config/nvim/lua/plugins/lsp/init.lua +++ b/.config/nvim/lua/plugins/lsp/init.lua @@ -1,6 +1,5 @@ local global = require("global") local keymaps = require("plugins.lsp.keymaps") -local capabilities = require("cmp_nvim_lsp").default_capabilities() return { { @@ -10,6 +9,7 @@ return { local servers = require("plugins.lsp.setup") for server, opts in pairs(servers) do + local capabilities = require("blink.cmp").get_lsp_capabilities(opts.capabilities) opts.capabilities = capabilities opts.on_attach = keymaps.on_attach require("lspconfig")[server].setup(opts) diff --git a/.config/nvim/lua/plugins/luasnip.lua b/.config/nvim/lua/plugins/luasnip.lua deleted file mode 100644 index bb84ed1..0000000 --- a/.config/nvim/lua/plugins/luasnip.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - "L3MON4D3/LuaSnip", - version = "*", - dependencies = { - "rafamadriz/friendly-snippets", - }, - config = function() - require("luasnip.loaders.from_vscode").lazy_load() - require("luasnip.loaders.from_vscode").lazy_load({ paths = "./snippets" }) - end, -}