2025-06-22 21:18:32 +03:00

268 lines
6.1 KiB
Lua

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
config = function()
require("catppuccin").setup({
flavour = "frappe",
background = {
light = "latte",
dark = "frappe",
},
transparent_background = false,
show_end_of_buffer = false,
term_colors = false,
dim_inactive = {
enabled = false,
shade = "dark",
percentage = 0.15,
},
styles = {
comments = { "italic" },
conditionals = { "italic" },
},
color_overrides = {
frappe = {
mauve = "#ca9ee6",
},
},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
treesitter = true,
notify = false,
mini = {
enabled = true,
indentscope_color = "",
},
},
})
vim.cmd.colorscheme("catppuccin")
end,
},
{
"nvim-tree/nvim-tree.lua",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local function my_on_attach(bufnr)
local api = require("nvim-tree.api")
api.config.mappings.default_on_attach(bufnr)
end
require("nvim-tree").setup({
disable_netrw = true,
hijack_netrw = true,
update_focused_file = {
enable = true,
update_cwd = true,
},
view = {
width = 40,
side = "left",
},
renderer = {
highlight_git = true,
icons = {
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
},
},
},
on_attach = my_on_attach,
})
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>", { noremap = true, silent = true })
end,
},
{
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup()
end,
},
{
"nvim-lualine/lualine.nvim",
config = function()
local function gitsigns_status()
local gs = vim.b.gitsigns_status_dict
if gs then
local added = gs.added or 0
local changed = gs.changed or 0
local removed = gs.removed or 0
local status = ""
if added > 0 then status = status .. "[+]" .. added .. " " end
if changed > 0 then status = status .. "[~]" .. changed .. " " end
if removed > 0 then status = status .. "[-]" .. removed .. " " end
return status
end
return ""
end
require("lualine").setup({
options = {
theme = "catppuccin",
section_separators = { "", "" },
component_separators = { "", "" },
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch" },
lualine_c = { "filename" },
lualine_x = {
gitsigns_status,
"encoding",
"filetype",
},
lualine_y = {},
lualine_z = {},
},
})
end,
},
{
"akinsho/bufferline.nvim",
tag = "*",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
vim.g.mapleader = "\\"
require("bufferline").setup({
options = {
show_buffer_close_icons = true,
tab_size = 22,
separator_style = "slant",
},
})
for i = 1, 9 do
vim.keymap.set("n", "<leader>" .. i, ":BufferLineGoToBuffer " .. i .. "<CR>", { noremap = true, silent = true })
end
vim.keymap.set("n", "<Tab>", ":BufferLineCycleNext<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<S-Tab>", ":BufferLineCyclePrev<CR>", { noremap = true, silent = true })
end,
},
{
"petertriho/nvim-scrollbar",
config = function()
require("scrollbar").setup()
end,
},
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("telescope").setup()
end,
},
{
"stevearc/dressing.nvim",
opts = {},
},
{
"brenoprata10/nvim-highlight-colors",
config = function()
require("nvim-highlight-colors").setup({
render = "background",
enable_named_colors = true,
enable_tailwind = true,
})
end,
},
{
"williamboman/mason.nvim",
build = ":MasonUpdate",
config = true,
},
{
"williamboman/mason-lspconfig.nvim",
config = true,
},
{
"neovim/nvim-lspconfig",
config = function()
require("mason").setup()
require("mason-lspconfig").setup({
automatic_installation = true,
})
require("lspconfig").lua_ls.setup({})
end,
},
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"L3MON4D3/LuaSnip",
},
config = function()
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
sources = {
{ name = "nvim_lsp" },
},
})
end,
},
})
-- Общие настройки
vim.opt.termguicolors = true
vim.opt.number = true
vim.opt.cursorline = true
vim.opt.expandtab = true
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.smartindent = true
vim.opt.mouse = "a"
vim.opt.clipboard = "unnamedplus"
vim.opt.showcmd = false
vim.keymap.set("n", "<C-h>", "<C-w>h", { noremap = true })
vim.keymap.set("n", "<C-j>", "<C-w>j", { noremap = true })
vim.keymap.set("n", "<C-k>", "<C-w>k", { noremap = true })
vim.keymap.set("n", "<C-l>", "<C-w>l", { noremap = true })