Update nvim config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@ -1,17 +1,63 @@
|
||||
-- This file needs to have same structure as nvconfig.lua
|
||||
-- This file needs to have same structure as nvconfig.lua
|
||||
-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua
|
||||
-- Please read that file to know all available options :(
|
||||
-- Please read that file to know all available options :(
|
||||
|
||||
---@type ChadrcConfig
|
||||
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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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",
|
||||
}
|
||||
|
||||
@ -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" })
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user