fix(nvim): change cmp to blink and keep Telescope

This commit is contained in:
Stefan Imhoff
2024-12-20 12:50:35 +01:00
parent f7d9a9ca91
commit 621aaa2ccd
9 changed files with 218 additions and 262 deletions

View File

@@ -20,6 +20,7 @@ require("lazy").setup({
{ import = "lazyvim.plugins.extras.dap.core" },
{ import = "lazyvim.plugins.extras.editor.aerial" },
{ import = "lazyvim.plugins.extras.editor.harpoon2" },
{ import = "lazyvim.plugins.extras.editor.telescope" },
{ import = "lazyvim.plugins.extras.formatting.prettier" },
{ import = "lazyvim.plugins.extras.lang.go" },
{ import = "lazyvim.plugins.extras.lang.json" },

View File

@@ -0,0 +1,75 @@
-- blink.cmp
-- https://github.com/saghen/blink.cmp
return {
"saghen/blink.cmp",
version = not vim.g.lazyvim_blink_main and "*",
build = vim.g.lazyvim_blink_main and "cargo build --release",
opts_extend = {
"sources.completion.enabled_providers",
"sources.compat",
"sources.default",
},
dependencies = {
"rafamadriz/friendly-snippets",
-- add blink.compat to dependencies
{
"saghen/blink.compat",
optional = true, -- make optional so it's only enabled if any extras need it
opts = {},
version = not vim.g.lazyvim_blink_main and "*",
},
},
event = "InsertEnter",
opts = {
snippets = {
expand = function(snippet, _)
return LazyVim.cmp.expand(snippet)
end,
},
appearance = {
-- sets the fallback highlight groups to nvim-cmp's highlight groups
-- useful for when your theme doesn't support blink.cmp
-- will be removed in a future release, assuming themes add support
use_nvim_cmp_as_default = false,
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- adjusts spacing to ensure icons are aligned
nerd_font_variant = "mono",
},
completion = {
accept = {
-- experimental auto-brackets support
auto_brackets = {
enabled = true,
},
},
menu = {
draw = {
treesitter = { "lsp" },
},
},
documentation = {
auto_show = true,
auto_show_delay_ms = 200,
},
ghost_text = {
enabled = vim.g.ai_cmp,
},
},
-- experimental signature help support
-- signature = { enabled = true },
sources = {
-- adding any nvim-cmp sources here will enable them
-- with blink.compat
compat = {},
default = { "lsp", "path", "snippets", "buffer" },
cmdline = {},
},
keymap = {
preset = "enter",
["<C-y>"] = { "select_and_accept" },
},
},
}

View File

@@ -1,47 +0,0 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
"zbirenbaum/copilot-cmp",
"David-Kunz/cmp-npm",
},
opts = function(_, opts)
local cmp = require("cmp")
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, {
{ name = "copilot" },
{ name = "npm", keyword_length = 4 },
}))
opts.formatting = {
fields = { "kind", "abbr", "menu" },
format = function(_, item)
local icons = require("lazyvim.config").icons.kinds
if icons[item.kind] then
item.kind = icons[item.kind]
end
return item
end,
}
opts.window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
}
vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" })
vim.api.nvim_set_hl(0, "CmpItemAbbrMatch", { fg = "NONE", bg = "#000000" })
vim.cmd([[highlight! link CmpItemAbbrMatchFuzzy CmpItemAbbrMatch]])
vim.cmd([[highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080]])
vim.cmd([[highlight! CmpItemAbbrMatch guibg=NONE guifg=#569CD6]])
vim.cmd([[highlight! link CmpItemAbbrMatchFuzzy CmpItemAbbrMatch]])
vim.cmd([[highlight! CmpItemKindVariable guibg=NONE guifg=#9CDCFE]])
vim.cmd([[highlight! link CmpItemKindInterface CmpItemKindVariable]])
vim.cmd([[highlight! link CmpItemKindText CmpItemKindVariable]])
vim.cmd([[highlight! CmpItemKindFunction guibg=NONE guifg=#C586C0]])
vim.cmd([[highlight! link CmpItemKindMethod CmpItemKindFunction]])
vim.cmd([[highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4]])
vim.cmd([[highlight! link CmpItemKindProperty CmpItemKindKeyword]])
vim.cmd([[highlight! link CmpItemKindUnit CmpItemKindKeyword]])
end,
}

View File

@@ -1,10 +0,0 @@
-- Copilot replacement
-- https://github.com/zbirenbaum/copilot.lua
-- https://github.com/zbirenbaum/copilot-cmp
return {
"zbirenbaum/copilot-cmp",
dependencies = "zbirenbaum/copilot.lua",
opts = function()
require("copilot").setup()
end,
}

View File

@@ -1,56 +0,0 @@
-- Neotest
-- https://github.com/nvim-neotest/neotest
return {
{
"nvim-neotest/neotest",
dependencies = {
"haydenmeade/neotest-jest",
"marilari88/neotest-vitest",
},
keys = {
{
"<leader>tl",
function()
require("neotest").run.run_last()
end,
desc = "Run Last Test",
},
{
"<leader>tL",
function()
require("neotest").run.run_last({
strategy = "dap",
})
end,
desc = "Debug Last Test",
},
{
"<leader>tw",
"<cmd>lua require('neotest').run.run({ jestCommand = 'jest --watch ' })<cr>",
desc = "Run Watch",
},
},
opts = function(_, opts)
table.insert(
opts.adapters,
require("neotest-jest")({
jestCommand = "npm test --",
jestConfigFile = "custom.jest.config.ts",
env = {
CI = true,
},
cwd = function()
return vim.fn.getcwd()
end,
})
)
table.insert(opts.adapters, require("neotest-vitest"))
table.insert(
opts.adapters,
require("neotest-go")({
recursive_run = true,
})
)
end,
},
}

View File

@@ -1,72 +1,72 @@
-- Obsidian
-- https://github.com/epwalsh/obsidian.nvim
return {
"epwalsh/obsidian.nvim",
version = "*",
lazy = true,
ft = "markdown",
dependencies = {
-- required
"nvim-lua/plenary.nvim",
-- optional
"hrsh7th/nvim-cmp",
"nvim-telescope/telescope.nvim",
"ibhagwan/fzf-lua",
"junegunn/fzf",
"junegunn/fzf.vim",
"godlygeek/tabular",
"preservim/vim-markdown",
},
opts = {
ui = { enable = false },
workspaces = {
{
name = "zettelkasten",
path = "~/Code/GitHub/obsidian/zettelkasten",
overrides = {
notes_subdir = "pages",
},
},
{
name = "highlights",
path = "~/Code/GitHub/obsidian/highlights",
},
},
completion = {
nvim_cmp = true,
min_chars = 2,
use_path_only = false,
},
mappings = {
-- Overrides the 'gf' mapping to work on markdown/wiki links within your vault.
["gf"] = {
action = function()
return require("obsidian").util.gf_passthrough()
end,
opts = { noremap = false, expr = true, buffer = true },
},
-- Toggle check-boxes.
["<leader>ch"] = {
action = function()
return require("obsidian").util.toggle_checkbox()
end,
opts = { buffer = true },
},
},
disable_frontmatter = true,
note_id_func = function(title)
local suffix = ""
if title ~= nil and title ~= "" then
suffix = title
else
suffix = tostring(os.date("%Y%m%d%H%M"))
end
return suffix
end,
templates = {
subdir = "templates",
date_format = "%Y-%m-%d",
time_format = "%H:%M",
},
},
"epwalsh/obsidian.nvim",
version = "*",
lazy = true,
ft = "markdown",
dependencies = {
-- required
"nvim-lua/plenary.nvim",
-- optional
-- "hrsh7th/nvim-cmp",
-- "nvim-telescope/telescope.nvim",
"ibhagwan/fzf-lua",
"junegunn/fzf",
"junegunn/fzf.vim",
"godlygeek/tabular",
"preservim/vim-markdown",
},
opts = {
ui = { enable = false },
workspaces = {
{
name = "zettelkasten",
path = "~/Code/GitHub/obsidian/zettelkasten",
overrides = {
notes_subdir = "pages",
},
},
{
name = "highlights",
path = "~/Code/GitHub/obsidian/highlights",
},
},
completion = {
-- nvim_cmp = true,
min_chars = 2,
use_path_only = false,
},
mappings = {
-- Overrides the 'gf' mapping to work on markdown/wiki links within your vault.
["gf"] = {
action = function()
return require("obsidian").util.gf_passthrough()
end,
opts = { noremap = false, expr = true, buffer = true },
},
-- Toggle check-boxes.
["<leader>ch"] = {
action = function()
return require("obsidian").util.toggle_checkbox()
end,
opts = { buffer = true },
},
},
disable_frontmatter = true,
note_id_func = function(title)
local suffix = ""
if title ~= nil and title ~= "" then
suffix = title
else
suffix = tostring(os.date("%Y%m%d%H%M"))
end
return suffix
end,
templates = {
subdir = "templates",
date_format = "%Y-%m-%d",
time_format = "%H:%M",
},
},
}

View File

@@ -1,48 +1,48 @@
-- Tailwind CSS
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
tailwindcss = {},
},
},
},
{
"NvChad/nvim-colorizer.lua",
opts = {
user_default_options = {
tailwind = true,
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
tailwindcss = {},
},
},
},
{
"hrsh7th/nvim-cmp",
dependencies = {
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
},
opts = function(_, opts)
-- original LazyVim kind icon formatter
local format_kinds = opts.formatting.format
opts.formatting.format = function(entry, item)
format_kinds(entry, item) -- add icons
return require("tailwindcss-colorizer-cmp").formatter(entry, item)
end
end,
"NvChad/nvim-colorizer.lua",
opts = {
user_default_options = {
tailwind = true,
},
},
-- {
-- "hrsh7th/nvim-cmp",
-- dependencies = {
-- { "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
-- },
-- opts = function(_, opts)
-- -- original LazyVim kind icon formatter
-- local format_kinds = opts.formatting.format
-- opts.formatting.format = function(entry, item)
-- format_kinds(entry, item) -- add icons
-- return require("tailwindcss-colorizer-cmp").formatter(entry, item)
-- end
-- end,
-- },
"laytan/tailwind-sorter.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-lua/plenary.nvim",
},
build = "cd formatter && npm i && npm run build",
config = {
on_save_enabled = true,
on_save_pattern = { "*.html", "*.jsx", "*.tsx", "*.astro", "*.svelte" },
},
},
"laytan/tailwind-sorter.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-lua/plenary.nvim",
{
"luckasRanarison/tailwind-tools.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
opts = {},
},
build = "cd formatter && npm i && npm run build",
config = {
on_save_enabled = true,
on_save_pattern = { "*.html", "*.jsx", "*.tsx", "*.astro", "*.svelte" },
},
},
{
"luckasRanarison/tailwind-tools.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
opts = {},
},
}