(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 "Neotree toggle" "fs") (wmap :w "WinShift" "win shift") (wmap :t "ToggleTerm direction=horizontal" "hterm") (wmap :d "Glance references" "references") (wmap :s "Telescope live_grep" "search") (wmap :b "JABSOpen" "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 "tabclose" "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 "lua require('nabla').toggle_virt({autogen=true})" "latex") (wmap :vb "lua require('nvim-biscuits').toggle_biscuits()" "biscuits") ;;quick (gmap :q "quick") (wmap :qs "\"+y" "system grab") (wmap :ql "0v$" "line") (wmap :qr "SnipRun" "run highlighted") (wmap :qf "RunFile" "run file") (wmap :qe "RunCode" "run code") ]) (tset mappings :mode [:n :v]) (tset mappings :silent true) (tset mappings :noremap true) (tset mappings :nowait true) (whichkey.add mappings)