about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-03-19 00:41:12 +0900
committersefidel <contact@sefidel.net>2022-03-19 00:47:32 +0900
commit463a27d39b98cc5b664b6abab8e4fd4fbff7426a (patch)
tree9d40bbcd6ce7d3e1ad9c58ac92bc06f2b85ac0ba
parent7bf8727cb4c81ea3c41b03f4e796461c91c6b281 (diff)
downloadnvimrc-463a27d39b98cc5b664b6abab8e4fd4fbff7426a.tar.gz
nvimrc-463a27d39b98cc5b664b6abab8e4fd4fbff7426a.zip
feat(keybinds)!: cleanup
* add fugitive bindings
* add useful misc bindings
* remove unused bindings
-rw-r--r--fnl/nvrc/keymaps.fnl41
-rw-r--r--fnl/nvrc/utils.fnl16
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}