diff options
Diffstat (limited to 'fnl')
-rw-r--r-- | fnl/nvrc/keymaps.fnl | 41 | ||||
-rw-r--r-- | fnl/nvrc/utils.fnl | 16 |
2 files changed, 39 insertions, 18 deletions
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] :<space> "" "") +(map! [nv :silent] :<space> "<Nop>") (setv! mapleader " ") +(map! [n] "<leader>;" ":") + (map! [n :silent] :<leader>e ":bprev <cr>") (map! [n :silent] :<leader>r ":bnext <cr>") -(map! [n :silent] :<leader>q ((. (require :nvrc.utils) :del_buf))) (map! [n :silent] :<leader>w ":enew <cr>") (map! [n :silent] :<leader>a ":tabnew <cr>") (map! [n :silent] :<leader>s ":set nu! | :set rnu! <cr>") @@ -29,4 +30,38 @@ (map! [n :silent] :<leader>u ":TZAtaraxis <cr>") -(map! [n :silent] :<leader>t ((. (require :lir.float) :toggle))) +(map! [n :silent] :<leader>t ":Dirvish<cr>") + +(map! [n :silent] :<leader>ga ":Git add %<tab><cr>") +(map! [n :silent] :<leader>gs ":Git<cr>") +(map! [n :silent] :<leader>gc ":Git commit -v -q<cr>") +(map! [n :silent] :<leader>gt ":Git commit -v -q %<tab><cr>") +(map! [n :silent] :<leader>gd ":Gdiff<cr>") +(map! [n :silent] :<leader>ge ":Gedit<cr>") +(map! [n :silent] :<leader>gr ":Gread<cr>") +(map! [n :silent] :<leader>gw ":Gwrite<cr><cr>") +(map! [n :silent] :<leader>gg ":Ggrep<space>") +(map! [n :silent] :<leader>gl ":silent! Gclog<cr>:bot copen<cr>") +(map! [n :silent] :<leader>gm ":GMove<space>") +(map! [n :silent] :<leader>go ":Git checkout<space>") +(map! [n :silent] :<leader>gp ":Git! push<cr>") +(map! [n :silent] :<leader>gl ":Git! pull<cr>") + +(map! [n] :gf ":diffget //2<cr>") +(map! [n] :gj ":diffget //3<cr>") + +(map! [n :silent] :<leader>qo ":copen<cr>") +(map! [n :silent] :<leader>qq ":cclose<cr>") +(map! [n :silent] :<leader>Qo ":lopen<cr>") +(map! [n :silent] :<leader>Qq ":lclose<cr>") + +; 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] :<A-j> ":m .+1<cr>==") +(map! [n] :<A-k> ":m .-2<cr>==") +(map! [i] :<A-j> "<esc>:m .+1<cr>==gi") +(map! [i] :<A-k> "<esc>:m .-2<cr>==gi") +(map! [v] :<A-j> ":m '>+1<cr>gv=gv") +(map! [v] :<A-k> ":m '<-2<cr>gv=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} |