2023-02-10 01:39:34 +07:00
|
|
|
|
--[[ nvim-neo-tree/neo-tree ]]
|
|
|
|
|
|
2023-02-11 19:56:38 +07:00
|
|
|
|
-- Открыть интерфейс с древовидным отображением файлов
|
2023-02-14 16:40:45 +07:00
|
|
|
|
vim.keymap.set({'n', 'i', 'v', 't'}, '<f1>', '<cmd>NeoTreeRevealToggle<cr>', {noremap = true})
|
2023-02-11 19:56:38 +07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- [[ folke/trouble.nvim ]]
|
2023-02-14 16:40:45 +07:00
|
|
|
|
vim.keymap.set({'n', 'i', 'v', 't'}, '<f2>', '<cmd>TroubleToggle<cr>', {noremap = true})
|
2023-02-11 19:56:38 +07:00
|
|
|
|
|
2023-02-10 01:39:34 +07:00
|
|
|
|
|
|
|
|
|
--[[ onsails/diaglist.nvim ]]
|
|
|
|
|
|
|
|
|
|
-- Открыть интерфейс диагностики
|
|
|
|
|
vim.keymap.set('n', '<space>dw', '<cmd>lua require(\'diaglist\').open_all_diagnostics()<cr>', {noremap = true})
|
|
|
|
|
vim.keymap.set('n', '<space>d0', '<cmd>lua require(\'diaglist\').open_buffer_diagnostics()<cr>', {noremap = true})
|
|
|
|
|
|
2023-02-11 19:56:38 +07:00
|
|
|
|
|
2023-02-10 01:39:34 +07:00
|
|
|
|
--[[ noib3/nvim-cokeline ]]
|
|
|
|
|
|
|
|
|
|
-- Переключение вкладок
|
|
|
|
|
vim.keymap.set('n', '<tab>', '<Plug>(cokeline-focus-next)', {noremap = true, silent = true})
|
|
|
|
|
vim.keymap.set('n', '<s-tab>', '<Plug>(cokeline-focus-prev)', {noremap = true, silent = true})
|
|
|
|
|
|
|
|
|
|
|
2023-02-11 19:56:38 +07:00
|
|
|
|
--[[ neovim/nvim-lspconfig ]]
|
|
|
|
|
|
|
|
|
|
-- Диагностика
|
|
|
|
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, {noremap = true, silent = true})
|
|
|
|
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, {noremap = true, silent = true})
|
|
|
|
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, {noremap = true, silent = true})
|
|
|
|
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, {noremap = true, silent = true})
|
|
|
|
|
|
|
|
|
|
-- Инициализация только после того, как LSP-сервер подключится к текущему буферу
|
|
|
|
|
lspconfig_on_attach = function(client, bufnr)
|
|
|
|
|
-- Активация завершения
|
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<c-k>', vim.lsp.buf.signature_help, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<space>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
|
|
|
|
|
-- Форматирование
|
|
|
|
|
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, {noremap = true, silent = true, buffer = bufnr})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--[[ lewis6991/gitsigns.nvim ]]
|
|
|
|
|
|
|
|
|
|
-- Инициализация только после того, как LSP-сервер подключится к текущему буферу
|
|
|
|
|
gitsigns_on_attach = function(bufnr)
|
|
|
|
|
-- Инициализация ярлыка
|
|
|
|
|
local gs = package.loaded.gitsigns
|
|
|
|
|
|
|
|
|
|
-- Навигация
|
|
|
|
|
vim.keymap.set('n', ']c', function()
|
|
|
|
|
if vim.wo.diff then return ']c' end
|
|
|
|
|
vim.schedule(function() gs.next_hunk() end)
|
|
|
|
|
return '<Ignore>'
|
|
|
|
|
end, {expr = true, buffer = bufnr})
|
|
|
|
|
|
|
|
|
|
-- Навигация
|
|
|
|
|
vim.keymap.set('n', '[c', function()
|
|
|
|
|
if vim.wo.diff then return '[c' end
|
|
|
|
|
vim.schedule(function() gs.prev_hunk() end)
|
|
|
|
|
return '<Ignore>'
|
|
|
|
|
end, {expr = true, buffer = bufnr})
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>hs', '<cmd>Gitsigns stage_hunk<cr>', {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('v', '<leader>hs', '<cmd>Gitsigns stage_hunk<cr>', {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<leader>hr', '<cmd>Gitsigns reset_hunk<cr>', {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('v', '<leader>hr', '<cmd>Gitsigns reset_hunk<cr>', {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<leader>hS', gs.stage_buffer, {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<leader>hu', gs.undo_stage_hunk, {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<leader>hR', gs.reset_buffer, {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<leader>hp', gs.preview_hunk, {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<leader>hb', function() gs.blame_line{full=true} end, {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<leader>tb', gs.toggle_current_line_blame, {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<leader>hd', gs.diffthis, {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<leader>hD', function() gs.diffthis('~') end, {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('n', '<leader>td', gs.toggle_deleted, {buffer = bufnr})
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('o', 'ih', '<cmd><c-U>Gitsigns select_hunk<cr>', {buffer = bufnr})
|
|
|
|
|
vim.keymap.set('x', 'ih', '<cmd><c-U>Gitsigns select_hunk<cr>', {buffer = bufnr})
|
2023-02-10 01:39:34 +07:00
|
|
|
|
end
|
2023-02-11 19:56:38 +07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--[[ nvim-telescope/telescope.nvim ]]
|
|
|
|
|
|
|
|
|
|
-- Инициализация ярлыка
|
|
|
|
|
local builtin = require('telescope.builtin')
|
|
|
|
|
|
|
|
|
|
-- Поиск файла
|
|
|
|
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, {noremap = true, silent = true})
|
|
|
|
|
|
|
|
|
|
-- grep
|
|
|
|
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {noremap = true, silent = true})
|
|
|
|
|
|
|
|
|
|
-- Буферы?
|
|
|
|
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, {noremap = true, silent = true})
|
|
|
|
|
|
|
|
|
|
-- Помощь
|
|
|
|
|
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {noremap = true, silent = true})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--[[ windwp/nvim-autopairs ]]
|
|
|
|
|
|
|
|
|
|
-- Переназначение стандартных сочетаний клавиш для "ms-jpq/coq_nvim"
|
|
|
|
|
--vim.keymap.set('i', '<esc>', [[pumvisible() ? "<c-e><esc>" : "<esc>"]], {expr = true, noremap = true})
|
|
|
|
|
--vim.keymap.set('i', '<c-c>', [[pumvisible() ? "<c-e><c-c>" : "<c-c>"]], {expr = true, noremap = true})
|
|
|
|
|
--vim.keymap.set('i', '<tab>', [[pumvisible() ? "<c-n>" : "<tab>"]], {expr = true, noremap = true})
|
|
|
|
|
--vim.keymap.set('i', '<s-tab>', [[pumvisible() ? "<c-p>" : "<tab>"]], {expr = true, noremap = true})
|
|
|
|
|
|
|
|
|
|
_G.PairIT = function()
|
|
|
|
|
local autopairs = {
|
|
|
|
|
['('] = ')',
|
|
|
|
|
['['] = ']',
|
|
|
|
|
['{'] = '}',
|
|
|
|
|
['<'] = '>',
|
|
|
|
|
[ [=[']=] ] = [=[']=],
|
|
|
|
|
[ [=["]=] ] = [=["]=],
|
|
|
|
|
}
|
|
|
|
|
local set_pairs = vim.keymap.set
|
|
|
|
|
for k, v in pairs(autopairs) do
|
|
|
|
|
set_pairs('i', k, function()
|
|
|
|
|
return k .. v .. '<Left>'
|
|
|
|
|
end, { expr = true, noremap = true })
|
2023-02-10 01:39:34 +07:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2023-02-11 19:56:38 +07:00
|
|
|
|
|
|
|
|
|
--[[ b3nj5m1n/kommentary ]]
|
|
|
|
|
vim.keymap.set('n', '<leader>cic', '<Plug>kommentary_line_increase', {noremap = true, silent = true})
|
|
|
|
|
vim.keymap.set('n', '<leader>ci', '<Plug>kommentary_motion_increase', {noremap = true, silent = true})
|
|
|
|
|
vim.keymap.set('x', '<leader>ci', '<Plug>kommentary_visual_increase', {noremap = true, silent = true})
|
|
|
|
|
vim.keymap.set('n', '<leader>cdc', '<Plug>kommentary_line_decrease', {noremap = true, silent = true})
|
|
|
|
|
vim.keymap.set('n', '<leader>cd', '<Plug>kommentary_motion_decrease', {noremap = true, silent = true})
|
|
|
|
|
vim.keymap.set('x', '<leader>cd', '<Plug>kommentary_visual_decrease', {noremap = true, silent = true})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--[[ preservim/tagbar ]]
|
2023-02-14 16:40:45 +07:00
|
|
|
|
vim.keymap.set({'n', 'i', 'v', 't'}, '<f8>', '<cmd>TagbarToggle<cr>', {noremap = true, silent = true})
|
2023-02-11 19:56:38 +07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--[[ simrat39/symbols-outline.nvim ]]
|
2023-02-14 16:40:45 +07:00
|
|
|
|
vim.keymap.set({'n', 'i', 'v', 't'}, '<f7>', '<cmd>SymbolsOutline<cr>', {noremap = true, silent = true})
|