diff --git a/config/nvim/lua/user/remaps.lua b/config/nvim/lua/user/remaps.lua index 457209d..aa382d7 100644 --- a/config/nvim/lua/user/remaps.lua +++ b/config/nvim/lua/user/remaps.lua @@ -4,66 +4,66 @@ 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 +nmap("h", "h") +nmap("l", "l") +nmap("j", "j") +nmap("k", "k") -- 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 +nmap("", ":resize -2") +nmap("", ":resize +2") +nmap("", ":vert resize -5") +nmap("", ":vert resize +5") -- Open splits -nmap("sv", ":vs") -- Leader+s+v - split current window vertically -nmap("sh", ":split") -- Leader+s+h - split current window horizontally +nmap("sv", ":vs") +nmap("sh", ":split") -- 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 +nmap("", ":m .-2==") +nmap("", ":m .+1==") +vmap("K", ":m '<-2gv=gv") +vmap("J", ":m '>+1gv=gv") -- Leave selection when moving code left and right vmap("<", "", ">gv") -- Terminal -tmap("", "") -- Escape - in terminal mode, quit to normal mode -nmap("Th", ":lua require('user.utils').open_terminal()") -- Shift+t - open terminal in horizontal split -nmap("Tv", ":lua require('user.utils').open_terminal(true)") -- Shift+t+v - open terminal in vertical split +tmap("", "") +nmap("Th", ":lua require('user.utils').open_terminal()") +nmap("Tv", ":lua require('user.utils').open_terminal(true)") -- Tabs -nmap("H", ":tabprev") -- Shift+h - open previous tab -nmap("L", ":tabnext") -- Shift+l - open next tab -nmap("tn", ":tabnew") -- Control+t - open new empty tab -nmap("tc", ":lua require('user.tabs').close_tab()") -- Control+w - close current tab -nmap("tr", ":lua require('user.tabs').restore_tab()") -- Control+Shift+t - reopen closed tab -nmap("", ":-tabmove") -- Switch current tab with previous one -nmap("", ":+tabmove") -- Switch current tab with next one +nmap("H", ":tabprev") +nmap("L", ":tabnext") +nmap("tn", ":tabnew") +nmap("tc", ":lua require('user.tabs').close_tab()") +nmap("tr", ":lua require('user.tabs').restore_tab()") +nmap("", ":-tabmove") +nmap("", ":+tabmove") -- Telescope -nmap("f", ":Telescope find_files") -- Leader+f - find files with Telescope -nmap("p", ":Telescope") -- Leader+p - open Telescope as command palette +nmap("f", ":Telescope find_files") +nmap("p", ":Telescope") -- 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(".", ":lua vim.lsp.buf.code_action()") -- Leader+. - show code actions to run -vmap(".", ":lua vim.lsp.buf.range_code_action()") -- same as above but for visual mode +nmap("gd", ":lua vim.lsp.buf.definition()") +nmap("gr", ":lua vim.lsp.buf.references()") +nmap("K", ":lua vim.lsp.buf.hover()") +nmap("", ":lua vim.lsp.buf.rename()") +nmap(".", ":lua vim.lsp.buf.code_action()") +vmap(".", ":lua vim.lsp.buf.range_code_action()") -- Diagnostics -nmap("dd", ':lua vim.diagnostic.open_float(nil, {focus = false, scope = "cursor"})') -- Leader+d - show diagnostics in float window -nmap("dy", ":lua require('user.utils').copy_diagnostic_message()") -- Leader+d+c - copy diagnostic message -nmap("dn", ":lua vim.diagnostic.goto_next({ float = false })") -- Leader+d+n - go to next diagnostic -nmap("dp", ":lua vim.diagnostic.goto_prev({ float = false })") -- Leader+d+p - go to previous diagnostic -nmap("do", ":lopen") -- Leader+d+o - open local quickfix list w/ diagnostics +nmap("dd", ':lua vim.diagnostic.open_float(nil, {focus = false, scope = "cursor"})') +nmap("dy", ":lua require('user.utils').copy_diagnostic_message()") +nmap("dn", ":lua vim.diagnostic.goto_next({ float = false })") +nmap("dp", ":lua vim.diagnostic.goto_prev({ float = false })") +nmap("do", ":lopen") -- Git -nmap("gg", ":G") -- Leader+g+g - open vim-fugitive window +nmap("gg", ":G") -- Zen mode -nmap("z", ":ZenMode") -- Leader+z - toggle zen mode +nmap("z", ":ZenMode")