29.05.2025

This commit is contained in:
Alexander Neonxp Kiryukhin 2025-05-29 14:53:31 +03:00
parent cefce84f5e
commit ed137a15ff
Signed by: NeonXP
SSH key fingerprint: SHA256:SVt7TjxbVc87m1QYaQziOJ0N3OCFURv2g76gD/UTTXI
28 changed files with 552 additions and 420 deletions

View file

@ -121,31 +121,6 @@ vim.api.nvim_create_autocmd({ "BufWritePost" }, {
end,
})
-- Автоматический вход в insert mode при открытии терминала
vim.api.nvim_create_autocmd({ "BufWinEnter", "WinEnter" }, {
pattern = "term://*",
callback = function()
vim.cmd("startinsert")
end,
})
-- Автоматический выход из insert mode при уходе с терминала
vim.api.nvim_create_autocmd("BufLeave", {
pattern = "term://*",
callback = function()
vim.cmd("stopinsert")
end,
})
vim.api.nvim_create_autocmd({ "BufReadPost", "BufWinEnter", "WinEnter" }, {
pattern = "*",
callback = function(args)
-- Проверяем, что это не терминальный буфер
if not vim.startswith(vim.api.nvim_buf_get_name(args.buf), "term://") then
vim.cmd("normal zR") -- Развернуть все складки
end
end,
})
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function(data)
local directory = vim.fn.isdirectory(data.file) == 1
@ -175,12 +150,12 @@ vim.api.nvim_create_autocmd("VimResized", {
end,
})
-- vim.api.nvim_create_autocmd("InsertEnter", {
-- pattern = "*",
-- command = "set norelativenumber",
-- })
--
-- vim.api.nvim_create_autocmd("InsertLeave", {
-- pattern = "*",
-- callback = "set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz",
-- })
vim.api.nvim_create_autocmd("InsertEnter", {
pattern = "*",
command = "set norelativenumber",
})
vim.api.nvim_create_autocmd("InsertLeave", {
pattern = "*",
command = "set relativenumber",
})

View file

