moved from nvim-cmp to blink.cmp
This commit is contained in:
@@ -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 {
|
|
||||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
|
||||||
|
|
||||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
|
||||||
|
|
||||||
["<C-y>"] = cmp.mapping.confirm { select = true },
|
|
||||||
|
|
||||||
["<C-Space>"] = cmp.mapping.complete {},
|
|
||||||
|
|
||||||
-- Think of <c-l> as moving to the right of your snippet expansion.
|
|
||||||
-- So if you have a snippet that's like:
|
|
||||||
-- function $name($args)
|
|
||||||
-- $body
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- <c-l> will move you to the right of each of the expansion locations.
|
|
||||||
-- <c-h> is similar, except moving you backwards.
|
|
||||||
["<C-l>"] = cmp.mapping(function()
|
|
||||||
if luasnip.expand_or_locally_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
["<C-h>"] = 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,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
60
.config/nvim/lua/lilJ/plugins/blink.lua
Normal file
60
.config/nvim/lua/lilJ/plugins/blink.lua
Normal file
@@ -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" },
|
||||||
|
}
|
||||||
@@ -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,
|
|
||||||
}
|
|
||||||
12
.config/nvim/lua/lilJ/plugins/lazydev.lua
Normal file
12
.config/nvim/lua/lilJ/plugins/lazydev.lua
Normal file
@@ -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" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -38,7 +38,6 @@ vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp"
|
|||||||
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
|
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
|
||||||
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
|
vim.keymap.set("n", "<leader>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", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
|
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
|
||||||
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
||||||
|
|
||||||
@@ -50,7 +49,7 @@ vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find exis
|
|||||||
-- Slightly advanced example of overriding default behavior and theme
|
-- Slightly advanced example of overriding default behavior and theme
|
||||||
vim.keymap.set("n", "<leader>/", function()
|
vim.keymap.set("n", "<leader>/", function()
|
||||||
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown {
|
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown {
|
||||||
winblend = 50,
|
winblend = 10,
|
||||||
previewer = false,
|
previewer = false,
|
||||||
})
|
})
|
||||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
end, { desc = "[/] Fuzzily search in current buffer" })
|
||||||
|
|||||||
Reference in New Issue
Block a user