neovim: cmp tweaks
This commit is contained in:
parent
cae9db14d4
commit
d4d72b615f
3 changed files with 350 additions and 366 deletions
|
@ -1,110 +1,91 @@
|
||||||
local M = {
|
local M = {
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"andersevenrud/cmp-tmux",
|
"andersevenrud/cmp-tmux",
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
"hrsh7th/cmp-buffer",
|
"hrsh7th/cmp-buffer",
|
||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-emoji",
|
||||||
"hrsh7th/cmp-cmdline",
|
"hrsh7th/cmp-path",
|
||||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
"hrsh7th/cmp-cmdline",
|
||||||
"L3MON4D3/LuaSnip",
|
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||||
"onsails/lspkind-nvim",
|
"onsails/lspkind-nvim",
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip",
|
||||||
},
|
},
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.config()
|
function M.config()
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
local luasnip = require("luasnip")
|
|
||||||
|
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
cmp.setup({
|
vim.o.completeopt = "menuone,noselect"
|
||||||
formatting = {
|
|
||||||
format = require("lspkind").cmp_format({
|
|
||||||
with_text = true,
|
|
||||||
menu = {
|
|
||||||
buffer = "[Buffer]",
|
|
||||||
tmux = "[Tmux]",
|
|
||||||
luasnip = "[LuaSnip]",
|
|
||||||
nvim_lsp = "[LSP]",
|
|
||||||
nvim_lua = "[Lua]",
|
|
||||||
path = "[Path]",
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
|
|
||||||
window = {
|
cmp.setup({
|
||||||
completion = cmp.config.window.bordered({
|
completion = {
|
||||||
winhighlight = "Normal:PMenu,FloatBorder:PMenuBorder,CursorLine:PMenuSel,Search:None",
|
completeopt = "menu,menuone,noinsert",
|
||||||
}),
|
},
|
||||||
documentation = cmp.config.window.bordered({
|
|
||||||
winhighlight = "Normal:PMenu,FloatBorder:PMenu,CursorLine:PMenuSel,Search:None",
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
|
|
||||||
snippet = {
|
formatting = {
|
||||||
expand = function(args)
|
format = require("lspkind").cmp_format(),
|
||||||
luasnip.lsp_expand(args.body)
|
},
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
mapping = {
|
window = {
|
||||||
["<Up>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
completion = cmp.config.window.bordered({
|
||||||
["<Down>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
winhighlight = "Normal:PMenu,FloatBorder:PMenuBorder,CursorLine:PMenuSel,Search:None",
|
||||||
["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
}),
|
||||||
["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
documentation = cmp.config.window.bordered({
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
winhighlight = "Normal:PMenu,FloatBorder:PMenu,CursorLine:PMenuSel,Search:None",
|
||||||
["<C-u>"] = cmp.mapping.scroll_docs(4),
|
}),
|
||||||
["<C-e>"] = cmp.mapping({
|
},
|
||||||
i = cmp.mapping.abort(),
|
|
||||||
c = cmp.mapping.close(),
|
|
||||||
}),
|
|
||||||
["<CR>"] = cmp.mapping(cmp.mapping.confirm({ select = false }), { "i", "c" }),
|
|
||||||
["<C-y>"] = cmp.mapping(cmp.mapping.confirm({ select = false }), { "i", "c" }),
|
|
||||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip.expand_or_locally_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip.jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = cmp.config.sources({
|
snippet = {
|
||||||
{ name = "buffer", priority = 1 },
|
expand = function(args)
|
||||||
{ name = "luasnip", priority = 4 },
|
require("luasnip").lsp_expand(args.body)
|
||||||
{ name = "copilot", group_index = 5 },
|
end,
|
||||||
{
|
},
|
||||||
name = "tmux",
|
|
||||||
priority = 2,
|
mapping = {
|
||||||
option = {
|
["<Up>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||||
all_panes = true,
|
["<Down>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||||
trigger_characters = {},
|
["<C-d>"] = cmp.mapping.scroll_docs(-2),
|
||||||
},
|
["<C-u>"] = cmp.mapping.scroll_docs(2),
|
||||||
},
|
["<C-e>"] = cmp.mapping({
|
||||||
{ name = "nvim_lsp", priority = 3 },
|
i = cmp.mapping.abort(),
|
||||||
{ name = "nvim_lsp_signature_help", priority = 4 },
|
c = cmp.mapping.close(),
|
||||||
}),
|
}),
|
||||||
})
|
-- ["<CR>"] = cmp.mapping(cmp.mapping.confirm({ select = false }), { "i", "c" }),
|
||||||
|
-- ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||||
|
["<CR>"] = cmp.mapping(cmp.mapping.confirm({ select = true })),
|
||||||
|
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), {}),
|
||||||
|
},
|
||||||
|
|
||||||
|
-- experimental = {
|
||||||
|
-- ghost_text = {
|
||||||
|
-- hl_group = "LspCodeLens",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "nvim_lsp_signature_help" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "copilot" },
|
||||||
|
{
|
||||||
|
name = "tmux",
|
||||||
|
priority = 2,
|
||||||
|
option = {
|
||||||
|
all_panes = true,
|
||||||
|
trigger_characters = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ name = "emoji" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,239 +1,239 @@
|
||||||
local M = {
|
local M = {
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.config()
|
function M.config()
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
vim.keymap.set("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
|
vim.keymap.set("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
|
||||||
vim.keymap.set("i", "<C-k>", "<Cmd>lua vim.lsp.buf.signature_help()<CR>")
|
vim.keymap.set("i", "<C-k>", "<Cmd>lua vim.lsp.buf.signature_help()<CR>")
|
||||||
vim.keymap.set("n", "1gd", "<Cmd>lua vim.lsp.buf.type_definition()<CR>")
|
vim.keymap.set("n", "1gd", "<Cmd>lua vim.lsp.buf.type_definition()<CR>")
|
||||||
vim.keymap.set("n", "gf", "<Cmd>lua vim.lsp.buf.format()<CR>")
|
vim.keymap.set("n", "gf", "<Cmd>lua vim.lsp.buf.format()<CR>")
|
||||||
vim.keymap.set("n", "rn", "<Cmd>lua vim.lsp.buf.rename()<CR>")
|
vim.keymap.set("n", "rn", "<Cmd>lua vim.lsp.buf.rename()<CR>")
|
||||||
vim.keymap.set("n", "[d", "<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>")
|
vim.keymap.set("n", "[d", "<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>")
|
||||||
vim.keymap.set("n", "]d", "<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>")
|
vim.keymap.set("n", "]d", "<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>")
|
||||||
vim.keymap.set("n", "gwa", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
|
vim.keymap.set("n", "gwa", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
|
||||||
vim.keymap.set("n", "gwr", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
|
vim.keymap.set("n", "gwr", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
|
||||||
vim.keymap.set("n", "gwl", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
|
vim.keymap.set("n", "gwl", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
|
||||||
|
|
||||||
vim.cmd([[autocmd BufWritePre * lua vim.lsp.buf.format({sync = true})]])
|
vim.cmd([[autocmd BufWritePre * lua vim.lsp.buf.format({sync = true})]])
|
||||||
|
|
||||||
local border = {
|
local border = {
|
||||||
{ "🭽", "FloatBorder" },
|
{ "🭽", "FloatBorder" },
|
||||||
{ "▔", "FloatBorder" },
|
{ "▔", "FloatBorder" },
|
||||||
{ "🭾", "FloatBorder" },
|
{ "🭾", "FloatBorder" },
|
||||||
{ "▕", "FloatBorder" },
|
{ "▕", "FloatBorder" },
|
||||||
{ "🭿", "FloatBorder" },
|
{ "🭿", "FloatBorder" },
|
||||||
{ "▁", "FloatBorder" },
|
{ "▁", "FloatBorder" },
|
||||||
{ "🭼", "FloatBorder" },
|
{ "🭼", "FloatBorder" },
|
||||||
{ "▏", "FloatBorder" },
|
{ "▏", "FloatBorder" },
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
||||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
local signs = { Error = "🔥", Warn = "⚠️ ", Hint = "💡", Info = "💡" }
|
local signs = { Error = "🔥", Warn = "⚠️ ", Hint = "💡", Info = "💡" }
|
||||||
for type, icon in pairs(signs) do
|
for type, icon in pairs(signs) do
|
||||||
local hl = "DiagnosticSign" .. type
|
local hl = "DiagnosticSign" .. type
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_attach(client, bufnr)
|
local function on_attach(client, bufnr)
|
||||||
require("nvim-navic").attach(client, bufnr)
|
require("nvim-navic").attach(client, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- simple setups --
|
-- simple setups --
|
||||||
local servers = {
|
local servers = {
|
||||||
"bashls",
|
"bashls",
|
||||||
"dockerls",
|
"dockerls",
|
||||||
"gopls",
|
"gopls",
|
||||||
"jsonls",
|
"jsonls",
|
||||||
-- "sql",
|
-- "sql",
|
||||||
"pyright",
|
"pyright",
|
||||||
"sumneko_lua",
|
"sumneko_lua",
|
||||||
"terraformls",
|
"terraformls",
|
||||||
"yamlls",
|
"yamlls",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
lspconfig[lsp].setup({ on_attach = on_attach })
|
lspconfig[lsp].setup({ on_attach = on_attach })
|
||||||
end
|
end
|
||||||
|
|
||||||
local efm_prettier = {
|
local efm_prettier = {
|
||||||
formatCommand = "prettier --stdin-filepath ${INPUT}",
|
formatCommand = "prettier --stdin-filepath ${INPUT}",
|
||||||
formatStdin = true,
|
formatStdin = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
lspconfig.gopls.setup({
|
lspconfig.gopls.setup({
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
settings = {
|
settings = {
|
||||||
gopls = {
|
gopls = {
|
||||||
directoryFilters = {
|
directoryFilters = {
|
||||||
"-bazel-bin",
|
"-bazel-bin",
|
||||||
"-bazel-out",
|
"-bazel-out",
|
||||||
"-bazel-testlogs",
|
"-bazel-testlogs",
|
||||||
"-proto",
|
"-proto",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig.sumneko_lua.setup({
|
lspconfig.sumneko_lua.setup({
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
on_attach(client, bufnr)
|
on_attach(client, bufnr)
|
||||||
vim.cmd([[autocmd BufWritePre <buffer> lua require'stylua-nvim'.format_file()]])
|
vim.cmd([[autocmd BufWritePre <buffer> lua require'stylua-nvim'.format_file()]])
|
||||||
end,
|
end,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
completion = { kewordSnippet = "Disable" },
|
completion = { kewordSnippet = "Disable" },
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
enable = true,
|
enable = true,
|
||||||
globals = { "renoise", "use", "vim" },
|
globals = { "renoise", "use", "vim" },
|
||||||
},
|
},
|
||||||
runtime = {
|
runtime = {
|
||||||
version = "LuaJIT",
|
version = "LuaJIT",
|
||||||
path = { "?.lua", "?/init.lua", "?/?.lua" },
|
path = { "?.lua", "?/init.lua", "?/?.lua" },
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
library = vim.api.nvim_get_runtime_file("", true),
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
maxPreload = 2000,
|
maxPreload = 2000,
|
||||||
preloadFileSize = 1000,
|
preloadFileSize = 1000,
|
||||||
checkThirdParty = false,
|
checkThirdParty = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig.terraformls.setup({})
|
lspconfig.terraformls.setup({})
|
||||||
|
|
||||||
local yaml_is_k8s = function(bufnr)
|
local yaml_is_k8s = function(bufnr)
|
||||||
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, 50, false) -- Stop after the first 50 lines
|
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, 50, false) -- Stop after the first 50 lines
|
||||||
for _, l in pairs(lines) do
|
for _, l in pairs(lines) do
|
||||||
if string.find(l, "apiVersion") ~= nil then
|
if string.find(l, "apiVersion") ~= nil then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig.cssls.setup({
|
lspconfig.cssls.setup({
|
||||||
cmd = { "vscode-css-languageserver", "--stdio" },
|
cmd = { "vscode-css-languageserver", "--stdio" },
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig.cssmodules_ls.setup({})
|
lspconfig.cssmodules_ls.setup({})
|
||||||
|
|
||||||
lspconfig.html.setup({
|
lspconfig.html.setup({
|
||||||
cmd = { "vscode-html-languageserver", "--stdio" },
|
cmd = { "vscode-html-languageserver", "--stdio" },
|
||||||
filetypes = { "html" },
|
filetypes = { "html" },
|
||||||
init_options = {
|
init_options = {
|
||||||
configurationSection = { "html", "css", "javascript" },
|
configurationSection = { "html", "css", "javascript" },
|
||||||
embeddedLanguages = {
|
embeddedLanguages = {
|
||||||
css = true,
|
css = true,
|
||||||
javascript = true,
|
javascript = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
settings = {},
|
settings = {},
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig.yamlls.setup({
|
lspconfig.yamlls.setup({
|
||||||
settings = {
|
settings = {
|
||||||
yaml = {
|
yaml = {
|
||||||
format = { enable = true, singleQuote = true },
|
format = { enable = true, singleQuote = true },
|
||||||
schemaStore = { enable = true, url = "https://json.schemastore.org" },
|
schemaStore = { enable = true, url = "https://json.schemastore.org" },
|
||||||
schemas = {
|
schemas = {
|
||||||
-- ["https://json.schemastore.org/github-workflow"] = "*.github/workflows/*",
|
-- ["https://json.schemastore.org/github-workflow"] = "*.github/workflows/*",
|
||||||
["https://json.schemastore.org/kustomization.json"] = "kustomization.yaml",
|
["https://json.schemastore.org/kustomization.json"] = "kustomization.yaml",
|
||||||
-- ["https://json.schemastore.org/ansible-role-2.9.json"] = "*/tasks/*.y*ml",
|
-- ["https://json.schemastore.org/ansible-role-2.9.json"] = "*/tasks/*.y*ml",
|
||||||
kubernetes = {
|
kubernetes = {
|
||||||
"clusterrolebinding.yaml",
|
"clusterrolebinding.yaml",
|
||||||
"clusterrole-contour.yaml",
|
"clusterrole-contour.yaml",
|
||||||
"clusterrole.yaml",
|
"clusterrole.yaml",
|
||||||
"configmap.yaml",
|
"configmap.yaml",
|
||||||
"cronjob.yaml",
|
"cronjob.yaml",
|
||||||
"daemonset.yaml",
|
"daemonset.yaml",
|
||||||
"deployment-*.yaml",
|
"deployment-*.yaml",
|
||||||
"deployment.yaml",
|
"deployment.yaml",
|
||||||
"*-deployment.yaml",
|
"*-deployment.yaml",
|
||||||
"hpa.yaml",
|
"hpa.yaml",
|
||||||
"ingress.yaml",
|
"ingress.yaml",
|
||||||
"job.yaml",
|
"job.yaml",
|
||||||
"namespace.yaml",
|
"namespace.yaml",
|
||||||
"pvc.yaml",
|
"pvc.yaml",
|
||||||
"rbac.yaml",
|
"rbac.yaml",
|
||||||
"rolebinding.yaml",
|
"rolebinding.yaml",
|
||||||
"role.yaml",
|
"role.yaml",
|
||||||
"sa.yaml",
|
"sa.yaml",
|
||||||
"secret.yaml",
|
"secret.yaml",
|
||||||
"serviceaccounts.yaml",
|
"serviceaccounts.yaml",
|
||||||
"service-account.yaml",
|
"service-account.yaml",
|
||||||
"serviceaccount.yaml",
|
"serviceaccount.yaml",
|
||||||
"service-*.yaml",
|
"service-*.yaml",
|
||||||
"service.yaml",
|
"service.yaml",
|
||||||
"*-service.yaml",
|
"*-service.yaml",
|
||||||
"statefulset.yaml",
|
"statefulset.yaml",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
validate = true,
|
validate = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
require("lspconfig").tsserver.setup({})
|
require("lspconfig").tsserver.setup({})
|
||||||
|
|
||||||
-- npm install -g typescript typescript-language-server
|
-- npm install -g typescript typescript-language-server
|
||||||
-- require("lspconfig").tsserver.setup({
|
-- require("lspconfig").tsserver.setup({
|
||||||
-- on_attach = function(client, bufnr)
|
-- on_attach = function(client, bufnr)
|
||||||
-- client.resolved_capabilities.document_formatting = false
|
-- client.resolved_capabilities.document_formatting = false
|
||||||
-- on_attach(client)
|
-- on_attach(client)
|
||||||
|
|
||||||
-- local ts_utils = require("nvim-lsp-ts-utils")
|
-- local ts_utils = require("nvim-lsp-ts-utils")
|
||||||
|
|
||||||
-- ts_utils.setup({
|
-- ts_utils.setup({
|
||||||
-- debug = false,
|
-- debug = false,
|
||||||
-- disable_commands = false,
|
-- disable_commands = false,
|
||||||
-- enable_import_on_completion = false,
|
-- enable_import_on_completion = false,
|
||||||
-- import_all_timeout = 5000, -- ms
|
-- import_all_timeout = 5000, -- ms
|
||||||
|
|
||||||
-- -- eslint
|
-- -- eslint
|
||||||
-- eslint_enable_code_actions = true,
|
-- eslint_enable_code_actions = true,
|
||||||
-- eslint_enable_disable_comments = true,
|
-- eslint_enable_disable_comments = true,
|
||||||
-- eslint_bin = "eslint_d",
|
-- eslint_bin = "eslint_d",
|
||||||
-- eslint_config_fallback = nil,
|
-- eslint_config_fallback = nil,
|
||||||
-- eslint_enable_diagnostics = true,
|
-- eslint_enable_diagnostics = true,
|
||||||
|
|
||||||
-- -- formatting
|
-- -- formatting
|
||||||
-- enable_formatting = true,
|
-- enable_formatting = true,
|
||||||
-- formatter = "prettier",
|
-- formatter = "prettier",
|
||||||
-- formatter_config_fallback = nil,
|
-- formatter_config_fallback = nil,
|
||||||
|
|
||||||
-- -- parentheses completion
|
-- -- parentheses completion
|
||||||
-- complete_parens = false,
|
-- complete_parens = false,
|
||||||
-- signature_help_in_parens = false,
|
-- signature_help_in_parens = false,
|
||||||
|
|
||||||
-- -- update imports on file move
|
-- -- update imports on file move
|
||||||
-- update_imports_on_move = true,
|
-- update_imports_on_move = true,
|
||||||
-- require_confirmation_on_move = true,
|
-- require_confirmation_on_move = true,
|
||||||
-- watch_dir = nil,
|
-- watch_dir = nil,
|
||||||
-- })
|
-- })
|
||||||
|
|
||||||
-- ts_utils.setup_client(client)
|
-- ts_utils.setup_client(client)
|
||||||
|
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>co", ":TSLspOrganize<CR>", { silent = true })
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>co", ":TSLspOrganize<CR>", { silent = true })
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "qq", ":TSLspFixCurrent<CR>", { silent = true })
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "qq", ":TSLspFixCurrent<CR>", { silent = true })
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>cR", ":TSLspRenameFile<CR>", { silent = true })
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>cR", ":TSLspRenameFile<CR>", { silent = true })
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>ci", ":TSLspImportAll<CR>", { silent = true })
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>ci", ":TSLspImportAll<CR>", { silent = true })
|
||||||
-- end,
|
-- end,
|
||||||
-- })
|
-- })
|
||||||
--
|
--
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,78 +1,81 @@
|
||||||
local M = {
|
local M = {
|
||||||
"mcchrish/zenbones.nvim",
|
"mcchrish/zenbones.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"rktjmp/lush.nvim",
|
"rktjmp/lush.nvim",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.config()
|
function M.config()
|
||||||
vim.g.zenbones = {
|
vim.g.zenbones = {
|
||||||
style = "light",
|
style = "light",
|
||||||
lightness = "bright",
|
lightness = "bright",
|
||||||
colorize_diagnostic_underline_text = true,
|
colorize_diagnostic_underline_text = true,
|
||||||
transparent_background = true,
|
transparent_background = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
local lush = require("lush")
|
local lush = require("lush")
|
||||||
local base = require("zenbones")
|
local base = require("zenbones")
|
||||||
|
|
||||||
-- Create some specs
|
-- Create some specs
|
||||||
---@diagnostic disable = undefined-global
|
---@diagnostic disable = undefined-global
|
||||||
local specs = lush.parse(function()
|
local specs = lush.parse(function()
|
||||||
return {
|
return {
|
||||||
CursorLine({ bg = "#f5f5f0" }),
|
CursorLine({ bg = "#f5f5f0" }),
|
||||||
Error({ fg = "#d9534f" }),
|
Error({ fg = "#d9534f" }),
|
||||||
CursorLineNr({ fg = "#BCAAA4", bg = "#f5f5f0" }),
|
CursorLineNr({ fg = "#BCAAA4", bg = "#f5f5f0" }),
|
||||||
MsgArea({ fg = "#A1887F", bg = "#f1f1f1" }),
|
MsgArea({ fg = "#A1887F", bg = "#f1f1f1" }),
|
||||||
String({ fg = "#2E7D32", gui = "italic" }),
|
String({ fg = "#2E7D32", gui = "italic" }),
|
||||||
Comment({ fg = "#114499", gui = "bold,italic" }),
|
Comment({ fg = "#114499", gui = "bold,italic" }),
|
||||||
CopilotSuggestion({ fg = "#0066cc", gui = "bold,italic" }),
|
CopilotSuggestion({ fg = "#0066cc", gui = "bold,italic" }),
|
||||||
LineNr({ fg = "#9FA8AC", gui = "bold,italic" }),
|
LineNr({ fg = "#9FA8AC", gui = "bold,italic" }),
|
||||||
LineNrAbove({ fg = "#9F080C", gui = "bold,italic" }),
|
LineNrAbove({ fg = "#9F080C", gui = "bold,italic" }),
|
||||||
Indent1({ fg = "#DFDF9A", gui = "italic" }),
|
Indent1({ fg = "#DFDF9A", gui = "italic" }),
|
||||||
Indent2({ fg = "#BAE1FF", gui = "italic" }),
|
Indent2({ fg = "#BAE1FF", gui = "italic" }),
|
||||||
Indent3({ fg = "#BAFFC9", gui = "italic" }),
|
Indent3({ fg = "#BAFFC9", gui = "italic" }),
|
||||||
Indent4({ fg = "#FFB3BA", gui = "italic" }),
|
Indent4({ fg = "#FFB3BA", gui = "italic" }),
|
||||||
Indent5({ fg = "#FFDFBA", gui = "italic" }),
|
Indent5({ fg = "#FFDFBA", gui = "italic" }),
|
||||||
Indent6({ fg = "#F3E5F5", gui = "italic" }),
|
Indent6({ fg = "#F3E5F5", gui = "italic" }),
|
||||||
NormalFloat({ bg = "#FFF9C4" }),
|
NormalFloat({ bg = "#FFF9C4" }),
|
||||||
FloatBorder({ fg = "#FFB74D", bg = "#FFF9C4" }),
|
FloatBorder({ fg = "#FFB74D", bg = "#FFF9C4" }),
|
||||||
TelescopeNormal({ bg = "#EFEBE9" }),
|
TelescopeNormal({ bg = "#EFEBE9" }),
|
||||||
TelescopeBorder({ fg = "#A1887F", bg = "#EFEBE9" }),
|
TelescopeBorder({ fg = "#A1887F", bg = "#EFEBE9" }),
|
||||||
TelescopeSelection({ fg = "#FFFFFF", bg = "#1976D2" }),
|
TelescopeSelection({ fg = "#FFFFFF", bg = "#1976D2" }),
|
||||||
DiagnosticSignError({ fg = "#ff2200", bg = "#fff5ff", gui = "bold" }),
|
DiagnosticSignError({ fg = "#ff2200", bg = "#fff5ff", gui = "bold" }),
|
||||||
DiagnosticVirtualTextInfo({ fg = "#0033bb", bg = "#f7fcff", gui = "bold,italic" }),
|
DiagnosticVirtualTextInfo({ fg = "#0033bb", bg = "#f7fcff", gui = "bold,italic" }),
|
||||||
DiagnosticVirtualTextWarn({ fg = "#bb2200", bg = "#fff9f3", gui = "bold,italic" }),
|
DiagnosticVirtualTextWarn({ fg = "#bb2200", bg = "#fff9f3", gui = "bold,italic" }),
|
||||||
DiagnosticVirtualTextError({ fg = "#ff2200", bg = "#fff5f3", gui = "italic" }),
|
DiagnosticVirtualTextError({ fg = "#ff2200", bg = "#fff5f3", gui = "italic" }),
|
||||||
DiagnosticUnderlineError({ fg = "#ff0000", gui = "undercurl" }),
|
DiagnosticUnderlineError({ fg = "#ff0000", gui = "undercurl" }),
|
||||||
DiagnosticUnderlineWarn({ fg = "#ff7700", gui = "undercurl" }),
|
DiagnosticUnderlineWarn({ fg = "#ff7700", gui = "undercurl" }),
|
||||||
DiagnosticUnderlineInfo({ fg = "#3366cc", gui = "undercurl" }),
|
DiagnosticUnderlineInfo({ fg = "#3366cc", gui = "undercurl" }),
|
||||||
MarkSignHL({ fg = "#009688", bg = "#E0F7FA" }),
|
MarkSignHL({ fg = "#009688", bg = "#E0F7FA" }),
|
||||||
MarkSignNumHL({ fg = "#B2DFDB", bg = "#E0F7FA" }),
|
MarkSignNumHL({ fg = "#B2DFDB", bg = "#E0F7FA" }),
|
||||||
GitSignsAdd({ fg = "#81C784" }),
|
GitSignsAdd({ fg = "#81C784" }),
|
||||||
GitSignsAddNr({ fg = "#C8E6C9" }),
|
GitSignsAddNr({ fg = "#C8E6C9" }),
|
||||||
GitSignsDelete({ fg = "#E53935" }),
|
GitSignsDelete({ fg = "#E53935" }),
|
||||||
GitSignsDeleteNr({ fg = "#FFCDD2" }),
|
GitSignsDeleteNr({ fg = "#FFCDD2" }),
|
||||||
GitSignsChange({ fg = "#FFA726" }),
|
GitSignsChange({ fg = "#FFA726" }),
|
||||||
GitSignsChangeNr({ fg = "#FFE0B2" }),
|
GitSignsChangeNr({ fg = "#FFE0B2" }),
|
||||||
|
|
||||||
PMenu({ bg = "#F7F5F0" }),
|
-- LspCodeLens({ fg = "#00ff00", gui = "undercurl" }),
|
||||||
PMenuBorder({ bg = "#F7F5F0", fg = "#886622" }),
|
-- LspSignatureActiveParameter({ fg = "#ff0000", bg = "#ffffcc" }),
|
||||||
PMenuSel({ fg = "#FFFFFF", bg = "#1976D2" }),
|
|
||||||
PMenuSbar({ bg = "#90CAF9" }),
|
|
||||||
PMenuThumb({ bg = "#64B5F6" }),
|
|
||||||
StatusLine({ base = base.VertSplit, fg = "#BCAAA4" }),
|
|
||||||
StatusLineNC({ base = base.VertSplit, fg = "#BCAAA4" }),
|
|
||||||
|
|
||||||
TreesitterContext({ bg = "#f0f0f0", fg = "#BCAAA4", gui = "bold,italic" }),
|
PMenu({ bg = "#F7F5F0" }),
|
||||||
TreesitterContextLineNumber({ bg = "#f0f0f0", fg = "#979770", gui = "bold,italic" }),
|
PMenuBorder({ bg = "#F7F5F0", fg = "#886622" }),
|
||||||
}
|
PMenuSel({ fg = "#FFFFFF", bg = "#1976D2" }),
|
||||||
end)
|
PMenuSbar({ bg = "#90CAF9" }),
|
||||||
|
PMenuThumb({ bg = "#64B5F6" }),
|
||||||
|
StatusLine({ base = base.VertSplit, fg = "#BCAAA4" }),
|
||||||
|
StatusLineNC({ base = base.VertSplit, fg = "#BCAAA4" }),
|
||||||
|
|
||||||
-- Apply specs using lush tool-chain
|
TreesitterContext({ bg = "#f0f0f0", fg = "#BCAAA4", gui = "bold,italic" }),
|
||||||
vim.cmd("colorscheme zenbones")
|
TreesitterContextLineNumber({ bg = "#f0f0f0", fg = "#979770", gui = "bold,italic" }),
|
||||||
lush.apply(lush.compile(specs))
|
}
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Apply specs using lush tool-chain
|
||||||
|
vim.cmd("colorscheme zenbones")
|
||||||
|
lush.apply(lush.compile(specs))
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Reference in a new issue