@ -41,8 +41,6 @@ end
-- }}}
kmap("n", "<leader>tt", ":split<CR>:terminal<CR>:startinsert<CR>", { noremap = true, silent = true })
-- {{{ LSP функции
kmap("n", "d[", vim.diagnostic.goto_prev, { noremap = true, silent = true, desc = "Previous diagnostic" })
kmap("n", "d]", vim.diagnostic.goto_next, { noremap = true, silent = true, desc = "Next diagnostic" })

View file

@ -1,128 +0,0 @@
local modules = require('lualine_require').lazy_require { notices = 'lualine.utils.notices' }
local function add_notice(notice)
modules.notices.add_notice('theme(base16): ' .. notice)
end
local function setup(colors)
local theme = {
normal = {
a = { fg = colors.bg, bg = colors.normal },
b = { fg = colors.light_fg, bg = colors.alt_bg },
c = { fg = colors.fg, bg = colors.bg },
},
replace = {
a = { fg = colors.bg, bg = colors.replace },
b = { fg = colors.light_fg, bg = colors.alt_bg },
},
insert = {
a = { fg = colors.bg, bg = colors.insert },
b = { fg = colors.light_fg, bg = colors.alt_bg },
},
visual = {
a = { fg = colors.bg, bg = colors.visual },
b = { fg = colors.light_fg, bg = colors.alt_bg },
},
inactive = {
a = { fg = colors.dark_fg, bg = colors.bg },
b = { fg = colors.dark_fg, bg = colors.bg },
c = { fg = colors.dark_fg, bg = colors.bg },
},
}
theme.command = theme.normal
theme.terminal = theme.insert
return theme
end
local function setup_default()
return setup {
bg = '#282a2e',
alt_bg = '#373b41',
dark_fg = '#969896',
fg = '#b4b7b4',
light_fg = '#c5c8c6',
normal = '#81a2be',
insert = '#b5bd68',
visual = '#b294bb',
replace = '#de935f',
}
end
local function setup_base16_nvim()
-- Continue to load nvim-base16
local loaded, base16 = pcall(require, 'base16-colorscheme')
if not loaded then
add_notice(
'nvim-base16 is not currently present in your runtimepath, make sure it is properly installed,'
.. ' fallback to default colors.'
)
return nil
end
if not base16.colors and not vim.env.BASE16_THEME then
add_notice(
'nvim-base16 is not loaded yet, you should update your configuration to load it before lualine'
.. ' so that the colors from your colorscheme can be used, fallback to "tomorrow-night" theme.'
)
elseif not base16.colors and not base16.colorschemes[vim.env.BASE16_THEME] then
add_notice(
'The colorscheme "%s" defined by the environment variable "BASE16_THEME" is not handled by'
.. ' nvim-base16, fallback to "tomorrow-night" theme.'
)
end
local colors = base16.colors or base16.colorschemes[vim.env.BASE16_THEME or 'tomorrow-night']
return setup {
bg = colors.base01,
alt_bg = colors.base02,
dark_fg = colors.base03,
fg = colors.base04,
light_fg = colors.base05,
normal = colors.base0D,
insert = colors.base0B,
visual = colors.base0E,
replace = colors.base09,
}
end
local function setup_base16_vim()
-- Check if tinted-theming/base16-vim is already loaded
if vim.g.base16_gui00 and vim.g.base16_gui0F then
return setup {
bg = vim.g.base16_gui01,
alt_bg = vim.g.base16_gui02,
dark_fg = vim.g.base16_gui03,
fg = vim.g.base16_gui04,
light_fg = vim.g.base16_gui05,
normal = vim.g.base16_gui0D,
insert = vim.g.base16_gui0B,
visual = vim.g.base16_gui0E,
replace = vim.g.base16_gui09,
}
end
-- base16-vim has been renamed to tinted-vim along with colors
-- context: https://github.com/nvim-lualine/lualine.nvim/pull/1352
if vim.g.tinted_gui00 and vim.g.tinted_gui0F then
return setup {
bg = vim.g.tinted_gui01,
alt_bg = vim.g.tinted_gui02,
dark_fg = vim.g.tinted_gui03,
fg = vim.g.tinted_gui04,
light_fg = vim.g.tinted_gui05,
normal = vim.g.tinted_gui0D,
insert = vim.g.tinted_gui0B,
visual = vim.g.tinted_gui0E,
replace = vim.g.tinted_gui09,
}
end
return nil
end
return setup_base16_vim() or setup_base16_nvim() or setup_default()

View file

@ -0,0 +1,97 @@
local M = {}
M.setup = function(opts) end
M.isRightMost = function()
local curWin = vim.fn.winnr()
vim.cmd([[wincmd l]])
local rightWin = vim.fn.winnr()
if curWin == rightWin then
return true
else
vim.cmd([[wincmd h]])
return false
end
end
M.isLeftMost = function()
local curWin = vim.fn.winnr()
vim.cmd([[wincmd h]])
local leftWin = vim.fn.winnr()
if curWin == leftWin then
return true
else
vim.cmd([[wincmd l]])
return false
end
end
M.isBottomMost = function()
local curWin = vim.fn.winnr()
vim.cmd([[wincmd j]])
local bottomWin = vim.fn.winnr()
if curWin == bottomWin then
return true
else
vim.cmd([[wincmd k]])
return false
end
end
M.isTopMost = function()
local curWin = vim.fn.winnr()
vim.cmd([[wincmd k]])
local topWin = vim.fn.winnr()
if curWin == topWin then
return true
else
vim.cmd([[wincmd j]])
return false
end
end
M.ResizeLeft = function()
if M.isRightMost() then
if not M.isLeftMost() then
vim.cmd([[wincmd 5 >]])
end
else
vim.cmd([[wincmd 5 <]])
end
end
M.ResizeRight = function()
if M.isRightMost() then
if not M.isLeftMost() then
vim.cmd([[wincmd 5 <]])
end
else
vim.cmd([[wincmd 5 >]])
end
end
M.ResizeUp = function()
if M.isBottomMost() then
if not M.isTopMost() then
vim.cmd([[wincmd 5 +]])
else
vim.cmd([[wincmd 5 -]])
end
else
vim.cmd([[wincmd 5 -]])
end
end
M.ResizeDown = function()
if M.isBottomMost() then
if not M.isTopMost() then
vim.cmd([[wincmd 5 -]])
else
vim.cmd([[wincmd 5 +]])
end
else
vim.cmd([[wincmd 5 +]])
end
end
return M

View file

@ -8,7 +8,7 @@ local options = {
hidden = true,
hlsearch = true,
ignorecase = true,
mouse = "a",
mouse = "",
pumheight = 10,
showmode = false,
showtabline = 2,
@ -25,7 +25,7 @@ local options = {
tabstop = 4,
cursorline = true,
number = true,
-- relativenumber = true,
relativenumber = true,
numberwidth = 4,
signcolumn = "yes",
wrap = true,
@ -35,8 +35,10 @@ local options = {
foldenable = false,
scrolloff = 999,
so = vim.fn.floor(vim.fn.winheight(0) / 2),
guicursor = "n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50,i:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175",
guicursor = "n-v-c:block,i-ci-ve:hor10,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175",
langmap = "ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯЖ;ABCDEFGHIJKLMNOPQRSTUVWXYZ:,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz",
spelllang = "en,ru_yo",
spell = true,
}
vim.opt.formatoptions:append({ r = true, o = true })
vim.opt.shortmess:append("c")

View file

@ -6,75 +6,50 @@ require("lazy").setup({
},
{ "neovim/nvim-lspconfig" },
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
--@module "ibl"
--@type ibl.config
config = true,
},
{
"lukas-reineke/headlines.nvim",
dependencies = "nvim-treesitter/nvim-treesitter",
config = true,
},
{
"mfussenegger/nvim-dap",
},
{
"ray-x/lsp_signature.nvim",
event = "VeryLazy",
"arnarg/todotxt.nvim",
dependencies = { "MunifTanjim/nui.nvim" },
opts = {
doc_lines = 1,
max_height = 3,
hint_prefix = "",
hint_prefix = {
above = "",
current = "",
below = "",
},
floating_window = true,
todo_file = "~/Документы/todo.txt",
},
},
{
"nvimdev/lspsaga.nvim",
opts = {
lightbulb = {
enable = false,
},
},
},
{
"karb94/neoscroll.nvim",
opts = {
stop_eof = false,
respect_scrolloff = true,
mappings = {
"<C-u>",
"<C-d>",
"<C-b>",
"<C-f>",
"<C-y>",
"<C-e>",
"zt",
"zz",
"zb",
},
},
name = "resize",
dir = "~/.config/nvim/lua/myplugins",
keys = {
{
"<PageUp>",
"<C-S-Left>",
function()
require("neoscroll").scroll(-vim.api.nvim_win_get_height(0) + 3, { duration = 150 })
require("myplugins.resize").ResizeLeft()
end,
silent = true,
},
{
"<PageDown>",
"<C-S-Right>",
function()
require("neoscroll").scroll(vim.api.nvim_win_get_height(0) - 3, { duration = 150 })
require("myplugins.resize").ResizeRight()
end,
silent = true,
},
{
"<C-S-Up>",
function()
require("myplugins.resize").ResizeUp()
end,
silent = true,
},
{
"<C-S-Down>",
function()
require("myplugins.resize").ResizeDown()
end,
silent = true,
},
},
},
require("plugins.blankline"),
require("plugins.headlines"),
require("plugins.lsp_saga"),
require("plugins.lsp_signature"),
require("plugins.autosave"),
require("plugins.cmp"),
require("plugins.treesitter"),
@ -82,6 +57,7 @@ require("lazy").setup({
require("plugins.conform"),
require("plugins.dapui"),
require("plugins.dap"),
require("plugins.dap_go"),
require("plugins.go"),
require("plugins.goimpl"),
require("plugins.lualine"),

View file

@ -0,0 +1,7 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
--@module "ibl"
--@type ibl.config
config = true,
}

View file

@ -1,158 +1,3 @@
local default_config = {
delve = {
path = "dlv",
initialize_timeout_sec = 20,
port = "${port}",
args = {},
build_flags = "",
-- Automatically handle the issue on delve Windows versions < 1.24.0
-- where delve needs to be run in attched mode or it will fail (actually crashes).
detached = vim.fn.has("win32") == 0,
output_mode = "remote",
},
tests = {
verbose = false,
},
}
local function setup_go_configuration(dap, configs)
local common_debug_configs = {
{
type = "go",
name = "Debug",
request = "launch",
program = "${workspaceFolder}",
args = {},
buildFlags = configs.delve.build_flags,
outputMode = configs.delve.output_mode,
},
}
if dap.configurations.go == nil then
dap.configurations.go = {}
end
for _, config in ipairs(common_debug_configs) do
table.insert(dap.configurations.go, config)
end
if configs == nil or configs.dap_configurations == nil then
return
end
for _, config in ipairs(configs.dap_configurations) do
if config.type == "go" then
table.insert(dap.configurations.go, config)
end
end
end
return {
"leoluz/nvim-dap-go",
dependencies = { "mfussenegger/nvim-dap" },
opts = true,
config = function()
local dap, dapui = require("dap"), require("dapui")
dap.adapters.go = {
type = "server",
port = "${port}",
executable = {
command = "dlv",
args = { "dap", "-l", "127.0.0.1:${port}" },
},
}
setup_go_configuration(dap, default_config)
dap.defaults.fallback.terminal_win_cmd = "enew | set filetype=dap-terminal"
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end
vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" })
vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" })
vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" })
vim.fn.sign_define(
"DapBreakpoint",
{ text = "!", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapBreakpointCondition",
{ text = "?", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapBreakpointRejected",
{ text = "RJ", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapLogPoint",
{ text = "i", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" }
)
vim.fn.sign_define(
"DapStopped",
{ text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
)
end,
keys = {
{
"<F5>",
function()
require("dap").continue()
end,
silent = true,
},
{
"<F17>", -- S-F5
function()
require("dap").restart()
end,
silent = true,
},
{
"<F29>", -- C-F5
function()
require("dap").terminate()
end,
silent = true,
},
{
"<F8>",
function()
require("dap").step_over()
end,
silent = true,
},
{
"<F7>",
function()
require("dap").step_into()
end,
silent = true,
},
{
"<F19>", -- S-F7
function()
require("dap").step_out()
end,
silent = true,
},
{
"<A-b>",
function()
require("dap").toggle_breakpoint()
end,
silent = true,
},
},
"mfussenegger/nvim-dap",
}

159
nvim/lua/plugins/dap_go.lua Normal file
View file

@ -0,0 +1,159 @@
local default_config = {
delve = {
path = "dlv",
initialize_timeout_sec = 20,
port = "${port}",
args = {},
build_flags = "",
-- Automatically handle the issue on delve Windows versions < 1.24.0
-- where delve needs to be run in attched mode or it will fail (actually crashes).
detached = vim.fn.has("win32") == 0,
output_mode = "remote",
cwd = nil,
},
tests = {
verbose = false,
},
}
local function setup_go_configuration(dap, configs)
local common_debug_configs = {
{
type = "go",
name = "Debug",
request = "launch",
program = "${workspaceFolder}",
args = {},
buildFlags = configs.delve.build_flags,
outputMode = configs.delve.output_mode,
},
}
if dap.configurations.go == nil then
dap.configurations.go = {}
end
for _, config in ipairs(common_debug_configs) do
table.insert(dap.configurations.go, config)
end
if configs == nil or configs.dap_configurations == nil then
return
end
for _, config in ipairs(configs.dap_configurations) do
if config.type == "go" then
table.insert(dap.configurations.go, config)
end
end
end
return {
"leoluz/nvim-dap-go",
dependencies = { "mfussenegger/nvim-dap" },
opts = true,
config = function()
local dap, dapui = require("dap"), require("dapui")
dap.adapters.go = {
type = "server",
port = "${port}",
executable = {
command = "dlv",
args = { "dap", "-l", "127.0.0.1:${port}" },
},
}
setup_go_configuration(dap, default_config)
dap.defaults.fallback.terminal_win_cmd = "enew | set filetype=dap-terminal"
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end
vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" })
vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" })
vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" })
vim.fn.sign_define(
"DapBreakpoint",
{ text = "!", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapBreakpointCondition",
{ text = "?", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapBreakpointRejected",
{ text = "RJ", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapLogPoint",
{ text = "i", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" }
)
vim.fn.sign_define(
"DapStopped",
{ text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
)
end,
keys = {
{
"<F5>",
function()
require("dap").continue()
end,
silent = true,
},
{
"<F17>", -- S-F5
function()
require("dap").restart()
end,
silent = true,
},
{
"<F29>", -- C-F5
function()
require("dap").terminate()
end,
silent = true,
},
{
"<F8>",
function()
require("dap").step_over()
end,
silent = true,
},
{
"<F7>",
function()
require("dap").step_into()
end,
silent = true,
},
{
"<F19>", -- S-F7
function()
require("dap").step_out()
end,
silent = true,
},
{
"<A-b>",
function()
require("dap").toggle_breakpoint()
end,
silent = true,
},
},
}

View file

@ -52,8 +52,6 @@ return {
{
elements = {
"repl",
"breakpoints",
"scopes",
},
size = 0.3,
position = "bottom",

View file

@ -0,0 +1,5 @@
return {
"lukas-reineke/headlines.nvim",
dependencies = "nvim-treesitter/nvim-treesitter",
config = true,
}

View file

@ -0,0 +1,8 @@
return {
"nvimdev/lspsaga.nvim",
opts = {
lightbulb = {
enable = false,
},
},
}

View file

@ -0,0 +1,15 @@
return {
"ray-x/lsp_signature.nvim",
event = "VeryLazy",
opts = {
doc_lines = 1,
max_height = 3,
hint_prefix = "",
hint_prefix = {
above = "",
current = "",
below = "",
},
floating_window = true,
},
}

View file

@ -1,5 +1,4 @@
local HEIGHT_RATIO = 0.8
local WIDTH_RATIO = 0.5
local WIDTH_RATIO = 0.25
return {
"nvim-tree/nvim-tree.lua",
@ -9,36 +8,10 @@ return {
opts = {
disable_netrw = true,
hijack_netrw = true,
hijack_directories = {
enable = true,
auto_open = true,
},
sort = {
sorter = "case_sensitive",
},
view = {
-- width = 30,
float = {
enable = true,
open_win_config = function()
local screen_w = vim.opt.columns:get()
local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get()
local window_w = screen_w * WIDTH_RATIO
local window_h = screen_h * HEIGHT_RATIO
local window_w_int = math.floor(window_w)
local window_h_int = math.floor(window_h)
local center_x = (screen_w - window_w) / 2
local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get()
return {
border = "rounded",
relative = "editor",
row = center_y,
col = center_x,
width = window_w_int,
height = window_h_int,
}
end,
},
width = function()
return math.floor(vim.opt.columns:get() * WIDTH_RATIO)
end,
@ -60,11 +33,8 @@ return {
filters = {
dotfiles = false,
},
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = {
enable = true,
update_root = true,
},
},
keys = {

View file

@ -7,7 +7,7 @@ return {
additional_vim_regex_highlighting = false,
},
ensure_installed = "all",
ignore_install = { "gdhsader", "phpdoc" },
ignore_install = { "gdhsader", "phpdoc", "org" },
indent = { enable = true },
auto_install = true,
sync_install = true,