20250529.1748531195
This commit is contained in:
parent
b5ae1c2bbc
commit
7ede1e15c9
5 changed files with 119 additions and 115 deletions
3
global/.config/nvim/ftplugin/html.lua
Normal file
3
global/.config/nvim/ftplugin/html.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.bo.shiftwidth = 2
|
||||
vim.bo.expandtab = true
|
||||
vim.bo.tabstop = 2
|
|
@ -68,7 +68,7 @@ opt.clipboard:append("unnamedplus")
|
|||
opt.modifiable = true
|
||||
opt.encoding = "UTF-8"
|
||||
opt.fileencoding = "utf-8"
|
||||
opt.cursorline = false
|
||||
opt.cursorline = true
|
||||
|
||||
-- spell
|
||||
opt.spelllang = "en_us,ru"
|
||||
|
|
|
@ -13,6 +13,9 @@ return {
|
|||
json = { "biome" },
|
||||
sh = { "shfmt" },
|
||||
markdown = { "prettier" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
htmldjango = { "prettier" },
|
||||
["*"] = { "trim_whitespace", "codespell" },
|
||||
},
|
||||
format_on_save = {
|
||||
|
|
|
@ -1,85 +1,114 @@
|
|||
local config = function()
|
||||
local lsp_zero = require("lsp-zero")
|
||||
local luasnip = require("luasnip")
|
||||
local diagnostic_signs = require("utils.icons").diagnostic_signs
|
||||
|
||||
lsp_zero.on_attach(function(_, bufnr)
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false, -- disable virtual text
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = true,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = true,
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false, -- disable virtual text
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = true,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = true,
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "rounded",
|
||||
})
|
||||
vim.keymap.set("n", "gd", function()
|
||||
vim.lsp.buf.definition()
|
||||
end)
|
||||
vim.keymap.set("n", "Q", function()
|
||||
vim.lsp.buf.hover()
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>vws", function()
|
||||
vim.lsp.buf.workspace_symbol()
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>vd", function()
|
||||
vim.diagnostic.open_float()
|
||||
end)
|
||||
vim.keymap.set("n", "[d", function()
|
||||
vim.diagnostic.jump({count=-1, float=true})
|
||||
end)
|
||||
vim.keymap.set("n", "]d", function()
|
||||
vim.diagnostic.jump({count=-1, float=true})
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>ca", function()
|
||||
vim.lsp.buf.code_action()
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>vrr", function()
|
||||
vim.lsp.buf.references()
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>vrn", function()
|
||||
vim.lsp.buf.rename()
|
||||
end)
|
||||
vim.keymap.set("i", "<C-h>", function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>gi", function()
|
||||
vim.lsp.buf.implementation()
|
||||
end)
|
||||
-- nvim-lint
|
||||
-- vim.keymap.set("n", "<leader>li", function()
|
||||
-- require("lint").try_lint()
|
||||
-- end)
|
||||
-- conform
|
||||
-- vim.keymap.set("n", "<leader>fr", function()
|
||||
-- require("conform").format({ bufnr = bufnr })
|
||||
-- end)
|
||||
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
-- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
-- border = "rounded",
|
||||
-- })
|
||||
--
|
||||
-- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
-- border = "rounded",
|
||||
-- })
|
||||
|
||||
vim.keymap.set("n", "gd", function()
|
||||
vim.lsp.buf.definition()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "K", function()
|
||||
vim.lsp.buf.hover()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>vws", function()
|
||||
vim.lsp.buf.workspace_symbol()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>vd", function()
|
||||
vim.diagnostic.open_float()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "[d", function()
|
||||
vim.diagnostic.goto_next()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "]d", function()
|
||||
vim.diagnostic.goto_prev()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>ca", function()
|
||||
vim.lsp.buf.code_action()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", function()
|
||||
vim.lsp.buf.references()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", function()
|
||||
vim.lsp.buf.rename()
|
||||
end, opts)
|
||||
vim.keymap.set("i", "<C-h>", function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>gi", function()
|
||||
vim.lsp.buf.implementation()
|
||||
end, opts)
|
||||
-- nvim-lint
|
||||
vim.keymap.set("n", "<leader>li", function()
|
||||
require("lint").try_lint()
|
||||
end, opts)
|
||||
-- conform
|
||||
vim.keymap.set("n", "<leader>fr", function()
|
||||
require("conform").format({ bufnr = bufnr })
|
||||
end, opts)
|
||||
end)
|
||||
vim.lsp.config('lua_ls', {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim'}
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
vim.env.VIMRUNTIME,
|
||||
vim.fn.stdpath('config'),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
lsp_zero.set_sign_icons({
|
||||
error = diagnostic_signs.Error,
|
||||
warn = diagnostic_signs.Warn,
|
||||
hint = diagnostic_signs.Hint,
|
||||
info = diagnostic_signs.Info,
|
||||
})
|
||||
vim.lsp.config('pyright', {
|
||||
require("lspconfig").pyright.setup({
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
typeCheckingMode = "off",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
require("mason").setup({})
|
||||
-- vim.lsp.config('clangd', {
|
||||
-- require("lspconfig").clangd.setup({
|
||||
-- vim.b.lsp_zero_enable_autoformat = 0
|
||||
-- })
|
||||
-- })
|
||||
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"bashls",
|
||||
|
@ -89,45 +118,13 @@ local config = function()
|
|||
"jsonls",
|
||||
"clangd",
|
||||
"biome", -- will install for formatting only
|
||||
"marksman",
|
||||
"ruff",
|
||||
-- "ruff",
|
||||
-- "marksman",
|
||||
},
|
||||
automatic_installation = true,
|
||||
handlers = {
|
||||
-- lsp_zero.default_setup,
|
||||
-- https://github.com/neovim/nvim-lspconfig/pull/3232
|
||||
function(server_name)
|
||||
if server_name == "tsserver" then
|
||||
server_name = "ts_ls"
|
||||
else
|
||||
lsp_zero.default_setup(server_name)
|
||||
end
|
||||
end,
|
||||
lua_ls = function()
|
||||
local lua_opts = lsp_zero.nvim_lua_ls()
|
||||
require("lspconfig").lua_ls.setup(lua_opts)
|
||||
end,
|
||||
pyright = function()
|
||||
require("lspconfig").pyright.setup({
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
typeCheckingMode = "off",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
biome = function() -- use tsserver instead
|
||||
return {}
|
||||
end,
|
||||
clangd = function()
|
||||
vim.b.lsp_zero_enable_autoformat = 0
|
||||
end,
|
||||
require("lspconfig").marksman.setup({}),
|
||||
},
|
||||
})
|
||||
automatic_enable = {
|
||||
exclude = { "ruff", "biome" }
|
||||
}
|
||||
})
|
||||
|
||||
local cmp = require("cmp")
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
|
@ -151,7 +148,7 @@ local config = function()
|
|||
{ name = "nvim_lua" },
|
||||
{ name = "buffer" },
|
||||
},
|
||||
formatting = lsp_zero.cmp_format(),
|
||||
-- formatting = lsp_zero.cmp_format(),
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
["<Tab>"] = cmp.mapping.select_next_item(cmp_select),
|
||||
|
@ -178,14 +175,12 @@ local config = function()
|
|||
end
|
||||
|
||||
return {
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v3.x",
|
||||
"neovim/nvim-lspconfig",
|
||||
config = config,
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
|
|
|
@ -15,6 +15,9 @@ set -g default-terminal tmux-256color
|
|||
set -sa terminal-features ',alacritty:RGB'
|
||||
set -ga terminal-overrides ",*256col*:Tc"
|
||||
|
||||
|
||||
set -g pane-active-border-style 'fg=orange'
|
||||
|
||||
# reset gpg-agent password cache after close the pane (vimwiki diary)
|
||||
set-hook -g window-unlinked 'run-shell "gpgconf --reload gpg-agent"'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue