local opts = { noremap = true, silent = true } local map = vim.api.nvim_set_keymap map('', '', '', opts) -- Window Navigation without needing first map('n', '', 'h', opts) map('n', '', 'j', opts) map('n', '', 'k', opts) map('n', '', 'l', opts) -- Stay in visual mode when indenting map('v', '<', '', '>gv', opts) -- Resize with C-arrow map('n', '', 'resize -2', opts) map('n', '', 'resize +2', opts) map('n', '', 'vertical resize -2', opts) map('n', '', 'vertical resize +2', opts) -- Jump to column and row rather than first column in row map('n', "'", '`', opts) map('n', '`', "'", opts) -- Close context menus map('n', 'q', 'cclose', opts) -- Navigate buffers map('n', '', 'BufferLineCycleNext', opts) -- :bnext map('n', '', 'BufferLineCyclePrev', opts) -- :bprevious map('n', ']b', 'BufferLineMoveNext', opts) map('n', '[b', 'BufferLineMovePrev', opts) map('n', 'w', 'Bdelete', opts) -- don't close if unsaved -- Navigate Git Signs map('n', ']g', 'Gitsigns next_hunk', opts) map('n', '[g', 'Gitsigns prev_hunk', opts) -- Toggle Diagnostics map('n', 'de', 'lua vim.diagnostic.enable()', opts) map('n', 'dd', 'lua vim.diagnostic.disable()', opts) -- Toggle Context map('n', 'c', 'TSContextToggle', opts) -- nvim-tree map('n', 'e', 'NvimTreeToggle', opts) -- Telescope (See also configs/telescope.lua) map('n', 'ff', 'Telescope find_files', opts) map('n', 'fw', 'Telescope live_grep', opts) map('n', 'fp', 'lua require("telescope.builtin").live_grep({ type_filter = "py" })', opts) map('n', 'fo', 'Telescope oldfiles', opts) map('n', 'fr', 'Telescope projects', opts) -- ahmedkhalf/project.nvim map('n', 'fb', 'Telescope buffers', opts) map('n', 'fh', 'Telescope help_tags', opts) map('n', 'fs', 'Telescope git_status', opts) map('n', 'fc', 'Telescope git_commits', opts) map('n', 'gr', 'Telescope lsp_references', opts) -- Lspsaga (See also configs/lspsaga.lua) --map("n", "gl", "Lspsaga show_line_diagnostics", opts) map('n', 'gpd', 'Lspsaga preview_definition', opts) map('n', 'gs', 'Lspsaga signature_help', opts) map('i', '', 'Lspsaga signature_help', opts) map('n', 'lr', 'Lspsaga rename', opts) map('n', 'la', 'Lspsaga code_action', opts) map('n', '', "lua require('lspsaga.action').smart_scroll_with_saga(-1)", opts) map('n', '', "lua require('lspsaga.action').smart_scroll_with_saga(1)", opts) -- Custom "toggle summary" function for blame -- jkkj is a hack to refresh the git blame message since it doesn't update till the line changes map('n', 's', 'GitBlameToggleSummaryjkkj', opts) -- LSP (see configs/lsp-installer.lua) -- disable K in visual mode map('v', 'K', '', { noremap = false, silent = true }) -- Illuminate map('n', '', "lua require('illuminate').goto_next_reference()", opts) map('n', 'g', "lua require('illuminate').goto_prev_reference()", opts) -- Ctrl+A to yank entire current buffer map('n', '', '%y', opts)