(import-macros {: map!} :nvrc.macro.keymap) (import-macros {: setv!} :nvrc.macro.set) ;; TODO: move plugin-specific keybinds to packs/ (map! [nv :silent] : :) (setv! mapleader " ") (setv! maplocalleader ",") (map! [n] ";" ":") (map! [n :silent] :q ":enew ") (map! [n :silent] :w ":bd ") (map! [n :silent] :e ":bprev ") (map! [n :silent] :r ":bnext ") (map! [n :silent] :u ":tabprev ") (map! [n :silent] :i ":tabnext ") (map! [n :silent] :o ":tabc ") (map! [n :silent] :p ":tabnew ") (map! [n :silent] :s ":set nu! | :set rnu! ") (map! [n] :d ":b ") (map! [n :silent] :ya ":%y+ ") (map! [n] :c ":SwitchPalette ") (map! [n :silent] :/ ((. (. (. (require :Comment.api) :toggle) :linewise) :current))) (map! [v :silent] :/ ":lua require('Comment.api').toggle.linewise(vim.fn.visualmode()) ") (map! [n :silent] :ff ((. (require :fzf-lua) :files))) (map! [n :silent] :fd ((. (require :fzf-lua) :grep))) (map! [n :silent] :fl ((. (require :fzf-lua) :live_grep))) (map! [n :silent] :fb ((. (require :fzf-lua) :buffer))) (map! [n :silent] :fg ((. (require :fzf-lua) :git_commits))) (map! [n :silent] :fh ((. (require :fzf-lua) :git_status))) (map! [n :silent] :t ":Oil") (map! [n :silent] :ga ":Git add %") (map! [n :silent] :gs ":Git") (map! [n :silent] :gc ":Git commit -v -q") (map! [n :silent] :gt ":Git commit -v -q %") (map! [n :silent] :gd ":Gdiff") (map! [n :silent] :ge ":Gedit") (map! [n :silent] :gr ":Gread") (map! [n :silent] :gw ":Gwrite") (map! [n :silent] :gg ":Ggrep") (map! [n :silent] :gl ":silent! Gclog:bot copen") (map! [n :silent] :gm ":GMove") (map! [n :silent] :go ":Git checkout") (map! [n :silent] :gp ":Git! push") (map! [n :silent] :go ":Git! pull") (map! [n :silent] :gb ":Git blame") (map! [n] :gf ":diffget //2") (map! [n] :gj ":diffget //3") (map! [n :silent] :po ":copen") (map! [n :silent] :pq ":cclose") (map! [n :silent] :Po ":lopen") (map! [n :silent] :Pq ":lclose") ;; Work with word wrap (map! [n :expr :silent :noremap] :k "v:count == 0 ? 'gk' : 'k'") (map! [n :expr :silent :noremap] :j "v:count == 0 ? 'gj' : 'j'") (map! [n] : ":m .+1==") (map! [n] : ":m .-2==") (map! [i] : ":m .+1==gi") (map! [i] : ":m .-2==gi") (map! [v] : ":m '>+1gv=gv") (map! [v] : ":m '<-2gv=gv") (map! [n] : :h) (map! [n] : :j) (map! [n] : :k) (map! [n] : :l) ; LSP (map! [n] :fl (vim.lsp.buf.declaration)) (map! [n] :fd (vim.lsp.buf.definition)) (map! [nv :silent] :fs ":ConformFormat") (map! [n] :fa (vim.lsp.buf.code_action)) (map! [n] :fu (vim.lsp.buf.implementation)) (map! [n] :fi (vim.lsp.buf.incoming_calls)) (map! [n] :fo (vim.lsp.buf.outgoing_calls)) (map! [n] :fh (vim.lsp.inlay_hint.enable (not (vim.lsp.inlay_hint.is_enabled)))) (map! [n] :frl (vim.lsp.buf.references)) (map! [n] :frc (vim.lsp.buf.clear_references)) (map! [n] :frr (vim.lsp.buf.rename)) (map! [n] :k (vim.lsp.buf.hover)) (map! [n] :l (vim.diagnostic.open_float nil {:focus false})) (map! [n] :b ((. (require :dap) :toggle_breakpoint))) ;; Helix-like movements (map! [nv] :gh :0) (map! [nv] :gl "$") (map! [nv] :gs "_") (map! [nv] :ge :G) (map! [nv] :g. "g;")