mirror of
https://github.com/StepanovPlaton/dotfiles.git
synced 2026-04-03 20:30:46 +04:00
25.12.23
This commit is contained in:
14
.config/nvim/lua/plugins/buffer_manager.lua
Normal file
14
.config/nvim/lua/plugins/buffer_manager.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
return {
|
||||
{
|
||||
"j-morano/buffer_manager.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<LEADER>b", function() require("buffer_manager.ui").toggle_quick_menu() end },
|
||||
{ "<S-h>", function() require("buffer_manager.ui").nav_prev() end },
|
||||
{ "<S-l>", function() require("buffer_manager.ui").nav_next() end }
|
||||
}
|
||||
}
|
||||
}
|
||||
6
.config/nvim/lua/plugins/colors.lua
Normal file
6
.config/nvim/lua/plugins/colors.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
-- Подсветка цвета (не только в css)
|
||||
{
|
||||
"ap/vim-css-color"
|
||||
}
|
||||
}
|
||||
51
.config/nvim/lua/plugins/colorscheme.lua
Normal file
51
.config/nvim/lua/plugins/colorscheme.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
return {
|
||||
-- {
|
||||
-- -- Загрука темы из pywal
|
||||
-- "dylanaraps/wal.vim",
|
||||
-- config = function()
|
||||
-- vim.cmd([[colorscheme wal]])
|
||||
-- end,
|
||||
-- }
|
||||
|
||||
{
|
||||
-- Отличная тема, но слишком яркий фон
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.o.background = "dark"
|
||||
vim.cmd([[colorscheme gruvbox]])
|
||||
end
|
||||
}
|
||||
|
||||
-- {
|
||||
-- "RRethy/nvim-base16",
|
||||
-- config = function()
|
||||
-- vim.cmd([[colorscheme base16-gruvbox-dark-hard]])
|
||||
-- end
|
||||
-- }
|
||||
|
||||
-- {
|
||||
-- "nanotech/jellybeans.vim",
|
||||
-- lazy = false,
|
||||
-- priority = 1000,
|
||||
-- config = function()
|
||||
-- vim.cmd([[colorscheme jellybeans]])
|
||||
-- end
|
||||
-- }
|
||||
|
||||
-- {
|
||||
-- "junegunn/seoul256.vim",
|
||||
-- config = function()
|
||||
-- vim.g.seoul256_background = 233
|
||||
-- vim.cmd([[colorscheme seoul256]])
|
||||
-- end
|
||||
-- }
|
||||
|
||||
-- {
|
||||
-- "Mofiqul/vscode.nvim",
|
||||
-- config = function()
|
||||
-- require("vscode").load("dark")
|
||||
-- end
|
||||
-- }
|
||||
}
|
||||
8
.config/nvim/lua/plugins/comment.lua
Normal file
8
.config/nvim/lua/plugins/comment.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
-- Быстрое комментирование
|
||||
-- gcc - закоментировать строку
|
||||
-- (VISUAL) gc - закоментировать выделенные строки
|
||||
{
|
||||
"tpope/vim-commentary"
|
||||
}
|
||||
}
|
||||
43
.config/nvim/lua/plugins/git.lua
Normal file
43
.config/nvim/lua/plugins/git.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
return {
|
||||
-- Поддержка git
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
require('gitsigns').setup()
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or { noremap = true, silent = true }
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true})
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true})
|
||||
|
||||
-- map('n', '<leader>gs', gs.stage_hunk)
|
||||
-- map('n', '<leader>gr', gs.reset_hunk)
|
||||
-- map('v', '<leader>hs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
|
||||
-- map('v', '<leader>hr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
|
||||
-- map('n', '<leader>gS', gs.stage_buffer)
|
||||
-- map('n', '<leader>gu', gs.undo_stage_hunk)
|
||||
-- map('n', '<leader>hR', gs.reset_buffer)
|
||||
-- map('n', '<leader>gp', gs.preview_hunk)
|
||||
-- map('n', '<leader>gb', function() gs.blame_line{full=true} end)
|
||||
-- map('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||
-- map('n', '<leader>gd', gs.diffthis)
|
||||
-- map('n', '<leader>gD', function() gs.diffthis('~') end)
|
||||
-- map('n', '<leader>gtd', gs.toggle_deleted)
|
||||
end
|
||||
}
|
||||
}
|
||||
191
.config/nvim/lua/plugins/lsp.lua
Normal file
191
.config/nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,191 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"mason-org/mason-registry",
|
||||
},
|
||||
opts = {}
|
||||
},
|
||||
{
|
||||
"williamboman/mason-null-ls.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
},
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
null_ls.setup({
|
||||
source = {
|
||||
-- null_ls.builtins.diagnostics.eslint_d,
|
||||
-- null_ls.builtins.code_actions.eslint_d,
|
||||
null_ls.builtins.diagnostics.stylelint,
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
null_ls.builtins.formatting.autopep8,
|
||||
null_ls.builtins.diagnostics.pycodestyle,
|
||||
null_ls.builtins.diagnostics.pydocstyle,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("LspFormatting", {}),
|
||||
buffer = bufnr,
|
||||
callback = function() vim.lsp.buf.format({ async = false }) end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
require("mason-null-ls").setup({
|
||||
ensure_installed = nil,
|
||||
automatic_installation = true,
|
||||
handlers = {}
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
opts = {}
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
config = function()
|
||||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump()
|
||||
elseif has_words_before() then cmp.complete()
|
||||
else fallback() end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then luasnip.jump(-1)
|
||||
else fallback() end
|
||||
end, { "i", "s" }),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
-- 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 }),
|
||||
-- }),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources(
|
||||
{{ name = 'git' }},
|
||||
{{ name = 'buffer' }}
|
||||
)
|
||||
})
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {{ name = 'buffer' }}
|
||||
})
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources(
|
||||
{{ name = 'path' }},
|
||||
{{ name = 'cmdline' }}
|
||||
)
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
-- "ms-jpq/coq_nvim",
|
||||
-- "ms-jpq/coq.artifacts",
|
||||
-- "ms-jpq/coq.thirdparty"
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
keys = {
|
||||
{ "<LEADER>lh", vim.lsp.buf.hover },
|
||||
{ "<LEADER>lr", vim.lsp.buf.rename },
|
||||
{ "<LEADER>lf", function() vim.lsp.buf.format({async = true}) end},
|
||||
{ "<LEADER>lgr", vim.lsp.buf.references },
|
||||
{ "<LEADER>lgi", vim.lsp.buf.implementation },
|
||||
{ "<LEADER>lsh", vim.lsp.buf.signature_help },
|
||||
|
||||
{ "<LEADER>ldj", vim.diagnostic.goto_next },
|
||||
{ "<LEADER>ldk", vim.diagnostic.goto_prev },
|
||||
|
||||
{ "<LEADER>lgd", vim.lsp.buf.definition },
|
||||
{ "<LEADER>lgtd", vim.lsp.buf.type_definition },
|
||||
|
||||
{ "<LEADER>law", vim.lsp.buf.add_workspace_folder },
|
||||
{ "<LEADER>ldw", vim.lsp.buf.remove_workspace_folder },
|
||||
{ "<LEADER>llw", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workplace_folders()))
|
||||
end },
|
||||
|
||||
{ "<LEADER>lca", vim.lsp.buf.code_action },
|
||||
},
|
||||
config = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
local LSP_SERVERS = {
|
||||
"tsserver",
|
||||
"html",
|
||||
"cssls",
|
||||
"tailwindcss",
|
||||
"pyright"
|
||||
}
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = LSP_SERVERS,
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
for _, server in pairs(LSP_SERVERS) do
|
||||
if server ~= "tsserver" then
|
||||
lspconfig[server].setup(
|
||||
{
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
lspconfig["tsserver"].setup(
|
||||
{
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client)
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
end,
|
||||
}
|
||||
)
|
||||
end,
|
||||
},
|
||||
}
|
||||
16
.config/nvim/lua/plugins/neotree.lua
Normal file
16
.config/nvim/lua/plugins/neotree.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
cmd = "Neotree",
|
||||
keys = {
|
||||
{ "<LEADER>f", "<CMD>:Neotree toggle<CR>" }
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
6
.config/nvim/lua/plugins/rus.lua
Normal file
6
.config/nvim/lua/plugins/rus.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
-- Поддержка русского языка в командном режиме
|
||||
{
|
||||
"powerman/vim-plugin-ruscmd"
|
||||
}
|
||||
}
|
||||
14
.config/nvim/lua/plugins/status_line.lua
Normal file
14
.config/nvim/lua/plugins/status_line.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
return {
|
||||
-- Строка состояния
|
||||
-- (можно конфигурировать, пока не разобрался)
|
||||
-- {
|
||||
-- "itchyny/lightline.vim"
|
||||
-- }
|
||||
|
||||
-- Лучше выглядит и кастомизируется
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = {}
|
||||
}
|
||||
}
|
||||
8
.config/nvim/lua/plugins/surround.lua
Normal file
8
.config/nvim/lua/plugins/surround.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
config = function()
|
||||
require("nvim-surround").setup()
|
||||
end
|
||||
},
|
||||
}
|
||||
48
.config/nvim/lua/plugins/telescope.lua
Normal file
48
.config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
return {
|
||||
{
|
||||
-- Диалоговое окно поиска
|
||||
"nvim-telescope/telescope.nvim", tag = "0.1.5",
|
||||
-- event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
"nvim-telescope/telescope-symbols.nvim"
|
||||
},
|
||||
keys = {
|
||||
{ "<LEADER>tff", "<CMD>Telescope find_files<CR>" },
|
||||
{ "<LEADER>tg", "<CMD>Telescope live_grep<CR>" },
|
||||
{ "<LEADER>tb", "<CMD>Telescope buffers<CR>" },
|
||||
{ "<LEADER>th", "<CMD>Telescope help_tags<CR>" },
|
||||
|
||||
{ "<LEADER>tfb", "<CMD>Telescope file_browser<CR>" },
|
||||
{ "<LEADER>ts", "<CMD>Telescope symbols<CR>" }
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
telescope.setup({
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown({})
|
||||
},
|
||||
["file_browser"] = {
|
||||
theme = "ivy",
|
||||
},
|
||||
["symbols"] = {}
|
||||
},
|
||||
pickers = {
|
||||
buffers = {
|
||||
mappings = {
|
||||
i = { ["<C-d>"] = actions.delete_buffer + actions.move_to_top },
|
||||
n = { ["<C-d>"] = actions.delete_buffer + actions.move_to_top }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
telescope.load_extension("file_browser")
|
||||
telescope.load_extension("ui-select")
|
||||
end,
|
||||
}
|
||||
}
|
||||
18
.config/nvim/lua/plugins/terminal.lua
Normal file
18
.config/nvim/lua/plugins/terminal.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
return {
|
||||
{
|
||||
"akinsho/toggleterm.nvim",
|
||||
version = "*",
|
||||
config = true,
|
||||
keys = {
|
||||
{ "<LEADER>T", "<CMD>ToggleTerm<CR>" },
|
||||
{ "<LEADER>Tf", "<CMD>ToggleTerm direction=float<CR>" },
|
||||
{ "<LEADER>Th", "<CMD>ToggleTerm direction=horizontal<CR>" },
|
||||
{ "<LEADER>Tv", "<CMD>ToggleTerm direction=vertical<CR>" },
|
||||
{ "<ESC>", [[<C-\><C-n>]], mode = "t" },
|
||||
{ "<C-T>", "<CMD>ToggleTerm<CR>", mode = "t" },
|
||||
{ "<C-d>", false, mode = "t" },
|
||||
{ "<C-T>c", [[<C-\><C-n><CMD>:bd!<CR>]], mode = "t" }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
16
.config/nvim/lua/plugins/todo_comments.lua
Normal file
16
.config/nvim/lua/plugins/todo_comments.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"folke/trouble.nvim"
|
||||
},
|
||||
opts = {},
|
||||
config = function()
|
||||
require("todo-comments").setup()
|
||||
end,
|
||||
keys = {
|
||||
{ "<LEADER>Ct", "<CMD>TroubleToggle todo<CR>" }
|
||||
}
|
||||
}
|
||||
}
|
||||
31
.config/nvim/lua/plugins/treesitter.lua
Normal file
31
.config/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
return {
|
||||
{
|
||||
-- Подсветка синтаксиса
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = {
|
||||
"windwp/nvim-ts-autotag",
|
||||
},
|
||||
build = ":TSUpdate",
|
||||
config = function ()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
configs.setup({
|
||||
ensure_installed = {
|
||||
"html", "markdown", "latex",
|
||||
"css", "scss", -- "less", not found
|
||||
"javascript", -- "jsx", not found
|
||||
"typescript", "tsx",
|
||||
"python", "lua",
|
||||
"vim", "vimdoc", "query",
|
||||
"bash",
|
||||
"c",
|
||||
"json", "yaml",
|
||||
},
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
incremental_selection = { enable = true },
|
||||
indent = { enable = true },
|
||||
autotag = { enable = true }
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
20
.config/nvim/lua/plugins/trouble.lua
Normal file
20
.config/nvim/lua/plugins/trouble.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
return {
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
keys = {
|
||||
{ "<LEADER>tt", "<CMD>TroubleToggle<CR>" },
|
||||
{ "<LEADER>tc", "<CMD>TroubleClose<CR>" },
|
||||
|
||||
{ "<LEADER>ttw", "<CMD>TroubleToggle workspace_diagnostics<CR>" },
|
||||
{ "<LEADER>ttd", "<CMD>TroubleToggle document_diagnostics<CR>" },
|
||||
|
||||
{ "<LEADER>ttf", "<CMD>TroubleToggle quickfix<CR>" },
|
||||
{ "<LEADER>ttl", "<CMD>TroubleToggle loclist<CR>" },
|
||||
|
||||
{ "<LEADER>tlr", "<CMD>TroubleToggle lsp_references<CR>" },
|
||||
{ "<LEADER>tld", "<CMD>TroubleToggle lsp_definitions<CR>" },
|
||||
{ "<LEADER>tltd", "<CMD>TroubleToggle lsp_type_definitions<CR>" },
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user