aboutsummaryrefslogtreecommitdiff
path: root/fnl/plugins/which_key.fnl
blob: e3279db92eef9210c95cf6155fcb80881764fcbb (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
(local whichkey (_G.util.require! :which-key))
(whichkey.setup)

(macro wmap [k op desc]
  {1 (.. " " k) 2 op :desc desc})
(macro gmap [k group]
  {1 (.. " " k) :group group})

(local mappings [
  ;;common
  (wmap :f "<cmd>Neotree toggle<CR>" "fs")
  (wmap :w "<cmd>WinShift<CR>" "win shift")
  (wmap :t "<cmd>ToggleTerm direction=horizontal<CR>" "hterm")
  (wmap :d "<cmd>Glance references<CR>" "references")
  (wmap :s "<cmd>Telescope live_grep<CR>" "search")
  (wmap :b "<cmd>JABSOpen<CR>" "buffers")
  (wmap :g (fn []
    (local buffer (vim.fn.expand :%))
    (vim.cmd "w") ;write so location is updated
    (vim.cmd "tabe")
    (vim.cmd (.. "buffer " buffer))
    ((. (require "dapui") :open))) "dap-ify")
  (wmap :x "<cmd>tabclose<CR>" "close tab")
  (wmap :c (fn []
    (_G.loaded.edgy.goto_main)
    (vim.cmd "DiffviewOpen")) "git diff")

  ;;layouts
  (gmap :l "layout")
  (wmap :li (fn []
    (vim.cmd "ToggleTerm direction=horizontal")
    (vim.cmd "Neotree toggle")
    (vim.cmd "Outline")) "ide")

  ;;visual
  (gmap :v "visual")
  (wmap :vl "<cmd>lua require('nabla').toggle_virt({autogen=true})<CR>" "latex")
  (wmap :vb "<cmd>lua require('nvim-biscuits').toggle_biscuits()<CR>" "biscuits")
  
  ;;quick
  (gmap :q "quick")
  (wmap :qs "\"+y" "system grab")
  (wmap :ql "0v$" "line")
  (wmap :qr "<cmd>SnipRun<CR>" "run highlighted")
  (wmap :qf "<cmd>RunFile<CR>" "run file")
  (wmap :qe "<cmd>RunCode<CR>" "run code")
  ])

(tset mappings :mode [:n :v])
(tset mappings :silent true)
(tset mappings :noremap true)
(tset mappings :nowait true)


(whichkey.add mappings)