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