From ef360f57058bc73976d8c1cf03bd8b0c54f369e5 Mon Sep 17 00:00:00 2001 From: Kulvir Singh Date: Thu, 24 Apr 2025 02:44:55 +0530 Subject: [PATCH] moved from nvim-cmp to blink.cmp --- .config/nvim/lua/lilJ/completions.lua | 75 ------------------- .config/nvim/lua/lilJ/plugins/blink.lua | 60 +++++++++++++++ .config/nvim/lua/lilJ/plugins/completions.lua | 26 ------- .config/nvim/lua/lilJ/plugins/lazydev.lua | 12 +++ .config/nvim/lua/lilJ/telescope.lua | 3 +- 5 files changed, 73 insertions(+), 103 deletions(-) delete mode 100644 .config/nvim/lua/lilJ/completions.lua create mode 100644 .config/nvim/lua/lilJ/plugins/blink.lua delete mode 100644 .config/nvim/lua/lilJ/plugins/completions.lua create mode 100644 .config/nvim/lua/lilJ/plugins/lazydev.lua diff --git a/.config/nvim/lua/lilJ/completions.lua b/.config/nvim/lua/lilJ/completions.lua deleted file mode 100644 index a4b38b6..0000000 --- a/.config/nvim/lua/lilJ/completions.lua +++ /dev/null @@ -1,75 +0,0 @@ -local luasnip = require "luasnip" -luasnip.config.setup { - history = false, - updateevents = "TextChanged,TextChangedI", -} - -require("luasnip.loaders.from_vscode").lazy_load() - -local lspkind = require "lspkind" -lspkind.init {} - -local cmp = require "cmp" -cmp.setup { - window = { - documentation = { - border = "rounded", - }, - completion = { - border = "rounded", - }, - }, - sources = { - { name = "nvim_lsp" }, - { name = "path" }, - { name = "buffer" }, - }, - completion = { - completeopt = "menu, menuone, noinsert, noselect", - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - expandable_indicator = true, - format = lspkind.cmp_format { - mode = "symbol", - }, - }, - - -- No, but seriously. Please read `:help ins-completion`, it is really good! - mapping = cmp.mapping.preset.insert { - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.select_prev_item(), - - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - - [""] = cmp.mapping.confirm { select = true }, - - [""] = cmp.mapping.complete {}, - - -- Think of as moving to the right of your snippet expansion. - -- So if you have a snippet that's like: - -- function $name($args) - -- $body - -- end - -- - -- will move you to the right of each of the expansion locations. - -- is similar, except moving you backwards. - [""] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { "i", "s" }), - [""] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { "i", "s" }), - }, - - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, -} diff --git a/.config/nvim/lua/lilJ/plugins/blink.lua b/.config/nvim/lua/lilJ/plugins/blink.lua new file mode 100644 index 0000000..e0f7269 --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/blink.lua @@ -0,0 +1,60 @@ +return { + "saghen/blink.cmp", + event = "VimEnter", + + -- use a release tag to download pre-built binaries + version = "1.*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + dependencies = { + "folke/lazydev.nvim", + }, + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = "default" }, + + appearance = { + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { + documentation = { auto_show = true, auto_show_delay_ms = 500 }, + + menu = { + border = "rounded", + draw = { + columns = { + { "kind_icon", "label", "label_description", gap = 1 }, + { "kind" }, + }, + }, + }, + }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "lsp", "path", "lazydev", "snippets", "buffer" }, + providers = { + lazydev = { module = "lazydev.integrations.blink", score_offset = 100 }, + }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + + -- Shows a signature help window while you type arguments for a function + signature = { enabled = true, window = { border = "rounded" } }, + }, + opts_extend = { "sources.default" }, +} diff --git a/.config/nvim/lua/lilJ/plugins/completions.lua b/.config/nvim/lua/lilJ/plugins/completions.lua deleted file mode 100644 index 8d19e07..0000000 --- a/.config/nvim/lua/lilJ/plugins/completions.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - "onsails/lspkind.nvim", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - "hrsh7th/cmp-buffer", - { - "L3MON4D3/LuaSnip", - build = "make install_jsregexp", - dependencies = { - { - "rafamadriz/friendly-snippets", - config = function() - require("luasnip.loaders.from_vscode").lazy_load() - end, - }, - }, - }, - "saadparwaiz1/cmp_luasnip", - }, - config = function() - require "lilJ.completions" - end, -} diff --git a/.config/nvim/lua/lilJ/plugins/lazydev.lua b/.config/nvim/lua/lilJ/plugins/lazydev.lua new file mode 100644 index 0000000..6cb1ad2 --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/lazydev.lua @@ -0,0 +1,12 @@ +return { + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + "folke/lazydev.nvim", + ft = "lua", + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, +} diff --git a/.config/nvim/lua/lilJ/telescope.lua b/.config/nvim/lua/lilJ/telescope.lua index 1eb9281..3f86b76 100644 --- a/.config/nvim/lua/lilJ/telescope.lua +++ b/.config/nvim/lua/lilJ/telescope.lua @@ -38,7 +38,6 @@ vim.keymap.set("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp" vim.keymap.set("n", "sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) vim.keymap.set("n", "ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" }) --- IDK how to make grep work on my machine... (skill issues tbh) vim.keymap.set("n", "sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) vim.keymap.set("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) @@ -50,7 +49,7 @@ vim.keymap.set("n", "", builtin.buffers, { desc = "[ ] Find exis -- Slightly advanced example of overriding default behavior and theme vim.keymap.set("n", "/", function() builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown { - winblend = 50, + winblend = 10, previewer = false, }) end, { desc = "[/] Fuzzily search in current buffer" })