Update nvim config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 11:25:51 +03:00
parent fbdf0560cf
commit 43c8b90762
8 changed files with 303 additions and 94 deletions

View File

@ -1,6 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
indent_width = 4
quote_style = "AutoPreferDouble"
call_parentheses = "None"

View File

@ -1,29 +1,35 @@
{
"LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" },
"NvChad": { "branch": "v2.5", "commit": "bbc3d43db088c141b142a40cd5f717635833a54e" },
"base46": { "branch": "v2.5", "commit": "40943fc668bf8f1caa4cc45f71c784cf0d3cc34f" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"LuaSnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" },
"NvChad": { "branch": "v2.5", "commit": "f437558f23c8f50c36cd09748121ab2c822e8ec9" },
"base46": { "branch": "v2.5", "commit": "fde7a2cd54599e148d376f82980407c2d24b0fa2" },
"cmp-async-path": { "branch": "main", "commit": "f8af3f726e07f2e9d37672eaa9102581aefce149" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "02fd64fb3d4b18ec029c0e0683c3dc3ec6d2c5b8" },
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
"indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" },
"lazy.nvim": { "branch": "main", "commit": "a44e9cd165e11fa61ccfbea2a3cc1aaa3bcfc4f1" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" },
"minty": { "branch": "main", "commit": "6dce9f097667862537823d515a0250ce58faab05" },
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
"nvim-cmp": { "branch": "main", "commit": "ca4d3330d386e76967e53b85953c170658255ecb" },
"nvim-lspconfig": { "branch": "master", "commit": "2c007c79eedfca0ec652c50d571cb0c52d1577ba" },
"nvim-tree.lua": { "branch": "master", "commit": "ca7c4c33cac2ad66ec69d45e465379716ef0cc97" },
"nvim-treesitter": { "branch": "master", "commit": "acada1a685f5decd0f10e1672963bf3425eafa45" },
"nvim-web-devicons": { "branch": "master", "commit": "203da76ecfbb4b192cf830665b03eb651b635c94" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" },
"ui": { "branch": "v3.0", "commit": "7905539f1e10f460811dc0db800355611f8a527a" },
"volt": { "branch": "main", "commit": "e01090ff27b34288574c24a09cb166e47c4a0c3d" },
"which-key.nvim": { "branch": "main", "commit": "9b365a6428a9633e3eeb34dbef1b791511c54f70" }
"conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"gitsigns.nvim": { "branch": "main", "commit": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519" },
"im-select.nvim": { "branch": "master", "commit": "113a6905a1c95d2990269f96abcbad9718209557" },
"indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
"mdviewer": { "branch": "main", "commit": "80901b3dc68243ce74c31a53239841993902d661" },
"menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" },
"minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" },
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
"nvim-lspconfig": { "branch": "master", "commit": "5a855bcfec7973767a1a472335684bbd71d2fa2b" },
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
"nvim-tree.lua": { "branch": "master", "commit": "e11ce83ed9a00f065bf676ae4e6c261c766989ba" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" },
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"ui": { "branch": "v3.0", "commit": "cb75908a86720172594b30de147272c1b3a7f452" },
"volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}

View File

@ -6,12 +6,58 @@
local M = {}
M.base46 = {
theme = "onedark",
theme = "oceanic-next",
-- hl_override = {
-- Comment = { italic = true },
-- ["@comment"] = { italic = true },
-- },
hl_add = {
St_kbd_en_sep = { fg = "green", bg = "statusline_bg" },
St_kbd_en_icon = { fg = "black", bg = "green", bold = true },
St_kbd_ru_sep = { fg = "orange", bg = "statusline_bg" },
St_kbd_ru_icon = { fg = "black", bg = "orange", bold = true },
},
-- Match VS Code Oceanic Next (naumovs) colors exactly
changed_themes = {
["oceanic-next"] = {
base_30 = {
cyan = "#5FB3B3", -- VS Code: operators/regexp/escape
red = "#EB606B", -- VS Code: tags (NVChad had EC5F67)
},
base_16 = {
base05 = "#CDD3DE", -- foreground text (NVChad had C0C5Ce)
base08 = "#5FB3B3", -- operators/punctuation (NVChad had 6cbdbc)
base0C = "#5FB3B3", -- regexp/escape (NVChad had 5aaeae)
base0F = "#EB606B", -- tags (NVChad had EC5F67)
},
},
},
nvdash = {
load_on_startup = true,
header = {
"██╗ ██╗██╗ ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗",
"██║ ██║██║██╔════╝ ██╔══██╗██╔═══██╗██╔══██╗██╔═══██╗██║ ██║",
"██║ ██║██║██║ ███╗██║ ██║██║ ██║██████╔╝██║ ██║██║ ██║",
"╚██╗ ██╔╝██║██║ ██║██║ ██║██║ ██║██╔══██╗██║ ██║╚██╗ ██╔╝",
" ╚████╔╝ ██║╚██████╔╝██████╔╝╚██████╔╝██║ ██║╚██████╔╝ ╚████╔╝ ",
" ╚═══╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ",
},
},
}
M.ui = {
statusline = {
order = { "mode", "file", "git", "%=", "lsp_msg", "%=", "diagnostics", "lsp", "kbd", "cwd", "cursor" },
modules = {
kbd = function()
local lang = vim.g.im_current_lang or "EN"
if lang == "RU" then
return "%#St_kbd_ru_sep#" .. "" .. "%#St_kbd_ru_icon# 󰌌 RU "
else
return "%#St_kbd_en_sep#" .. "" .. "%#St_kbd_en_icon# 󰌌 EN "
end
end,
},
},
}
return M

View File

@ -1,15 +1,22 @@
local options = {
formatters_by_ft = {
lua = { "stylua" },
-- css = { "prettier" },
-- html = { "prettier" },
},
formatters_by_ft = {
lua = { "stylua" },
css = { "prettier" },
html = { "prettier" },
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
sh = { "prettier" },
},
-- format_on_save = {
-- -- These options will be passed to conform.format()
-- timeout_ms = 500,
-- lsp_fallback = true,
-- },
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
}
return options

View File

@ -1,24 +1,14 @@
-- load defaults i.e lua_lsp
require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig"
-- EXAMPLE
local servers = { "html", "cssls" }
local nvlsp = require "nvchad.configs.lspconfig"
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
}
end
-- configuring single server, example: typescript
-- lspconfig.ts_ls.setup {
-- on_attach = nvlsp.on_attach,
-- on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
-- }
-- Серверы с дефолтными настройками (capabilities и on_init уже заданы через "*")
vim.lsp.enable {
"html",
"cssls",
"ts_ls",
"jsonls",
"yamlls",
"dockerls",
"bashls",
"lua_ls",
"tailwindcss",
}

