local map = vim.api.nvim_set_keymap local opts = {noremap = true, silent = true} -- Tree map('n', '', ':NvimTreeToggle', opts) -- Telescope map('n', 'ff', 'Telescope find_files', opts) map('n', 'fg', 'Telescope live_grep', opts) map('n', 'fb', 'Telescope buffers', opts) -- LSP --map('n', 'e', vim.diagnostic.open_float, opts) --map('n', '[d', vim.diagnostic.goto_prev, opts) --map('n', ']d', vim.diagnostic.goto_next, opts) --map('n', 'q', vim.diagnostic.setloclist, opts) local on_attach = function(client, bufnr) vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') local bufopts = { noremap=true, silent=true, buffer=bufnr } -- стандартные горячие клавиши для LSP, больше в документации -- https://github.com/neovim/nvim-lspconfig map('n', 'gD', vim.lsp.buf.declaration, bufopts) map('n', 'gd', vim.lsp.buf.definition, bufopts) map('n', 'K', vim.lsp.buf.hover, bufopts) map('n', 'gi', vim.lsp.buf.implementation, bufopts) map('n', '', vim.lsp.buf.signature_help, bufopts) map('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) map('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) map('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, bufopts) map('n', 'D', vim.lsp.buf.type_definition, bufopts) map('n', 'rn', vim.lsp.buf.rename, bufopts) map('n', 'ca', vim.lsp.buf.code_action, bufopts) map('n', 'gr', vim.lsp.buf.references, bufopts) map('n', 'f', vim.lsp.buf.formatting, bufopts) end 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 vim.keymap.set('n', '', change_root_to_global_cwd, {})