blob: 80c1b31090fda670d48a192289ac2deb5b608a68 (
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
(import-macros {: map!} :nvrc.macro.keymap)
(import-macros {: setv!} :nvrc.macro.set)
;; TODO: move plugin-specific keybinds to packs/
(map! [nv :silent] :<space> :<Nop>)
(setv! mapleader " ")
(setv! maplocalleader ",")
(map! [n] "<leader>;" ":")
(map! [n :silent] :<leader>q ":enew <cr>")
(map! [n :silent] :<leader>w ":bd <cr>")
(map! [n :silent] :<leader>e ":bprev <cr>")
(map! [n :silent] :<leader>r ":bnext <cr>")
(map! [n :silent] :<leader>u ":tabprev <cr>")
(map! [n :silent] :<leader>i ":tabnext <cr>")
(map! [n :silent] :<leader>o ":tabc <cr>")
(map! [n :silent] :<leader>p ":tabnew <cr>")
(map! [n :silent] :<leader>s ":set nu! | :set rnu! <cr>")
(map! [n] :<leader>d ":b ")
(map! [n :silent] :<leader>ya ":%y+ <cr>")
(map! [n] :<leader>c ":SwitchPalette ")
(map! [n :silent] :<leader>/ ((. (. (. (require :Comment.api) :toggle)
:linewise)
:current)))
(map! [v :silent] :<leader>/
":lua require('Comment.api').toggle.linewise(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 :silent] :<leader>t ":Oil<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>go ":Git! pull<cr>")
(map! [n :silent] :<leader>gb ":Git blame<cr>")
(map! [n] :gf ":diffget //2<cr>")
(map! [n] :gj ":diffget //3<cr>")
(map! [n :silent] :<leader>po ":copen<cr>")
(map! [n :silent] :<leader>pq ":cclose<cr>")
(map! [n :silent] :<leader>Po ":lopen<cr>")
(map! [n :silent] :<leader>Pq ":lclose<cr>")
;; 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] :<A-e> ":m .+1<cr>==")
(map! [n] :<A-r> ":m .-2<cr>==")
(map! [i] :<A-e> "<esc>:m .+1<cr>==gi")
(map! [i] :<A-r> "<esc>:m .-2<cr>==gi")
(map! [v] :<A-e> ":m '>+1<cr>gv=gv")
(map! [v] :<A-r> ":m '<-2<cr>gv=gv")
(map! [n] :<C-h> :<C-w>h)
(map! [n] :<C-j> :<C-w>j)
(map! [n] :<C-k> :<C-w>k)
(map! [n] :<C-l> :<C-w>l)
; LSP
(map! [n] :fl (vim.lsp.buf.declaration))
(map! [n] :fd (vim.lsp.buf.definition))
(map! [n] :fs (vim.lsp.buf.format))
(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] :frl (vim.lsp.buf.references))
(map! [n] :frc (vim.lsp.buf.clear_references))
(map! [n] :frr (vim.lsp.buf.rename))
(map! [n] :<leader>k (vim.lsp.buf.hover))
(map! [n] :<leader>l (vim.diagnostic.open_float nil {:focus false}))
(map! [n] :<leader>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;")
|