View File

@ -1,10 +1,68 @@
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
map("n", ";", ":", { desc = "CMD enter command mode" })
map("i", "jk", "<ESC>")
map("i", "jj", "<ESC>")
map("i", "оо", "<ESC>")
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
-- Перемещение строк вверх/вниз в Visual режиме
map("v", "<A-j>", ":m '>+1<CR>gv=gv", { desc = "Move line down" })
map("v", "<A-k>", ":m '<-2<CR>gv=gv", { desc = "Move line up" })
-- Курсор остаётся на месте при объединении строк
map("n", "J", "mzJ`z", { desc = "Join lines keeping cursor" })
-- Центрировать экран при скролле и поиске
map("n", "<C-d>", "<C-d>zz", { desc = "Scroll down centered" })
map("n", "<C-u>", "<C-u>zz", { desc = "Scroll up centered" })
map("n", "n", "nzzzv", { desc = "Next search centered" })
map("n", "N", "Nzzzv", { desc = "Prev search centered" })
-- Вставка поверх выделения без потери буфера
map("x", "<leader>p", '"_dP', { desc = "Paste without yanking" })
-- Быстрое сохранение
map({ "n", "i", "v" }, "<C-s>", "<cmd>w<CR>", { desc = "Save file" })
-- Markdown превью: scroll sync
local mdviewer_sync = vim.api.nvim_create_augroup("MDViewerScrollSync", { clear = true })
local mdviewer_preview_win = nil
local function setup_scroll_sync()
vim.api.nvim_clear_autocmds { group = mdviewer_sync }
vim.api.nvim_create_autocmd("CursorMoved", {
group = mdviewer_sync,
callback = function()
local win = mdviewer_preview_win
if not win or not vim.api.nvim_win_is_valid(win) then return end
local src_line = vim.api.nvim_win_get_cursor(0)[1]
local src_total = vim.api.nvim_buf_line_count(0)
if src_total <= 1 then return end
local ratio = (src_line - 1) / (src_total - 1)
pcall(vim.api.nvim_win_call, win, function()
local term_total = vim.fn.line "$"
if term_total <= 1 then return end
local target = math.max(1, math.floor(ratio * (term_total - 1)) + 1)
vim.cmd("normal! " .. target .. "Gzt")
end)
end,
})
end
map("n", "<leader>mp", function()
vim.cmd "MDViewerToggle"
local preview = require "mdviewer.preview"
if preview.is_active() then
-- После toggle курсор в окне превью — запоминаем его
mdviewer_preview_win = vim.api.nvim_get_current_win()
vim.cmd "wincmd p"
setup_scroll_sync()
else
mdviewer_preview_win = nil
vim.api.nvim_clear_autocmds { group = mdviewer_sync }
end
end, { desc = "Toggle markdown preview" })

