From 463a27d39b98cc5b664b6abab8e4fd4fbff7426a Mon Sep 17 00:00:00 2001 From: sefidel Date: Sat, 19 Mar 2022 00:41:12 +0900 Subject: feat(keybinds)!: cleanup * add fugitive bindings * add useful misc bindings * remove unused bindings --- fnl/nvrc/keymaps.fnl | 41 ++++++++++++++++++++++++++++++++++++++--- fnl/nvrc/utils.fnl | 16 +--------------- 2 files changed, 39 insertions(+), 18 deletions(-) (limited to 'fnl') diff --git a/fnl/nvrc/keymaps.fnl b/fnl/nvrc/keymaps.fnl index 907d478..2d0e7c2 100644 --- a/fnl/nvrc/keymaps.fnl +++ b/fnl/nvrc/keymaps.fnl @@ -1,12 +1,13 @@ (import-macros {: map!} :nvrc.macro.keymap) (import-macros {: setv!} :nvrc.macro.set) -(map! [n] : "" "") +(map! [nv :silent] : "") (setv! mapleader " ") +(map! [n] ";" ":") + (map! [n :silent] :e ":bprev ") (map! [n :silent] :r ":bnext ") -(map! [n :silent] :q ((. (require :nvrc.utils) :del_buf))) (map! [n :silent] :w ":enew ") (map! [n :silent] :a ":tabnew ") (map! [n :silent] :s ":set nu! | :set rnu! ") @@ -29,4 +30,38 @@ (map! [n :silent] :u ":TZAtaraxis ") -(map! [n :silent] :t ((. (require :lir.float) :toggle))) +(map! [n :silent] :t ":Dirvish") + +(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] :gl ":Git! pull") + +(map! [n] :gf ":diffget //2") +(map! [n] :gj ":diffget //3") + +(map! [n :silent] :qo ":copen") +(map! [n :silent] :qq ":cclose") +(map! [n :silent] :Qo ":lopen") +(map! [n :silent] :Qq ":lclose") + +; work with word wrap +(map! [n :expr :silent] :k "v:count == 0 ? 'gk' : 'k'") +(map! [n :expr :silent] :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") diff --git a/fnl/nvrc/utils.fnl b/fnl/nvrc/utils.fnl index a033009..04398b4 100644 --- a/fnl/nvrc/utils.fnl +++ b/fnl/nvrc/utils.fnl @@ -32,18 +32,4 @@ (fn merge [...] (merge! {} ...)) -(fn del_buf [] - (let [buflisted (vim.fn.getbufinfo {:buflisted 1}) - (cur-winnr cur-bufnr) (values (vim.fn.winnr) (vim.fn.bufnr))] - (when (< (length buflisted) 2) - (vim.cmd "confirm qall") - (lua "return ")) - (each [_ winid (ipairs (. (. (vim.fn.getbufinfo cur-bufnr) 1) :windows))] - (vim.cmd (string.format "%d wincmd w" (vim.fn.win_id2win winid))) - (vim.cmd (or (and (= cur-bufnr (. (. buflisted (length buflisted)) :bufnr)) - :bp) :bn))) - (vim.cmd (string.format "%d wincmd w" cur-winnr)) - (local is-terminal (= (vim.fn.getbufvar cur-bufnr :&buftype) :terminal)) - (vim.cmd (or (and is-terminal "bd! #") "silent! confirm bd #")))) - -{: merge : del_buf} +{: merge} -- cgit 1.4.1