local utils = require("user.utils") local nmap = utils.nmap local vmap = utils.vmap local tmap = utils.tmap -- Move focus between splits nmap("h", "h") -- Leader+h - focus left split nmap("l", "l") -- Leader+l - focus right split nmap("j", "j") -- Leader+j - focus split under focused one nmap("k", "k") -- Leader+k - focus split above focused one -- Resize splits nmap("", ":resize -2") -- Control+j - decrease split height nmap("", ":resize +2") -- Control+k - increase split height nmap("", ":vert resize -5") -- Control+h - decrease split width nmap("", ":vert resize +5") -- Control+l - increase split width -- Open splits nmap("sv", ":vs") -- Leader+s+v - split current window vertically nmap("sh", ":split") -- Leader+s+h - split current window horizontally -- Move lines easily nmap("", ":m .-2==") -- Alt+k - switch current line and line above it nmap("", ":m .+1==") -- Alt+j - same as above mapping but the other way vmap("K", ":m '<-2gv=gv") -- Shift+k - in visual mode move selected lines up vmap("J", ":m '>+1gv=gv") -- Shift+j - same as above mapping but the other way -- Terminal tmap("", "") -- Escape - in terminal mode, quit to normal mode nmap("Th", ":lua open_terminal()") -- Shift+t - open terminal in horizontal split nmap("Tv", ":lua open_terminal(true)") -- Shift+t+v - open terminal in vertical split -- Tabs nmap("H", ":tabprev") -- Shift+h - open previous tab nmap("L", ":tabnext") -- Shift+l - open next tab nmap("", ":tabnew") -- Control+t - open new empty tab nmap("", ":tabclose") -- Control+w - close current tab nmap("", ":-tabmove") -- Switch current tab with previous one nmap("", ":+tabmove") -- Switch current tab with next one -- Telescope nmap("f", ":Telescope find_files") -- Leader+f - find files with Telescope nmap("p", ":Telescope") -- Leader+p - open Telescope as command palette -- LSP nmap("gd", ":lua vim.lsp.buf.definition()") -- g+d - Go to definition nmap("gr", ":lua vim.lsp.buf.references()") -- g+r - Show references nmap("K", ":lua vim.lsp.buf.hover()") -- Shift+k - Show documentation in hover window nmap("", ":lua vim.lsp.buf.rename()") -- F2 - Rename thing under the cursor nmap("d", ':lua vim.diagnostic.open_float(nil, {focus = false, scope = "cursor"})') -- Leader+d - show diagnostics in float window -- Git nmap("gg", ":G") -- Leader+g+g - open vim-fugitive window