View File

@ -1,6 +1,42 @@
require "nvchad.options"
-- add yours here!
local o = vim.o
-- local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!
o.relativenumber = true -- относительные номера строк (5j, 12k)
o.scrolloff = 8 -- курсор не прижимается к краю экрана
o.wrap = false -- длинные строки не переносятся
o.cursorline = true -- подсветка текущей строки
o.swapfile = false -- без .swp файлов
o.clipboard = "unnamedplus" -- yank/delete → системный буфер обмена
-- Русская раскладка: хоткеи работают как на английской
vim.opt.langmap =
"ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,"
.. "фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz"
-- Определение текущей раскладки через im-select (для строки статуса)
vim.g.im_current_lang = "EN"
if vim.fn.executable "im-select" == 1 then
local im_timer = vim.uv.new_timer()
im_timer:start(
0,
1000,
vim.schedule_wrap(function()
vim.fn.jobstart({ "im-select" }, {
stdout_buffered = true,
on_stdout = function(_, data)
if data and data[1] and data[1] ~= "" then
local new_lang = data[1]:find "Russian" and "RU" or "EN"
if vim.g.im_current_lang ~= new_lang then
vim.g.im_current_lang = new_lang
vim.schedule(function()
vim.cmd.redrawstatus()
end)
end
end
end,
})
end)
)
end

View File

@ -1,25 +1,91 @@
return {
{
"stevearc/conform.nvim",
-- event = 'BufWritePre', -- uncomment for format on save
opts = require "configs.conform",
},
{
"stevearc/conform.nvim",
event = "BufWritePre",
opts = require "configs.conform",
},
-- These are some examples, uncomment them if you want to see them work!
{
"neovim/nvim-lspconfig",
config = function()
require "configs.lspconfig"
end,
},
{
"neovim/nvim-lspconfig",
config = function()
require "configs.lspconfig"
end,
},
-- {
-- "nvim-treesitter/nvim-treesitter",
-- opts = {
-- ensure_installed = {
-- "vim", "lua", "vimdoc",
-- "html", "css"
-- },
-- },
-- },
{
"stevearc/dressing.nvim",
lazy = false,
opts = {},
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"vim",
"lua",
"vimdoc",
"html",
"css",
"javascript",
"typescript",
"tsx",
"json",
"yaml",
"toml",
"bash",
"dockerfile",
"markdown",
"markdown_inline",
"gitcommit",
"diff",
},
},
},
-- Автозакрытие HTML/JSX тегов
{
"windwp/nvim-ts-autotag",
event = "InsertEnter",
opts = {},
},
-- Оборачивание текста в скобки/кавычки (ysiw", cs"', ds")
{
"kylechui/nvim-surround",
event = "VeryLazy",
opts = {},
},
-- Подсветка TODO/FIXME/HACK в коде
{
"folke/todo-comments.nvim",
event = "BufRead",
opts = {},
},
-- Автопереключение раскладки: English в Normal, восстановление в Insert
{
"keaising/im-select.nvim",
event = "VimEnter",
opts = {
default_im_select = "com.apple.keylayout.US",
default_command = "im-select",
},
},
-- Просмотр markdown в терминале (mermaid, картинки, таблицы)
{
"aquele-dinho/mdviewer",
ft = "markdown",
config = function()
vim.opt.rtp:append(vim.fn.stdpath "data" .. "/lazy/mdviewer/contrib/neovim/mdviewer.nvim")
require("mdviewer").setup {
style = "clean",
window_type = "vsplit",
auto_refresh = true,
mermaid_mode = "terminal",
}
end,
},
}