20250529.1748531195

This commit is contained in:
fz0x1 2025-05-29 17:06:35 +02:00
parent b5ae1c2bbc
commit 7ede1e15c9
Signed by: fz0x1
GPG key ID: 6F81647BE1B459F4
5 changed files with 119 additions and 115 deletions

View file

@ -0,0 +1,3 @@
vim.bo.shiftwidth = 2
vim.bo.expandtab = true
vim.bo.tabstop = 2

View file

@ -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"

View file

@ -13,6 +13,9 @@ return {
json = { "biome" },
sh = { "shfmt" },
markdown = { "prettier" },
css = { "prettier" },
html = { "prettier" },
htmldjango = { "prettier" },
["*"] = { "trim_whitespace", "codespell" },
},
format_on_save = {

View file

@ -1,9 +1,6 @@
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,
@ -19,96 +16,81 @@ local config = function()
},
})
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",
})
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "gd", function()
vim.lsp.buf.definition()
end, opts)
vim.keymap.set("n", "K", function()
end)
vim.keymap.set("n", "Q", function()
vim.lsp.buf.hover()
end, opts)
end)
vim.keymap.set("n", "<leader>vws", function()
vim.lsp.buf.workspace_symbol()
end, opts)
end)
vim.keymap.set("n", "<leader>vd", function()
vim.diagnostic.open_float()
end, opts)
end)
vim.keymap.set("n", "[d", function()
vim.diagnostic.goto_next()
end, opts)
vim.diagnostic.jump({count=-1, float=true})
end)
vim.keymap.set("n", "]d", function()
vim.diagnostic.goto_prev()
end, opts)
vim.diagnostic.jump({count=-1, float=true})
end)
vim.keymap.set("n", "<leader>ca", function()
vim.lsp.buf.code_action()
end, opts)
end)
vim.keymap.set("n", "<leader>vrr", function()
vim.lsp.buf.references()
end, opts)
end)
vim.keymap.set("n", "<leader>vrn", function()
vim.lsp.buf.rename()
end, opts)
end)
vim.keymap.set("i", "<C-h>", function()
vim.lsp.buf.signature_help()
end, opts)
end)
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)
-- 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)
lsp_zero.set_sign_icons({
error = diagnostic_signs.Error,
warn = diagnostic_signs.Warn,
hint = diagnostic_signs.Hint,
info = diagnostic_signs.Info,
-- 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.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'),
},
},
}
}
})
require("mason").setup({})
require("mason-lspconfig").setup({
ensure_installed = {
"bashls",
"ts_ls",
"pyright",
"lua_ls",
"jsonls",
"clangd",
"biome", -- will install for formatting only
"marksman",
"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()
vim.lsp.config('pyright', {
require("lspconfig").pyright.setup({
settings = {
python = {
@ -118,15 +100,30 @@ local config = function()
},
},
})
end,
biome = function() -- use tsserver instead
return {}
end,
clangd = function()
vim.b.lsp_zero_enable_autoformat = 0
end,
require("lspconfig").marksman.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",
"ts_ls",
"pyright",
"lua_ls",
"jsonls",
"clangd",
"biome", -- will install for formatting only
-- "ruff",
-- "marksman",
},
automatic_enable = {
exclude = { "ruff", "biome" }
}
})
local cmp = require("cmp")
@ -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",

View file

@ -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"'