Перешел на lazy nvim, навел порядок в плагинах

This commit is contained in:
Alexander Neonxp Kiryukhin 2025-05-02 16:05:47 +03:00
parent 91873ed81a
commit 446d2716e7
Signed by: NeonXP
SSH key fingerprint: SHA256:SVt7TjxbVc87m1QYaQziOJ0N3OCFURv2g76gD/UTTXI
25 changed files with 790 additions and 469 deletions

View file

@ -124,7 +124,16 @@ vim.api.nvim_create_autocmd({ "BufReadPost", "BufWinEnter", "WinEnter" }, {
end
end,
})
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function(data)
local directory = vim.fn.isdirectory(data.file) == 1
if not directory then
return
end
vim.cmd.cd(data.file)
require("nvim-tree.api").tree.open()
end,
})
-- vim.api.nvim_create_autocmd("InsertEnter", {
-- pattern = "*",
-- command = "set norelativenumber",

View file

@ -1,39 +0,0 @@
require("onedark").setup({
style = "darker",
transparent = false, -- Show/hide background
term_colors = true, -- Change terminal color as per the selected theme style
ending_tildes = true, -- Show the end-of-buffer tildes. By default they are hidden
cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu
-- toggle theme style ---
toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts"
toggle_style_list = { "dark", "darker", "cool", "deep", "warm", "warmer", "light" }, -- List of styles to toggle between
-- Change code style ---
-- Options are italic, bold, underline, none
-- You can configure multiple style with comma separated, For e.g., keywords = 'italic,bold'
code_style = {
comments = "italic",
keywords = "none",
functions = "none",
strings = "none",
variables = "none",
},
-- Lualine options --
lualine = {
transparent = false, -- lualine center bar transparency
},
-- Custom Highlights --
colors = {}, -- Override default colors
highlights = {}, -- Override highlight groups
-- Plugins Config --
diagnostics = {
darker = true, -- darker colors for diagnostic
undercurl = true, -- use undercurl instead of underline for diagnostics
background = true, -- use background color for virtual text
},
})
require("onedark").load()

View file

@ -19,15 +19,16 @@ map("v", "K", ":m '<-2<CR>gv=gv", { noremap = true, silent = true })
map("v", "<", "<gv", { noremap = true, silent = true })
map("v", ">", ">gv", { noremap = true, silent = true })
-- Управление буферами --
-- {{{ Управление буферами --
kmap("n", "<leader>bn", "<cmd>bnext<CR>", { noremap = true, silent = true, desc = "Next buffer" })
kmap("n", "<leader>bp", "<cmd>bprevious<CR>", { noremap = true, silent = true, desc = "Previous buffer" })
kmap("n", "<leader>bd", "<cmd>bdelete<CR>", { noremap = true, silent = true, desc = "Delete buffer" })
kmap("n", "<leader>w", "<cmd>wa<CR>", { noremap = true, silent = true, desc = "Save all files" })
kmap("n", "qq", "<cmd>q<CR>", { noremap = true, silent = true, desc = "Exit" })
kmap("n", "<leader>vs", "<cmd>vsplit<CR>", { noremap = true, silent = true, desc = "Vertical split" })
-- }}}
-- Управление вкладками --
-- {{{ Управление вкладками --
kmap("n", "<A-Right>", ":tabnext<CR>", { noremap = true, silent = true, desc = "Next tab" })
kmap("n", "<A-Left>", ":tabprevious<CR>", { noremap = true, silent = true, desc = "Previous tab" })
kmap("n", "<leader>tn", ":tabnew<CR>", { noremap = true, silent = true, desc = "New tab" })
@ -38,116 +39,51 @@ for i = 1, 9 do
kmap("n", "<A-" .. i .. ">", ":tabn " .. i .. "<CR>", { noremap = true, silent = true, desc = "Go to tab " .. i })
end
-- Файловый менеджер --
kmap("n", "<F3>", ":NvimTreeToggle<CR>", { noremap = true, silent = true, desc = "Toggle file tree" })
-- kmap("n", "<leader>tt", ":NvimTreeToggle<CR>", { noremap = true, silent = true, desc = "Toggle file tree" })
-- }}}
kmap("n", "<leader>tt", ":split<CR>:terminal<CR>:startinsert<CR>", { noremap = true, silent = true })
-- Поиск с Telescope --
kmap("n", "<leader>ff", "<cmd>Telescope find_files<CR>", { noremap = true, silent = true, desc = "Find files" })
kmap("n", "<leader>fg", "<cmd>Telescope live_grep<CR>", { noremap = true, silent = true, desc = "Live grep" })
kmap("n", "<leader>fb", "<cmd>Telescope buffers<CR>", { noremap = true, silent = true, desc = "Find buffers" })
kmap("n", "<leader>fe", "<cmd>Telescope file_browser<CR>", { noremap = true, silent = true, desc = "File browser" })
-- LSP функции --
-- {{{ LSP функции
kmap("n", "<leader>e", vim.diagnostic.open_float, { noremap = true, silent = true, desc = "Show diagnostics" })
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" })
kmap("n", "gD", vim.lsp.buf.declaration, { noremap = true, silent = true, desc = "Go to declaration" })
kmap("n", "gd", vim.lsp.buf.definition, { noremap = true, silent = true, desc = "Go to definition" })
kmap("n", "K", vim.lsp.buf.hover, { noremap = true, silent = true, desc = "Show documentation" })
kmap("n", "gi", vim.lsp.buf.implementation, { noremap = true, silent = true, desc = "Go to implementation" })
kmap("n", "<C-k>", vim.lsp.buf.signature_help, { noremap = true, silent = true, desc = "Signature help" })
kmap(
"n",
"<leader>wa",
vim.lsp.buf.add_workspace_folder,
{ noremap = true, silent = true, desc = "Add workspace folder" }
)
kmap(
"n",
"<leader>wr",
vim.lsp.buf.remove_workspace_folder,
{ noremap = true, silent = true, desc = "Remove workspace folder" }
)
kmap("n", "<leader>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, { noremap = true, silent = true, desc = "List workspace folders" })
kmap("n", "<leader>D", vim.lsp.buf.type_definition, { noremap = true, silent = true, desc = "Type definition" })
kmap("n", "<leader>rn", vim.lsp.buf.rename, { noremap = true, silent = true, desc = "Rename symbol" })
kmap("n", "<leader>ca", vim.lsp.buf.code_action, { noremap = true, silent = true, desc = "Code actions" })
kmap("n", "<A-CR>", vim.lsp.buf.code_action, { noremap = true, silent = true, desc = "Code actions" })
kmap("n", "gr", vim.lsp.buf.references, { noremap = true, silent = true, desc = "Find references" })
-- Отладка (DAP) --
kmap("n", "<F9>", "<cmd>lua require'dapui'.toggle()<CR>", { noremap = true, silent = true, desc = "Toggle debug UI" })
kmap("n", "<F5>", function()
require("dap").continue()
end)
kmap("n", "<F10>", function()
require("dap").step_over()
end)
kmap("n", "<F11>", function()
require("dap").step_into()
end)
kmap("n", "<F12>", function()
require("dap").step_out()
end)
kmap(
"n",
"<leader>dt",
"<cmd>lua require'dapui'.toggle()<CR>",
{ noremap = true, silent = true, desc = "Toggle debug UI" }
)
kmap("n", "<leader>dc", function()
require("dap").continue()
end)
kmap("n", "<leader>so", function()
require("dap").step_over()
end)
kmap("n", "<leader>si", function()
require("dap").step_into()
end)
kmap("n", "<leader>st", function()
require("dap").step_out()
end)
kmap("n", "<F2>", vim.lsp.buf.rename, { noremap = true, silent = true, desc = "Rename symbol" })
kmap("n", "<Leader>b", function()
require("dap").toggle_breakpoint()
end)
kmap("n", "<Leader>B", function()
require("dap").set_breakpoint()
end)
kmap("n", "<Leader>lp", function()
require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message: "))
end)
kmap("n", "<Leader>dr", function()
require("dap").repl.open()
end)
kmap("n", "<Leader>dl", function()
require("dap").run_last()
end)
kmap({ "n", "v" }, "<Leader>dh", function()
require("dap.ui.widgets").hover()
end)
kmap({ "n", "v" }, "<Leader>dp", function()
require("dap.ui.widgets").preview()
end)
kmap("n", "<Leader>df", function()
local widgets = require("dap.ui.widgets")
widgets.centered_float(widgets.frames)
end)
kmap("n", "<Leader>ds", function()
local widgets = require("dap.ui.widgets")
widgets.centered_float(widgets.scopes)
end)
-- Кастомная функция для NvimTree --
local function change_root_to_global_cwd()
local api = require("nvim-tree.api")
local global_cwd = vim.fn.getcwd(-1, -1)
api.tree.change_root(global_cwd)
end
kmap("n", "<C-c>", change_root_to_global_cwd, { noremap = true, silent = true, desc = "Change tree root to CWD" })
-- }}}

View file

@ -1,48 +1,10 @@
local cmp = require('cmp')
local source_mapping = {
buffer = '[Buffer]',
nvim_lsp = '[LSP]',
nvim_lua = '[Lua]',
cmp_tabnine = '[TN]',
path = '[Path]',
}
cmp.setup({
mapping = cmp.mapping.preset.insert({
['<C-y>'] = cmp.mapping.confirm({ select = true }),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-u>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
}),
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
formatting = {
format = function(entry, vim_item)
local menu = source_mapping[entry.source.name]
vim_item.menu = menu
return vim_item
end
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
}, {
{ name = 'buffer' },
})
})
-- инициализация LSP для различных ЯП
local lspconfig = require('lspconfig')
local util = require('lspconfig/util')
local lspconfig = require("lspconfig")
local util = require("lspconfig/util")
local function config(_config)
return vim.tbl_deep_extend('force', {
capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()),
return vim.tbl_deep_extend("force", {
capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
}, _config or {})
end
@ -50,9 +12,9 @@ end
-- https://github.com/golang/tools/blob/master/gopls/doc/vim.md#neovim-install
lspconfig.gopls.setup(config({
on_attach = on_attach,
cmd = { 'gopls', 'serve' },
filetypes = { 'go', 'go.mod' },
root_dir = util.root_pattern('go.work', 'go.mod', '.git'),
cmd = { "gopls", "serve" },
filetypes = { "go", "go.mod" },
root_dir = util.root_pattern("go.work", "go.mod", ".git"),
settings = {
gopls = {
analyses = {
@ -60,6 +22,6 @@ lspconfig.gopls.setup(config({
shadow = true,
},
staticcheck = true,
}
}
},
},
}))

View file

@ -1,6 +1,3 @@
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
local options = {
backup = false,
clipboard = "unnamedplus",
@ -35,9 +32,10 @@ local options = {
scrolloff = 8,
sidescrolloff = 8,
syntax = "on",
foldmethod = "expr",
foldexpr = "nvim_treesitter#foldexpr()",
foldlevelstart = 99,
foldmethod = "marker",
foldmarker = "{{{,}}}",
--foldexpr = "nvim_treesitter#foldexpr()",
foldlevelstart = 0,
foldenable = true,
}

54
nvim/lua/plugins.lua Normal file
View file

@ -0,0 +1,54 @@
local plugins = {
{ "nvim-lua/plenary.nvim" },
{ "neovim/nvim-lspconfig" },
{ "Snyssfx/goerr-nvim" },
{
"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",
config = true,
},
require("plugins.cmp"),
require("plugins.onedark"),
require("plugins.treesitter"),
require("plugins.tree"),
require("plugins.conform"),
require("plugins.dapui"),
require("plugins.dap"),
require("plugins.go"),
require("plugins.goimpl"),
require("plugins.lualine"),
require("plugins.telescope"),
require("plugins.columns"),
}
require("lazy").setup(plugins, {
performance = {
rtp = {
disabled_plugins = {
"gzip",
"matchit",
"matchparen",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View file

@ -1,39 +1,69 @@
local cmp = require'cmp'
cmp.setup{
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
-- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
-- For `mini.snippets` users:
-- local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert
-- insert({ body = args.body }) -- Insert at cursor
-- cmp.resubscribe({ "TextChangedI", "TextChangedP" })
-- require("cmp.config").set_onetime({ sources = {} })
end,
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip",
{
"L3MON4D3/LuaSnip",
lazy = true,
version = "v2.*",
build = "make install_jsregexp",
opts = {
history = true,
delete_check_events = "TextChanged",
},
dependencies = { "rafamadriz/friendly-snippets" },
config = function()
require("plugins.snippets")
end,
},
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
})
config = function()
local cmp = require("cmp")
local source_mapping = {
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
path = "[Path]",
}
cmp.setup({
mapping = cmp.mapping.preset.insert({
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
formatting = {
format = function(entry, vim_item)
vim_item.menu = source_mapping[entry.source.name] or "[Unknown]"
return vim_item
end,
},
sources = cmp.config.sources({
{ name = "nvim_lsp", priority = 1000 },
{ name = "luasnip", priority = 750 },
{ name = "path", priority = 500 },
}, {
{ name = "buffer" },
}),
})
end,
}

View file

@ -0,0 +1,10 @@
return {
"m4xshen/smartcolumn.nvim",
opts = {
colorcolumn = "80",
disabled_filetypes = { "help", "text" },
custom_colorcolumn = {},
scope = "file",
editorconfig = true,
},
}

View file

@ -0,0 +1,34 @@
return {
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
go = { "gofmt" },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 500,
},
},
keys = {
{
"<leader>mp",
function()
require("conform").format({ lsp_fallback = true, async = false, timeout_ms = 500 })
end,
desc = "Format file or range (in visual mode)",
},
},
}

View file

@ -1,9 +1,153 @@
require("dap-go").setup()
require("dap").adapters.go = {
type = "server",
port = "${port}",
executable = {
command = "dlv",
args = { "dap", "-l", "127.0.0.1:${port}" },
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}" },
},
}
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 = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapLogPoint",
{ text = "", 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,
},
{
"<F10>",
function()
require("dap").step_over()
end,
silent = true,
},
{
"<F11>",
function()
require("dap").step_into()
end,
silent = true,
},
{
"<F12>",
function()
require("dap").step_out()
end,
silent = true,
},
{
"<leader>dc",
function()
require("dap").continue()
end,
silent = true,
},
{
"<leader>so",
function()
require("dap").step_over()
end,
silent = true,
},
{
"<leader>si",
function()
require("dap").step_into()
end,
silent = true,
},
{
"<leader>st",
function()
require("dap").step_out()
end,
silent = true,
},
{
"<leader>b",
function()
require("dap").toggle_breakpoint()
end,
silent = true,
},
{
"<A-b>",
function()
require("dap").toggle_breakpoint()
end,
silent = true,
},
{
"<Leader>B",
function()
require("dap").set_breakpoint()
end,
silent = true,
},
{
"<Leader>lp",
function()
require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message: "))
end,
silent = true,
},
{
"<Leader>dr",
function()
require("dap").repl.open()
end,
silent = true,
},
{
"<Leader>dl",
function()
require("dap").run_last()
end,
silent = true,
},
},
}

View file

@ -0,0 +1,75 @@
return {
"rcarriga/nvim-dap-ui",
dependencies = {
"mfussenegger/nvim-dap",
"nvim-neotest/nvim-nio",
},
keys = {
{
"<leader>du",
function()
require("dapui").toggle()
end,
silent = true,
},
{
"<Leader>dh",
function()
require("dap.ui.widgets").hover()
end,
silent = true,
},
{
"<Leader>dp",
function()
require("dap.ui.widgets").preview()
end,
silent = true,
},
{
"<Leader>ds",
function()
local widgets = require("dap.ui.widgets")
widgets.centered_float(widgets.scopes)
end,
silent = true,
},
},
opts = {
icons = {
expanded = "",
collapsed = "",
},
mappings = {
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
expand_lines = vim.fn.has("nvim-0.7"),
layouts = {
{
elements = {
"repl",
"breakpoints",
"scopes",
},
size = 0.3,
position = "bottom",
},
},
floating = {
max_height = nil,
max_width = nil,
border = "single",
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil,
},
},
}

View file

@ -1,28 +0,0 @@
local conform = require("conform")
conform.setup({
formatters_by_ft = {
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
go = { "gofmt" },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 500,
},
})
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
conform.format({ lsp_fallback = true, async = false, timeout_ms = 500 })
end, { desc = "Format file or range (in visual mode)" })

12
nvim/lua/plugins/go.lua Normal file
View file

@ -0,0 +1,12 @@
return {
"ray-x/go.nvim",
dependencies = {
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
config = true,
event = { "CmdlineEnter" },
ft = { "go", "gomod" },
build = ':lua require("go.install").update_all_sync()',
}

View file

@ -0,0 +1,21 @@
return {
"edolphin-ydf/goimpl.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-lua/popup.nvim",
"nvim-telescope/telescope.nvim",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("telescope").load_extension("goimpl")
end,
keys = {
{
"<leader>im",
function()
require("telescope").extensions.goimpl.goimpl({})
end,
desc = "Generate stub for interface on a type for golang",
},
},
}

View file

@ -1,99 +0,0 @@
return require("packer").startup({
function(use)
use("wbthomason/packer.nvim")
use("nvim-lua/plenary.nvim")
use("neovim/nvim-lspconfig")
use("navarasu/onedark.nvim")
use("Snyssfx/goerr-nvim")
use({
"lukas-reineke/indent-blankline.nvim",
config = function()
require("ibl").setup()
end,
})
use({
"rcarriga/nvim-dap-ui",
requires = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
})
use({
"leoluz/nvim-dap-go",
requires = { "mfussenegger/nvim-dap" },
config = function()
require("plugins.dap")
end,
})
use({
"hrsh7th/nvim-cmp",
requires = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-vsnip",
"hrsh7th/vim-vsnip",
},
config = function()
require("plugins.cmp")
end,
})
use({
"nvim-lualine/lualine.nvim",
config = function()
require("plugins.lualine")
end,
})
use({
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require("plugins.treesitter")
end,
})
use({ "nvim-telescope/telescope-file-browser.nvim" })
use({
"nvim-telescope/telescope.nvim",
config = function()
require("plugins.telescope")
end,
requires = "nvim-lua/plenary.nvim",
})
use({
"nvim-tree/nvim-tree.lua",
requires = {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("plugins.tree")
end,
})
use({
"stevearc/conform.nvim",
config = function()
require("plugins.format")
end,
})
use({
"mfussenegger/nvim-dap",
config = function()
local dap = require("dap")
-- Общие конфигурации для Go
dap.configurations.go = {
{
type = "go",
name = "Debug",
request = "launch",
program = "${file}",
showLog = true,
console = "integratedTerminal",
},
}
end,
})
if packer_bootstrap then
require("packer").sync()
end
end,
config = {
-- The root has to be a directory named "pack"
package_root = vim.fn.stdpath("data") .. "/site/pack",
},
})

View file

@ -1,40 +1,43 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
return {
"nvim-lualine/lualine.nvim",
opts = {
options = {
icons_enabled = true,
theme = "auto",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {},
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}

View file

@ -0,0 +1,33 @@
return {
"navarasu/onedark.nvim",
opts = {
style = "darker",
transparent = false, -- Show/hide background
term_colors = true, -- Change terminal color as per the selected theme style
ending_tildes = true, -- Show the end-of-buffer tildes. By default they are hidden
cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu
toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts"
toggle_style_list = { "dark", "darker", "cool", "deep", "warm", "warmer", "light" }, -- List of styles to toggle between
code_style = {
comments = "italic",
keywords = "none",
functions = "none",
strings = "none",
variables = "none",
},
lualine = {
transparent = false, -- lualine center bar transparency
},
colors = {}, -- Override default colors
highlights = {}, -- Override highlight groups
diagnostics = {
darker = true, -- darker colors for diagnostic
undercurl = true, -- use undercurl instead of underline for diagnostics
background = true, -- use background color for virtual text
},
},
}

View file

@ -0,0 +1,8 @@
require("luasnip").config.setup({
history = true,
update_events = "TextChanged,TextChangedI",
})
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load({
paths = { vim.fn.stdpath("config") .. "/snippets" },
})

View file

@ -1,10 +1,19 @@
require("telescope").setup({
pickers = {
buffers = {
initial_mode = "normal",
return {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
pickers = {
buffers = {
initial_mode = "normal",
},
},
defaults = {
file_ignore_patterns = { "vendor", "node_modules" },
},
},
defaults = {
file_ignore_patterns = { "vendor", "node_modules" },
keys = {
{ "<leader>ff", "<cmd>Telescope find_files<CR>", noremap = true, silent = true, desc = "Find files" },
{ "<leader>fg", "<cmd>Telescope live_grep<CR>", noremap = true, silent = true, desc = "Live grep" },
{ "<leader>fb", "<cmd>Telescope buffers<CR>", noremap = true, silent = true, desc = "Find buffers" },
},
})
}

View file

@ -1,27 +1,51 @@
require("nvim-tree").setup({
sort = {
sorter = "case_sensitive",
return {
"nvim-tree/nvim-tree.lua",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
view = {
width = 30,
},
git = {
enable = true,
},
renderer = {
group_empty = true,
highlight_git = true,
icons = {
show = {
git = true,
opts = {
hijack_directories = {
enable = true, -- Перехватывать открытие директорий
auto_open = true, -- Автоматически открывать при старте
},
sort = {
sorter = "case_sensitive",
},
view = {
width = 30,
},
git = {
enable = true,
},
renderer = {
group_empty = true,
highlight_git = true,
icons = {
show = {
git = true,
},
},
},
filters = {
dotfiles = false,
},
update_focused_file = {
enable = true,
update_root = false,
},
},
filters = {
dotfiles = false,
keys = {
{
"<C-c>",
function()
local api = require("nvim-tree.api")
local global_cwd = vim.fn.getcwd(-1, -1)
api.tree.change_root(global_cwd)
end,
noremap = true,
silent = true,
desc = "Change tree root to CWD",
},
{ "<F3>", ":NvimTreeToggle<CR>", noremap = true, silent = true, desc = "Toggle file tree" },
},
update_focused_file = {
enable = true,
update_root = false,
},
})
}

View file

@ -1,47 +1,66 @@
require("nvim-treesitter.configs").setup({
highlight = { enable = true },
ensure_installed = {
"c",
"lua",
"python",
"bash",
"go",
"html",
"css",
"javascript",
"typescript",
"git_config",
"git_rebase",
"gitattributes",
"gitcommit",
"gitignore",
"gomod",
"gosum",
"gotmpl",
"gowork",
"hjson",
"ini",
"json",
"json5",
"jsonnet",
"latex",
"make",
"markdown",
"markdown_inline",
"nginx",
"proto",
"rust",
"templ",
"todotxt",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
"sql",
"ssh_config",
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
opts = {
highlight = { enable = true },
ensure_installed = {
"c",
"lua",
"python",
"bash",
"go",
"html",
"css",
"javascript",
"typescript",
"git_config",
"git_rebase",
"gitattributes",
"gitcommit",
"gitignore",
"gomod",
"gosum",
"gotmpl",
"gowork",
"hjson",
"ini",
"json",
"json5",
"jsonnet",
"latex",
"make",
"markdown",
"markdown_inline",
"nginx",
"proto",
"rust",
"templ",
"todotxt",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
"sql",
"ssh_config",
},
ignore_install = { "gdhsader", "phpdoc" },
indent = { enable = true },
auto_install = true,
sync_install = false,
textobjects = { select = { enable = true, lookahead = true } },
},
ignore_install = { "gdhsader", "phpdoc" },
})
dependencies = {
{ "nvim-treesitter/nvim-treesitter-textobjects" },
{
"nvim-treesitter/nvim-treesitter-context",
opts = {
enable = true,
mode = "topline",
line_numbers = true,
},
},
},
}