local function map(mode, shortcut, command) vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true }) end local function nmap(shortcut, command) map('n', shortcut, command) end local function imap(shortcut, command) map('i', shortcut, command) end vim.g.mapleader = ' ' -- Misc imap('jk', '') nmap('gf', 'Git fetch') nmap('gp', 'Git pull') nmap('gP', 'Git push') -- Telescope nmap(';', 'Telescope builtin') nmap('ff', 'Telescope find_files') nmap('fr', 'Telescope resume') nmap('fb', 'Telescope buffers') nmap('fh', 'Telescope help_tags') nmap('fk', 'Telescope aerial') nmap('fd', 'Telescope lsp_document_symbols') nmap('fe', 'Telescope diagnostics') nmap('fn', 'Telescope notify') nmap('ft', 'Telescope treesitter') nmap('fz', 'Telescope current_buffer_fuzzy_find') nmap('fg', 'Telescope git_status') -- Hop nmap('hl', 'HopLine') nmap('hw', 'HopWord') -- Nvim-tree nmap('nt', 'NvimTreeToggle') nmap('nf', 'NvimTreeFindFile') -- Trouble nmap('xx', 'TroubleToggle') nmap('xw', 'TroubleToggle workspace_diagnostics') nmap('xd', 'TroubleToggle document_diagnostics') nmap('xq', 'TroubleToggle quickfix') nmap('xl', 'TroubleToggle loclist') -- SnipRun nmap('srs', 'SnipRun') nmap('srr', '%SnipRun')