chore(completion): removing blink.cmp in favor of native completion

This commit is contained in:
DarthMooMancer committed 2026-11-09 11:03:33 -05:00
1 parent ce17e2108d
commit 4d41e5208c
17 files changed
+434 -302

No files matched your search

+91
View File
@@ -0,0 +1,91 @@
local function switch_source_header(bufnr, client)
local method_name = 'textDocument/switchSourceHeader'
---@diagnostic disable-next-line:param-type-mismatch
if not client or not client:supports_method(method_name) then
return vim.notify(
('method %s is not supported by any servers active on the current buffer'):format(method_name)
)
end
local params = vim.lsp.util.make_text_document_params(bufnr)
---@diagnostic disable-next-line:param-type-mismatch
client:request(method_name, params, function(err, result)
if err then
error(tostring(err))
end
if not result then
vim.notify('corresponding file cannot be determined')
return
end
vim.cmd.edit(vim.uri_to_fname(result))
end, bufnr)
end
local function symbol_info(bufnr, client)
local method_name = 'textDocument/symbolInfo'
---@diagnostic disable-next-line:param-type-mismatch
if not client or not client:supports_method(method_name) then
return vim.notify('Clangd client not found', vim.log.levels.ERROR)
end
local win = vim.api.nvim_get_current_win()
local params = vim.lsp.util.make_position_params(win, client.offset_encoding)
---@diagnostic disable-next-line:param-type-mismatch
client:request(method_name, params, function(err, res)
if err or #res == 0 then
-- Clangd always returns an error, there is no reason to parse it
return
end
local container = string.format('container: %s', res[1].containerName) ---@type string
local name = string.format('name: %s', res[1].name) ---@type string
vim.lsp.util.open_floating_preview({ name, container }, '', {
height = 2,
width = math.max(string.len(name), string.len(container)),
focusable = false,
focus = false,
title = 'Symbol Info',
})
end, bufnr)
end
---@class ClangdInitializeResult: lsp.InitializeResult
---@field offsetEncoding? string
return {
cmd = { 'clangd' },
filetypes = { 'c', 'c.doxygen', 'cpp', 'cpp.doxygen', 'objc', 'objcpp', 'cuda' },
root_markers = {
'.clangd',
'.clang-tidy',
'.clang-format',
'compile_commands.json',
'compile_flags.txt',
'configure.ac', -- AutoTools
'.git',
},
get_language_id = function(_, ftype)
local t = { objc = 'objective-c', objcpp = 'objective-cpp', cuda = 'cuda-cpp' }
return t[ftype] or ftype
end,
capabilities = {
textDocument = {
completion = {
editsNearCursor = true,
},
},
offsetEncoding = { 'utf-8', 'utf-16' },
},
---@param init_result ClangdInitializeResult
on_init = function(client, init_result)
if init_result.offsetEncoding then
client.offset_encoding = init_result.offsetEncoding
end
end,
on_attach = function(client, bufnr)
vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdSwitchSourceHeader', function()
switch_source_header(bufnr, client)
end, { desc = 'Switch between source/header' })
vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdShowSymbolInfo', function()
symbol_info(bufnr, client)
end, { desc = 'Show symbol info' })
end,
}
+85
View File
@@ -0,0 +1,85 @@
local mod_cache = nil
local std_lib = nil
local function identify_go_dir(custom_args, on_complete)
local cmd = { 'go', 'env', custom_args.envvar_id }
vim.system(cmd, { text = true }, function(output)
local res = vim.trim(output.stdout or '')
if output.code == 0 and res ~= '' then
if custom_args.custom_subdir and custom_args.custom_subdir ~= '' then
res = res .. custom_args.custom_subdir
end
on_complete(res)
else
vim.schedule(function()
vim.notify(
('[gopls] identify ' .. custom_args.envvar_id .. ' dir cmd failed with code %d: %s\n%s'):format(
output.code,
vim.inspect(cmd),
output.stderr
)
)
end)
on_complete(nil)
end
end)
end
local function get_std_lib_dir()
if std_lib and std_lib ~= '' then
return std_lib
end
identify_go_dir({ envvar_id = 'GOROOT', custom_subdir = '/src' }, function(dir)
if dir then
std_lib = dir
end
end)
return std_lib
end
local function get_mod_cache_dir()
if mod_cache and mod_cache ~= '' then
return mod_cache
end
identify_go_dir({ envvar_id = 'GOMODCACHE' }, function(dir)
if dir then
mod_cache = dir
end
end)
return mod_cache
end
local function get_root_dir(fname)
if mod_cache and fname:sub(1, #mod_cache) == mod_cache then
local clients = vim.lsp.get_clients({ name = 'gopls' })
if #clients > 0 then
return clients[#clients].config.root_dir
end
end
if std_lib and fname:sub(1, #std_lib) == std_lib then
local clients = vim.lsp.get_clients({ name = 'gopls' })
if #clients > 0 then
return clients[#clients].config.root_dir
end
end
return vim.fs.root(fname, 'go.work') or vim.fs.root(fname, 'go.mod') or vim.fs.root(fname, '.git')
end
return {
cmd = { 'gopls' },
filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
get_mod_cache_dir()
get_std_lib_dir()
-- see: https://github.com/neovim/nvim-lspconfig/issues/804
on_dir(get_root_dir(fname))
end,
settings = {
gopls = {
semanticTokens = true,
},
},
}
+20
View File
@@ -0,0 +1,20 @@
return {
cmd = function(dispatchers, config)
local cmd = 'vscode-html-language-server'
if (config or {}).root_dir then
local local_cmd = vim.fs.joinpath(config.root_dir, 'node_modules/.bin', cmd)
if vim.fn.executable(local_cmd) == 1 then
cmd = local_cmd
end
end
return vim.lsp.rpc.start({ cmd, '--stdio' }, dispatchers)
end,
filetypes = { 'html' },
root_markers = { 'package.json', '.git' },
settings = {},
init_options = {
provideFormatter = true,
embeddedLanguages = { css = true, javascript = true },
configurationSection = { 'html', 'css', 'javascript' },
},
}
+40
View File
@@ -0,0 +1,40 @@
local root_markers1 = {
'.emmyrc.json',
'.luarc.json',
'.luarc.jsonc',
}
local root_markers2 = {
'.luacheckrc',
'.stylua.toml',
'stylua.toml',
'selene.toml',
'selene.yml',
}
return {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers1, root_markers2, { '.git' } }
or vim.list_extend(vim.list_extend(root_markers1, root_markers2), { '.git' }),
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = { globals = { 'vim' } },
completion = { callSnippet = 'Replace' },
type = {
checkTableShape = true, -- Warns if you pass a table missing required fields
inferParamType = true, -- Tries to figure out argument types from usage
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME .. '/lua',
'/Users/andrew/personal/Projects/Lua/vern-nvim/lua',
},
},
},
},
}
+51
View File
@@ -0,0 +1,51 @@
return {
cmd = { 'vtsls', '--stdio' },
init_options = {
hostInfo = 'neovim',
},
filetypes = {
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
},
settings = {
vtsls = {
autoUseWorkspaceTsdk = true,
experimental = {
completion = {
enableServerSideFuzzyMatch = true,
},
},
},
typescript = {
tsserver = {
maxTsServerMemory = 8192,
},
updateImportsOnFileMove = { enabled = 'always' },
preferences = {
importModuleSpecifier = 'non-relative',
},
},
javascript = {
updateImportsOnFileMove = { enabled = 'always' },
},
},
root_dir = function(bufnr, on_dir)
local root_markers =
{ 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' }
root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
or vim.list_extend(root_markers, { '.git' })
local deno_root = vim.fs.root(bufnr, { 'deno.json', 'deno.jsonc' })
local deno_lock_root = vim.fs.root(bufnr, { 'deno.lock' })
local project_root = vim.fs.root(bufnr, root_markers)
if deno_lock_root and (not project_root or #deno_lock_root > #project_root) then
return
end
if deno_root and (not project_root or #deno_root >= #project_root) then
return
end
on_dir(project_root or vim.fn.getcwd())
end,
}
@@ -185,3 +185,5 @@ vim.api.nvim_set_hl(0, '@markup.heading', { link = 'Function' })
vim.api.nvim_set_hl(0, '@markup.quote', { link = '@variable.parameter' })
vim.api.nvim_set_hl(0, '@markup.raw', { link = 'String' })
vim.api.nvim_set_hl(0, '@lsp.type.keyword.lua', { fg = palette.red1 })
vim.api.nvim_set_hl(0, '@tag.attribute.html', { link = '@property' })
vim.api.nvim_set_hl(0, '@string.special.url.html', { fg = palette.red1 })
+26 -13
View File
@@ -1,9 +1,11 @@
vim.loader.enable()
vim.g.mapleader = ' '
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.hlsearch = false
vim.opt.undofile = true
vim.opt.swapfile = false
@@ -14,32 +16,43 @@ vim.opt.confirm = true
vim.opt.scrolloff = 15
vim.opt.sidescrolloff = 15
vim.opt.smoothscroll = true
vim.opt.updatetime = 50
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.softtabstop = -1
vim.opt.expandtab = true
vim.opt.autocomplete = true
vim.opt.complete = 'o'
vim.opt.completeopt = { 'fuzzy', 'menu', 'menuone', 'noinsert', 'popup' }
vim.opt.pumheight = 10
vim.opt.pumwidth = 15
vim.diagnostic.config({
virtual_text = true,
severity_sort = true,
})
vim.opt.statusline = '%<%f %h%m%r%=%{%v:lua.GetDiagnostics()%}%l:%L'
function _G.GetDiagnostics()
local win = tonumber(vim.g.statusline_winid)
local buf = (win and vim.api.nvim_win_is_valid(win)) and vim.api.nvim_win_get_buf(win)
or vim.api.nvim_get_current_buf()
local dg = vim.diagnostic.status(buf)
return dg ~= '' and (dg .. ' ') or ''
end
require('DarthMooMancer.plugins')
vim.cmd.colorscheme('minikanso-zen')
require('DarthMooMancer.keymaps')
require('DarthMooMancer.lsp')
local capabilities = vim.lsp.protocol.make_client_capabilities()
if capabilities.workspace then
capabilities.workspace.didChangeWatchedFiles = nil
end
vim.lsp.config('*', {
capabilities = capabilities,
})
vim.lsp.enable({
'lua_ls',
'clangd',
'gopls',
'vtsls',
'html',
})
@@ -1,13 +1,10 @@
local map = vim.keymap.set
--- grr for references, gra for actions, grn for rename as you removed the old keybinds to use defaults
map('n', 'gd', vim.lsp.buf.definition)
map('v', 'J', ":m '>+1<CR>gv=gv")
map('v', 'K', ":m '<-2<CR>gv=gv")
map('n', '<leader>cs', '<cmd>nohlsearch<CR>', { desc = 'Clear search highlights' })
map('n', '<C-u>', '<C-u>zz')
map('n', '<C-d>', '<C-d>zz')
map('n', 'n', 'nzzzv')
@@ -17,15 +14,15 @@ map('x', '<leader>p', [["_dP]])
map('n', '<leader>vs', ':vsplit<CR>')
map('n', '<leader>ss', ':split<CR>')
map('n', '<leader>[', '<c-w>H', { silent = true })
map('n', '<leader>]', '<c-w>K', { silent = true })
-- map('n', '<leader>[', '<c-w>H', { silent = true })
-- map('n', '<leader>]', '<c-w>K', { silent = true })
map('n', '<leader>E', ':Ex<CR>')
map('n', '<leader>lp', '<cmd>LivePreview pick<cr>')
map('n', '<leader><leader>', ':Pick files<CR>', { silent = true })
map('n', '<leader>fh', ':Pick help<CR>', { silent = true })
map('n', '<leader>fg', ':Pick grep_live<CR>', { silent = true })
map('n', '<leader>uu', function()
vim.cmd('packadd nvim.undotree')
require('undotree').open({
@@ -1,81 +0,0 @@
-- vim.lsp.config('*', {
-- capabilities = require('blink.cmp').get_lsp_capabilities(nil, true),
-- })
local capabilities = vim.lsp.protocol.make_client_capabilities()
if capabilities.workspace then
capabilities.workspace.didChangeWatchedFiles = nil
end
vim.lsp.config('*', {
capabilities = capabilities,
})
vim.lsp.config('lua_ls', {
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = { globals = { 'vim' } },
completion = { callSnippet = 'Replace' },
hint = { enable = true },
codeLens = {
enable = true,
},
type = {
checkTableShape = true, -- Warns if you pass a table missing required fields
inferParamType = true, -- Tries to figure out argument types from usage
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME .. '/lua',
'/Users/andrew/personal/Projects/Lua/vern-nvim/lua',
},
},
},
},
})
vim.lsp.config('vtsls', {
settings = {
vtsls = {
autoUseWorkspaceTsdk = true,
experimental = {
completion = {
enableServerSideFuzzyMatch = true,
},
},
},
typescript = {
tsserver = {
maxTsServerMemory = 8192,
},
updateImportsOnFileMove = { enabled = 'always' },
preferences = {
importModuleSpecifier = 'non-relative',
},
},
javascript = {
updateImportsOnFileMove = { enabled = 'always' },
},
},
})
vim.lsp.enable({
'lua_ls',
'clangd',
'gopls',
--- Web
'vtsls',
'html',
})
-- vim.opt.autocomplete = true
-- vim.opt.complete = { 'o', '.', 'w' }
-- vim.opt.completeopt = { 'fuzzy', 'menu', 'menuone', 'noselect', 'popup' }
--
-- vim.opt.pumheight = 10
-- vim.opt.pumwidth = 15
-- vim.opt.pumborder = vim.o.winborder -- currently 'rounded'
+116 -12
View File
@@ -1,24 +1,128 @@
vim.pack.add({
{ src = 'https://github.com/nvim-mini/mini.nvim.git', version = vim.version.range('*') },
{ src = 'https://github.com/nvim-treesitter/nvim-treesitter' },
{ src = 'https://github.com/saghen/blink.cmp', version = vim.version.range('*') },
{ src = 'https://github.com/mason-org/mason.nvim' },
{ src = 'https://github.com/mason-org/mason-lspconfig.nvim' },
{ src = 'https://github.com/neovim/nvim-lspconfig' },
{ src = 'https://github.com/stevearc/conform.nvim' },
{ src = 'https://git.moomancer.xyz/DarthMooMancer/mason-conform.nvim.git' },
{ src = 'https://github.com/brianhuster/live-preview.nvim' },
{ src = 'https://github.com/alexghergh/nvim-tmux-navigation' },
})
local parsers = {
'lua',
'luadoc', -- highlights ---@ annotations, useful for your plugin work
'go',
'gomod',
'c',
'cpp',
'javascript',
'typescript',
'tsx',
'html',
'css',
'vim',
'vimdoc',
'query',
'json',
'yaml',
'toml',
'bash',
'markdown',
'markdown_inline',
'gitcommit',
'gitignore',
'diff',
}
local group = vim.api.nvim_create_augroup('UserTreesitter', { clear = true })
vim.api.nvim_create_autocmd('VimEnter', {
group = group,
once = true,
callback = function()
require('nvim-treesitter').install(parsers)
end,
})
vim.api.nvim_create_autocmd('FileType', {
group = group,
desc = 'Start treesitter highlighting when a parser is installed',
pattern = '*',
callback = function(ev)
if vim.bo[ev.buf].buftype ~= '' then
return
end
local ok = pcall(vim.treesitter.start, ev.buf)
if ok then
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
end,
})
local hipatterns = require('mini.hipatterns')
hipatterns.setup({
highlighters = {
hex_color = hipatterns.gen_highlighter.hex_color(),
},
})
require('mini.pairs').setup()
require('mini.icons').setup()
require('mini.notify').setup()
require('mini.input').setup()
require('mini.pick').setup({
window = {
config = function()
local height = math.floor(0.618 * vim.o.lines)
local width = math.floor(0.618 * vim.o.columns)
return {
anchor = 'NW',
row = math.floor(0.5 * (vim.o.lines - height)),
col = math.floor(0.5 * (vim.o.columns - width)),
height = height,
width = width,
}
end,
},
})
local conform = require('conform')
conform.setup({
formatters_by_ft = {
lua = { 'stylua' },
c = { 'clang-format' },
cpp = { 'clang-format' },
go = { 'goimports' },
javascript = { 'prettier', stop_after_first = true },
typescript = { 'prettier', stop_after_first = true },
json = { 'prettier' },
html = { 'prettier' },
css = { 'prettier' },
markdown = { 'prettier' },
yaml = { 'prettier' },
['_'] = { 'trim_whitespace' },
},
format_on_save = {
timeout_ms = 2000,
lsp_format = 'fallback',
},
})
vim.keymap.set('n', '<leader>ff', function()
conform.format({ async = true, lsp_format = 'fallback' })
end)
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
vim.opt.rtp:append('/Users/andrew/personal/Projects/Lua/vern-nvim')
require('vern-nvim').setup({
workspace_root = '~/personal/Projects_Testing',
env = {
author = 'DarthMooMancer',
},
})
require('DarthMooMancer.plugins.treesitter')
require('DarthMooMancer.plugins.mason')
require('DarthMooMancer.plugins.mini-nvim')
require('DarthMooMancer.plugins.conform')
require('DarthMooMancer.plugins.blink-cmp')
require('DarthMooMancer.plugins.vern')
require('nvim-tmux-navigation').setup({
disable_when_zoomed = true, -- defaults to false
keybindings = {
@@ -1,11 +0,0 @@
require('blink.cmp').setup({
completion = {
documentation = {
auto_show = true,
auto_show_delay_ms = 50,
},
menu = {
scrollbar = false,
},
},
})
@@ -1,30 +0,0 @@
local conform = require('conform')
conform.setup({
formatters_by_ft = {
lua = { 'stylua' },
c = { 'clang-format' },
cpp = { 'clang-format' },
go = { 'goimports' },
--- Web
javascript = { 'prettier', stop_after_first = true },
typescript = { 'prettier', stop_after_first = true },
json = { 'prettier' },
html = { 'prettier' },
css = { 'prettier' },
markdown = { 'prettier' },
yaml = { 'prettier' },
['_'] = { 'trim_whitespace' },
},
format_on_save = {
timeout_ms = 2000,
lsp_format = 'fallback',
},
})
vim.keymap.set('n', '<leader>ff', function()
conform.format({ async = true, lsp_format = 'fallback' })
end)
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
@@ -1,11 +0,0 @@
require('mason').setup()
require('mason-lspconfig').setup({
ensure_installed = {
'gopls',
'lua_ls',
'vtsls', -- typescript, javascript
'html',
},
automatic_enable = false,
})
require('mason-conform').setup()
@@ -1,45 +0,0 @@
local hipatterns = require('mini.hipatterns')
hipatterns.setup({
highlighters = {
fixme = {
pattern = '%f[%w]()FIXME()%f[%W]',
group = 'MiniHipatternsFixme',
},
hack = {
pattern = '%f[%w]()HACK()%f[%W]',
group = 'MiniHipatternsHack',
},
todo = {
pattern = '%f[%w]()TODO()%f[%W]',
group = 'MiniHipatternsTodo',
},
note = {
pattern = '%f[%w]()NOTE()%f[%W]',
group = 'MiniHipatternsNote',
},
hex_color = hipatterns.gen_highlighter.hex_color(),
},
})
require('mini.pairs').setup()
-- require('mini.surround').setup()
require('mini.icons').setup()
require('mini.notify').setup()
require('mini.input').setup()
require('mini.pick').setup({
window = {
config = function()
local height = math.floor(0.618 * vim.o.lines)
local width = math.floor(0.618 * vim.o.columns)
return {
anchor = 'NW',
row = math.floor(0.5 * (vim.o.lines - height)),
col = math.floor(0.5 * (vim.o.columns - width)),
height = height,
width = width,
}
end,
},
})
@@ -1,53 +0,0 @@
local parsers = {
'lua',
'luadoc', -- highlights ---@ annotations, useful for your plugin work
'go',
'gomod',
'c',
'cpp',
'vim',
'vimdoc',
'query',
'json',
'yaml',
'toml',
'bash',
'markdown',
'markdown_inline',
'gitcommit',
'gitignore',
'diff',
-- web: keep the installed parsers, but don't auto-install for now
-- 'javascript',
-- 'typescript',
-- 'tsx',
-- 'html',
-- 'css',
}
local group = vim.api.nvim_create_augroup('UserTreesitter', { clear = true })
vim.api.nvim_create_autocmd('VimEnter', {
group = group,
once = true,
callback = function()
require('nvim-treesitter').install(parsers)
end,
})
vim.api.nvim_create_autocmd('FileType', {
group = group,
desc = 'Start treesitter highlighting when a parser is installed',
pattern = '*',
callback = function(ev)
if vim.bo[ev.buf].buftype ~= '' then
return
end
local ok = pcall(vim.treesitter.start, ev.buf)
if ok then
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
end,
})
@@ -1,15 +0,0 @@
require('vern-nvim').setup({
workspace_root = '~/personal/Projects_Testing',
env = {
author = 'DarthMooMancer',
},
c = {
templates = {
extras = {
linter = {
enabled = true,
},
},
},
},
})
-25
View File
@@ -1,39 +1,14 @@
{
"plugins": {
"blink.cmp": {
"rev": "78336bc89ee5365633bcf754d93df01678b5c08f",
"src": "https://github.com/saghen/blink.cmp",
"version": ">=0.0.0"
},
"conform.nvim": {
"rev": "016802de402556da54c36bd7359b441266b01cdd",
"src": "https://github.com/stevearc/conform.nvim"
},
"live-preview.nvim": {
"rev": "dad92ae9599f9b19a7dffe7d597d3376c110b818",
"src": "https://github.com/brianhuster/live-preview.nvim"
},
"mason-conform.nvim": {
"rev": "132a3d0630de4bdb80e96ccd62b740fcf5754bdc",
"src": "https://git.moomancer.xyz/DarthMooMancer/mason-conform.nvim.git"
},
"mason-lspconfig.nvim": {
"rev": "3a5cd6d562a01f6829a35ae761dc383264ea452b",
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
},
"mason.nvim": {
"rev": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d",
"src": "https://github.com/mason-org/mason.nvim"
},
"mini.nvim": {
"rev": "1345d191bb3da9c7b0e977f4387c5761f9bff68d",
"src": "https://github.com/nvim-mini/mini.nvim.git",
"version": ">=0.0.0"
},
"nvim-lspconfig": {
"rev": "adfbb74472f6c231b651b650a89f414c2680fb31",
"src": "https://github.com/neovim/nvim-lspconfig"
},
"nvim-tmux-navigation": {
"rev": "4898c98702954439233fdaf764c39636681e2861",
"src": "https://github.com/alexghergh/nvim-tmux-navigation"