chore(blink): I added it back but will switch back and forth until native feels good
This commit is contained in:
1 parent
4d41e5208c
commit
3581deb550
12 files changed
+229
-343
No files matched your search
@@ -1,91 +0,0 @@
|
|||||||
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,
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
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,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
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' },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
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',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
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,
|
|
||||||
}
|
|
||||||
@@ -36,18 +36,21 @@ local palette = {
|
|||||||
gray4 = '#43464E',
|
gray4 = '#43464E',
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'ColorColumn', { bg = palette.bg2 })
|
--- ColorColumn, Conceal, Cursor, lCursor, CursorIM, CursorLine, CursorColumn,
|
||||||
vim.api.nvim_set_hl(0, 'Conceal', { fg = palette.gray3, bold = true })
|
--- CursorLineSign, CursorLineFold, CursorLineNr, NormalNC, WildMenu,
|
||||||
|
|
||||||
|
-- vim.api.nvim_set_hl(0, 'ColorColumn', { bg = palette.bg2 })
|
||||||
|
-- vim.api.nvim_set_hl(0, 'Conceal', { fg = palette.gray3, bold = true })
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'CurSearch', { fg = palette.fg0, bg = palette.blue1, bold = true })
|
vim.api.nvim_set_hl(0, 'CurSearch', { fg = palette.fg0, bg = palette.blue1, bold = true })
|
||||||
vim.api.nvim_set_hl(0, 'Cursor', { fg = palette.bg0, bg = palette.fg1 })
|
-- vim.api.nvim_set_hl(0, 'Cursor', { fg = palette.bg0, bg = palette.fg1 })
|
||||||
vim.api.nvim_set_hl(0, 'lCursor', { link = 'Cursor' })
|
-- vim.api.nvim_set_hl(0, 'lCursor', { link = 'Cursor' })
|
||||||
vim.api.nvim_set_hl(0, 'CursorIM', { link = 'Cursor' })
|
-- vim.api.nvim_set_hl(0, 'CursorIM', { link = 'Cursor' })
|
||||||
vim.api.nvim_set_hl(0, 'CursorLine', { bg = palette.bg3 })
|
-- vim.api.nvim_set_hl(0, 'CursorLine', { bg = palette.bg3 })
|
||||||
vim.api.nvim_set_hl(0, 'CursorColumn', { link = 'CursorLine' })
|
-- vim.api.nvim_set_hl(0, 'CursorColumn', { link = 'CursorLine' })
|
||||||
vim.api.nvim_set_hl(0, 'CursorLineSign', { link = 'CursorLine' })
|
-- vim.api.nvim_set_hl(0, 'CursorLineSign', { link = 'CursorLine' })
|
||||||
vim.api.nvim_set_hl(0, 'CursorLineFold', { link = 'CursorLine' })
|
-- vim.api.nvim_set_hl(0, 'CursorLineFold', { link = 'CursorLine' })
|
||||||
vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = palette.fg1, bg = palette.none })
|
-- vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = palette.fg1, bg = palette.none })
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'Directory', { fg = palette.blue3 })
|
vim.api.nvim_set_hl(0, 'Directory', { fg = palette.blue3 })
|
||||||
vim.api.nvim_set_hl(0, 'EndOfBuffer', { fg = palette.bg0 })
|
vim.api.nvim_set_hl(0, 'EndOfBuffer', { fg = palette.bg0 })
|
||||||
@@ -67,7 +70,7 @@ vim.api.nvim_set_hl(0, 'MoreMsg', { link = 'DiagnosticInfo' })
|
|||||||
vim.api.nvim_set_hl(0, 'NonText', { fg = palette.gray3 })
|
vim.api.nvim_set_hl(0, 'NonText', { fg = palette.gray3 })
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'Normal', { fg = palette.fg0, bg = palette.bg0 })
|
vim.api.nvim_set_hl(0, 'Normal', { fg = palette.fg0, bg = palette.bg0 })
|
||||||
vim.api.nvim_set_hl(0, 'NormalNC', { link = 'Normal' })
|
-- vim.api.nvim_set_hl(0, 'NormalNC', { link = 'Normal' })
|
||||||
vim.api.nvim_set_hl(0, 'NormalFloat', { fg = palette.gray0, bg = palette.bg1 })
|
vim.api.nvim_set_hl(0, 'NormalFloat', { fg = palette.gray0, bg = palette.bg1 })
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'FloatBorder', { fg = palette.gray4, bg = palette.bg1 })
|
vim.api.nvim_set_hl(0, 'FloatBorder', { fg = palette.gray4, bg = palette.bg1 })
|
||||||
@@ -75,7 +78,7 @@ vim.api.nvim_set_hl(0, 'FloatTitle', { fg = palette.gray3, bg = palette.bg1, bol
|
|||||||
vim.api.nvim_set_hl(0, 'FloatFooter', { fg = palette.gray3, bg = palette.bg1 })
|
vim.api.nvim_set_hl(0, 'FloatFooter', { fg = palette.gray3, bg = palette.bg1 })
|
||||||
vim.api.nvim_set_hl(0, 'Pmenu', { link = 'NormalFloat' })
|
vim.api.nvim_set_hl(0, 'Pmenu', { link = 'NormalFloat' })
|
||||||
vim.api.nvim_set_hl(0, 'PmenuSel', { fg = palette.none, bg = palette.gray4 })
|
vim.api.nvim_set_hl(0, 'PmenuSel', { fg = palette.none, bg = palette.gray4 })
|
||||||
vim.api.nvim_set_hl(0, 'PmenuKind', { link = 'Pmenu' })
|
-- vim.api.nvim_set_hl(0, 'PmenuKind', { link = 'Pmenu' })
|
||||||
vim.api.nvim_set_hl(0, 'PmenuKindSel', { fg = palette.gray0, bg = palette.gray4 })
|
vim.api.nvim_set_hl(0, 'PmenuKindSel', { fg = palette.gray0, bg = palette.gray4 })
|
||||||
vim.api.nvim_set_hl(0, 'PmenuExtra', { fg = palette.gray3, bg = palette.bg1 })
|
vim.api.nvim_set_hl(0, 'PmenuExtra', { fg = palette.gray3, bg = palette.bg1 })
|
||||||
vim.api.nvim_set_hl(0, 'PmenuExtraSel', { fg = palette.gray3, bg = palette.gray4 })
|
vim.api.nvim_set_hl(0, 'PmenuExtraSel', { fg = palette.gray3, bg = palette.gray4 })
|
||||||
@@ -93,12 +96,12 @@ vim.api.nvim_set_hl(0, 'Title', { fg = palette.blue3, bold = true })
|
|||||||
vim.api.nvim_set_hl(0, 'Visual', { bg = palette.bg4 })
|
vim.api.nvim_set_hl(0, 'Visual', { bg = palette.bg4 })
|
||||||
vim.api.nvim_set_hl(0, 'VisualNOS', { link = 'Visual' })
|
vim.api.nvim_set_hl(0, 'VisualNOS', { link = 'Visual' })
|
||||||
vim.api.nvim_set_hl(0, 'WarningMsg', { fg = palette.yellow0 })
|
vim.api.nvim_set_hl(0, 'WarningMsg', { fg = palette.yellow0 })
|
||||||
vim.api.nvim_set_hl(0, 'WildMenu', { link = 'Pmenu' })
|
-- vim.api.nvim_set_hl(0, 'WildMenu', { link = 'Pmenu' })
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'SpellBad', { link = 'DiagnosticUnderlineError' })
|
-- vim.api.nvim_set_hl(0, 'SpellBad', { link = 'DiagnosticUnderlineError' })
|
||||||
vim.api.nvim_set_hl(0, 'SpellCap', { link = 'DiagnosticUnderlineWarn' })
|
-- vim.api.nvim_set_hl(0, 'SpellCap', { link = 'DiagnosticUnderlineWarn' })
|
||||||
vim.api.nvim_set_hl(0, 'SpellRare', { undercurl = true, sp = palette.violet0 })
|
-- vim.api.nvim_set_hl(0, 'SpellRare', { undercurl = true, sp = palette.violet0 })
|
||||||
vim.api.nvim_set_hl(0, 'SpellLocal', { undercurl = true, sp = palette.aqua1 })
|
-- vim.api.nvim_set_hl(0, 'SpellLocal', { undercurl = true, sp = palette.aqua1 })
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'DiagnosticError', { fg = palette.red0 })
|
vim.api.nvim_set_hl(0, 'DiagnosticError', { fg = palette.red0 })
|
||||||
vim.api.nvim_set_hl(0, 'DiagnosticWarn', { fg = palette.yellow0 })
|
vim.api.nvim_set_hl(0, 'DiagnosticWarn', { fg = palette.yellow0 })
|
||||||
@@ -113,6 +116,8 @@ vim.api.nvim_set_hl(0, 'DiagnosticUnderlineHint', { undercurl = true, sp = palet
|
|||||||
vim.api.nvim_set_hl(0, 'DiagnosticUnderlineOk', { undercurl = true, sp = palette.green0 })
|
vim.api.nvim_set_hl(0, 'DiagnosticUnderlineOk', { undercurl = true, sp = palette.green0 })
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'LspSignatureActiveParameter', { fg = palette.yellow0 })
|
vim.api.nvim_set_hl(0, 'LspSignatureActiveParameter', { fg = palette.yellow0 })
|
||||||
|
---
|
||||||
|
--- VertSplit, Ignore, PmenuKind, SpellBad, SpellCap, SpellRare, SpellLocal.
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'Comment', { fg = palette.gray2, italic = true })
|
vim.api.nvim_set_hl(0, 'Comment', { fg = palette.gray2, italic = true })
|
||||||
vim.api.nvim_set_hl(0, 'Constant', { fg = palette.orange0 })
|
vim.api.nvim_set_hl(0, 'Constant', { fg = palette.orange0 })
|
||||||
@@ -134,7 +139,7 @@ vim.api.nvim_set_hl(0, 'Delimiter', { fg = palette.gray1 })
|
|||||||
vim.api.nvim_set_hl(0, 'Underlined', { fg = palette.yellow1, underline = true })
|
vim.api.nvim_set_hl(0, 'Underlined', { fg = palette.yellow1, underline = true })
|
||||||
vim.api.nvim_set_hl(0, 'Bold', { bold = true })
|
vim.api.nvim_set_hl(0, 'Bold', { bold = true })
|
||||||
vim.api.nvim_set_hl(0, 'Italic', { italic = true })
|
vim.api.nvim_set_hl(0, 'Italic', { italic = true })
|
||||||
vim.api.nvim_set_hl(0, 'Ignore', { link = 'NonText' })
|
-- vim.api.nvim_set_hl(0, 'Ignore', { link = 'NonText' })
|
||||||
vim.api.nvim_set_hl(0, 'Todo', { fg = palette.blue0, bg = palette.blue2, bold = true })
|
vim.api.nvim_set_hl(0, 'Todo', { fg = palette.blue0, bg = palette.blue2, bold = true })
|
||||||
vim.api.nvim_set_hl(0, 'qfLineNr', { link = 'LineNr' })
|
vim.api.nvim_set_hl(0, 'qfLineNr', { link = 'LineNr' })
|
||||||
vim.api.nvim_set_hl(0, 'qfFileName', { link = 'Directory' })
|
vim.api.nvim_set_hl(0, 'qfFileName', { link = 'Directory' })
|
||||||
|
|||||||
+11
-24
@@ -14,20 +14,23 @@ vim.opt.signcolumn = 'yes'
|
|||||||
vim.opt.wrap = false
|
vim.opt.wrap = false
|
||||||
vim.opt.confirm = true
|
vim.opt.confirm = true
|
||||||
|
|
||||||
vim.opt.scrolloff = 15
|
vim.opt.scrolloff = 8
|
||||||
vim.opt.sidescrolloff = 15
|
vim.opt.sidescrolloff = 8
|
||||||
|
|
||||||
vim.opt.tabstop = 2
|
vim.opt.tabstop = 2
|
||||||
vim.opt.shiftwidth = 2
|
vim.opt.shiftwidth = 2
|
||||||
vim.opt.softtabstop = -1
|
vim.opt.softtabstop = -1
|
||||||
vim.opt.expandtab = true
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
vim.opt.autocomplete = true
|
-- vim.opt.autocomplete = true
|
||||||
vim.opt.complete = 'o'
|
-- vim.opt.autocompletedelay = 40
|
||||||
vim.opt.completeopt = { 'fuzzy', 'menu', 'menuone', 'noinsert', 'popup' }
|
-- vim.opt.complete = 'o'
|
||||||
|
-- vim.opt.complete = 'o,.^5,b^3'
|
||||||
|
-- vim.opt.complete = 'o,.,b^3'
|
||||||
|
-- vim.opt.completeopt:append({ 'fuzzy', 'menuone', 'noinsert' })
|
||||||
|
|
||||||
vim.opt.pumheight = 10
|
-- vim.opt.pummaxwidth = 100
|
||||||
vim.opt.pumwidth = 15
|
-- vim.opt.pumheight = 12
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = true,
|
virtual_text = true,
|
||||||
@@ -39,20 +42,4 @@ require('DarthMooMancer.plugins')
|
|||||||
vim.cmd.colorscheme('minikanso-zen')
|
vim.cmd.colorscheme('minikanso-zen')
|
||||||
|
|
||||||
require('DarthMooMancer.keymaps')
|
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',
|
|
||||||
})
|
|
||||||
@@ -14,8 +14,6 @@ map('x', '<leader>p', [["_dP]])
|
|||||||
|
|
||||||
map('n', '<leader>vs', ':vsplit<CR>')
|
map('n', '<leader>vs', ':vsplit<CR>')
|
||||||
map('n', '<leader>ss', ':split<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>E', ':Ex<CR>')
|
map('n', '<leader>E', ':Ex<CR>')
|
||||||
|
|
||||||
@@ -31,31 +29,50 @@ map('n', '<leader>uu', function()
|
|||||||
})
|
})
|
||||||
end, { desc = 'native undotree', silent = true })
|
end, { desc = 'native undotree', silent = true })
|
||||||
|
|
||||||
|
---- Used if mini.pairs is not active
|
||||||
|
-- vim.keymap.set('i', '<CR>', function()
|
||||||
|
-- if vim.fn.pumvisible() == 1 then
|
||||||
|
-- return '<C-e><CR>'
|
||||||
|
-- else
|
||||||
|
-- return '<CR>'
|
||||||
|
-- end
|
||||||
|
-- end, { expr = true, silent = true })
|
||||||
|
|
||||||
|
-- Used if mini.pairs is active
|
||||||
|
vim.keymap.set('i', '<CR>', function()
|
||||||
|
if vim.fn.pumvisible() == 1 then
|
||||||
|
return vim.keycode('<C-E>') .. require('mini.pairs').cr()
|
||||||
|
end
|
||||||
|
return require('mini.pairs').cr()
|
||||||
|
end, { expr = true, replace_keycodes = true, desc = 'Newline, never accept completion' })
|
||||||
|
|
||||||
|
local qf_group = vim.api.nvim_create_augroup('DiagnosticsQuickfix', { clear = true })
|
||||||
|
|
||||||
|
local function set_diagnostics_qf()
|
||||||
|
local items = vim.diagnostic.toqflist(vim.diagnostic.get())
|
||||||
|
vim.fn.setqflist(items, 'r')
|
||||||
|
return #items
|
||||||
|
end
|
||||||
|
|
||||||
map('n', '<leader>xx', function()
|
map('n', '<leader>xx', function()
|
||||||
if vim.fn.getqflist({ winid = 0 }).winid ~= 0 then
|
if vim.fn.getqflist({ winid = 0 }).winid ~= 0 then
|
||||||
vim.cmd('cclose')
|
vim.cmd('cclose')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local items = vim.diagnostic.toqflist(vim.diagnostic.get())
|
if set_diagnostics_qf() == 0 then
|
||||||
if #items == 0 then
|
|
||||||
vim.notify('No diagnostics found', vim.log.levels.WARN)
|
vim.notify('No diagnostics found', vim.log.levels.WARN)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
vim.fn.setqflist(items)
|
|
||||||
vim.cmd('copen')
|
vim.cmd('copen')
|
||||||
end, { desc = 'Toggle diagnostics quickfix' })
|
end, { desc = 'Toggle diagnostics quickfix' })
|
||||||
|
|
||||||
local qf_group = vim.api.nvim_create_augroup('DiagnosticsQuickfix', { clear = true })
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('DiagnosticChanged', {
|
vim.api.nvim_create_autocmd('DiagnosticChanged', {
|
||||||
group = qf_group,
|
group = qf_group,
|
||||||
callback = function()
|
callback = function()
|
||||||
if vim.fn.getqflist({ winid = 0 }).winid == 0 then
|
if vim.fn.getqflist({ winid = 0 }).winid == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local items = vim.diagnostic.toqflist(vim.diagnostic.get())
|
if set_diagnostics_qf() == 0 then
|
||||||
vim.fn.setqflist(items, 'r')
|
|
||||||
if #items == 0 then
|
|
||||||
vim.cmd('cclose')
|
vim.cmd('cclose')
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -0,0 +1,147 @@
|
|||||||
|
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
local capabilities = require('blink.cmp').get_lsp_capabilities(nil, true)
|
||||||
|
vim.lsp.config('*', {
|
||||||
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
|
if capabilities.workspace then
|
||||||
|
capabilities.workspace.didChangeWatchedFiles = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.lsp.config('gopls', {
|
||||||
|
cmd = { 'gopls' },
|
||||||
|
filetypes = { 'go', 'gomod', 'gowork' },
|
||||||
|
root_markers = { { 'go.work' }, { 'go.mod' }, { '.git' } },
|
||||||
|
settings = {
|
||||||
|
gopls = {
|
||||||
|
semanticTokens = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.config('lua_ls', {
|
||||||
|
cmd = { 'lua-language-server' },
|
||||||
|
filetypes = { 'lua' },
|
||||||
|
root_markers = {
|
||||||
|
{ '.emmyrc.json', '.luarc.json', '.luarc.jsonc' },
|
||||||
|
{ '.luacheckrc', '.stylua.toml', 'stylua.toml', 'selene.toml', 'selene.yml' },
|
||||||
|
{ '.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',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.config('clangd', {
|
||||||
|
cmd = { 'clangd' },
|
||||||
|
filetypes = { 'c', 'cpp' },
|
||||||
|
root_markers = {
|
||||||
|
'.clangd',
|
||||||
|
'.clang-tidy',
|
||||||
|
'.clang-format',
|
||||||
|
'compile_commands.json',
|
||||||
|
'compile_flags.txt',
|
||||||
|
'configure.ac',
|
||||||
|
'.git',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.config('html', {
|
||||||
|
cmd = { 'vscode-html-language-server', '--stdio' },
|
||||||
|
filetypes = { 'html' },
|
||||||
|
root_markers = { 'package.json', '.git' },
|
||||||
|
init_options = {
|
||||||
|
provideFormatter = true,
|
||||||
|
embeddedLanguages = { css = true, javascript = true },
|
||||||
|
configurationSection = { 'html', 'css', 'javascript' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.config('vtsls', {
|
||||||
|
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' },
|
||||||
|
{ '.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,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- function _G.DarthMooMancer_omnifunc(findstart, base)
|
||||||
|
-- if findstart == 1 then
|
||||||
|
-- local col = vim.fn.col('.')
|
||||||
|
-- local line = vim.fn.getline('.')
|
||||||
|
-- local before = col > 1 and line:sub(col - 1, col - 1) or ''
|
||||||
|
-- if before == '' or before:match('%s') then
|
||||||
|
-- return -3 -- cancel silently, leave completion mode
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- return vim.lsp.omnifunc(findstart, base)
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
-- callback = function(ev)
|
||||||
|
-- if vim.bo[ev.buf].omnifunc == 'v:lua.vim.lsp.omnifunc' then
|
||||||
|
-- vim.bo[ev.buf].omnifunc = 'v:lua.DarthMooMancer_omnifunc'
|
||||||
|
-- end
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
-- callback = function(ev)
|
||||||
|
-- local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||||
|
-- if client and client:supports_method('textDocument/completion') then
|
||||||
|
-- vim.lsp.completion.enable(true, client.id, ev.buf)
|
||||||
|
-- end
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
vim.lsp.enable({
|
||||||
|
'lua_ls',
|
||||||
|
'clangd',
|
||||||
|
'gopls',
|
||||||
|
'vtsls',
|
||||||
|
'html',
|
||||||
|
})
|
||||||
@@ -3,6 +3,7 @@ vim.pack.add({
|
|||||||
{ src = 'https://github.com/nvim-treesitter/nvim-treesitter' },
|
{ src = 'https://github.com/nvim-treesitter/nvim-treesitter' },
|
||||||
{ src = 'https://github.com/stevearc/conform.nvim' },
|
{ src = 'https://github.com/stevearc/conform.nvim' },
|
||||||
{ src = 'https://github.com/alexghergh/nvim-tmux-navigation' },
|
{ src = 'https://github.com/alexghergh/nvim-tmux-navigation' },
|
||||||
|
{ src = 'https://github.com/saghen/blink.cmp', version = vim.version.range('*') },
|
||||||
})
|
})
|
||||||
|
|
||||||
local parsers = {
|
local parsers = {
|
||||||
@@ -93,8 +94,8 @@ conform.setup({
|
|||||||
cpp = { 'clang-format' },
|
cpp = { 'clang-format' },
|
||||||
go = { 'goimports' },
|
go = { 'goimports' },
|
||||||
|
|
||||||
javascript = { 'prettier', stop_after_first = true },
|
javascript = { 'prettier' },
|
||||||
typescript = { 'prettier', stop_after_first = true },
|
typescript = { 'prettier' },
|
||||||
json = { 'prettier' },
|
json = { 'prettier' },
|
||||||
html = { 'prettier' },
|
html = { 'prettier' },
|
||||||
css = { 'prettier' },
|
css = { 'prettier' },
|
||||||
@@ -117,7 +118,6 @@ vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
|||||||
|
|
||||||
vim.opt.rtp:append('/Users/andrew/personal/Projects/Lua/vern-nvim')
|
vim.opt.rtp:append('/Users/andrew/personal/Projects/Lua/vern-nvim')
|
||||||
require('vern-nvim').setup({
|
require('vern-nvim').setup({
|
||||||
workspace_root = '~/personal/Projects_Testing',
|
|
||||||
env = {
|
env = {
|
||||||
author = 'DarthMooMancer',
|
author = 'DarthMooMancer',
|
||||||
},
|
},
|
||||||
@@ -132,3 +132,15 @@ require('nvim-tmux-navigation').setup({
|
|||||||
right = '<C-l>',
|
right = '<C-l>',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
require('blink.cmp').setup({
|
||||||
|
completion = {
|
||||||
|
documentation = {
|
||||||
|
auto_show = true,
|
||||||
|
auto_show_delay_ms = 50,
|
||||||
|
},
|
||||||
|
menu = {
|
||||||
|
scrollbar = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"plugins": {
|
"plugins": {
|
||||||
|
"blink.cmp": {
|
||||||
|
"rev": "78336bc89ee5365633bcf754d93df01678b5c08f",
|
||||||
|
"src": "https://github.com/saghen/blink.cmp",
|
||||||
|
"version": ">=0.0.0"
|
||||||
|
},
|
||||||
"conform.nvim": {
|
"conform.nvim": {
|
||||||
"rev": "016802de402556da54c36bd7359b441266b01cdd",
|
"rev": "016802de402556da54c36bd7359b441266b01cdd",
|
||||||
"src": "https://github.com/stevearc/conform.nvim"
|
"src": "https://github.com/stevearc/conform.nvim"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
column_width = 100
|
column_width = 100
|
||||||
line_endings = "Unix"
|
# line_endings = "Unix"
|
||||||
indent_type = "Spaces"
|
indent_type = "Spaces"
|
||||||
indent_width = 2
|
indent_width = 2
|
||||||
quote_style = "AutoPreferSingle"
|
quote_style = "AutoPreferSingle"
|
||||||
Reference in new issue
Block a user