about summary refs log tree commit diff
path: root/fnl/nvrc/keymaps.fnl
blob: 2d0e7c2b031e7b8d8aa0f7b80defce9fbf63f9ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
(import-macros {: map!} :nvrc.macro.keymap)
(import-macros {: setv!} :nvrc.macro.set)

(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>w ":enew <cr>")
(map! [n :silent] :<leader>a ":tabnew <cr>")
(map! [n :silent] :<leader>s ":set nu! | :set rnu! <cr>")
(map! [n :silent] :<leader>d ":buffers <cr>")
(map! [n :silent] :<leader>ya ":%y+ <cr>")

(map! [n :silent] :<leader>/ ((. (require :Comment.api) :toggle_current_linewise)))
(map! [v :silent] :<leader>/
      ":lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode()) <cr>")

(map! [n :silent] :<leader>ff ((. (require :fzf-lua) :files)))
(map! [n :silent] :<leader>fd ((. (require :fzf-lua) :grep)))
(map! [n :silent] :<leader>fl ((. (require :fzf-lua) :live_grep)))
(map! [n :silent] :<leader>fb ((. (require :fzf-lua) :buffer)))
(map! [n :silent] :<leader>fg ((. (require :fzf-lua) :git_commits)))
(map! [n :silent] :<leader>fh ((. (require :fzf-lua) :git_status)))

(map! [n] :s :<plug>Lightspeed_omni_s)
(map! [n] :gs :<plug>Lightspeed_omni_gs)

(map! [n :silent] :<leader>u ":TZAtaraxis <cr>")

(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")