dots-of-war/files/.config/nvim/fnl/keybinds.fnl

96 lines
3.4 KiB
Text
Raw Normal View History

2021-04-02 17:54:14 +00:00
(module keybinds
{require {a aniseed.core
nvim aniseed.nvim
2021-04-03 14:14:56 +00:00
utils utils
2021-04-29 18:04:17 +00:00
fennel aniseed.fennel
2021-04-30 10:53:30 +00:00
wk which-key
2021-05-03 16:35:39 +00:00
treesitter-selection nvim-treesitter.incremental_selection
trouble trouble}
2021-04-02 17:54:14 +00:00
require-macros [macros]})
2021-04-03 19:21:12 +00:00
2021-05-02 09:47:28 +00:00
(utils.keymap :i :<C-Space> "compe#complete()" {:expr true})
2021-04-23 14:46:45 +00:00
(utils.keymap :i :<esc> "compe#close('<esc>')" {:expr true})
2021-04-02 17:54:14 +00:00
2021-04-22 14:00:33 +00:00
2021-05-06 18:54:55 +00:00
(utils.keymap :n :<C-p> "<cmd>Telescope find_files<cr>")
2021-04-22 14:00:33 +00:00
2021-04-02 17:54:14 +00:00
2021-04-29 18:04:17 +00:00
(fn cmd [s desc] [(.. "<cmd>" s "<cr>") desc])
(fn rebind [s desc] [s desc])
2021-04-02 17:54:14 +00:00
2021-05-02 15:15:33 +00:00
(wk.setup {})
2021-04-29 18:04:17 +00:00
(wk.register
2021-05-02 15:15:33 +00:00
{"c" {:name "+comment out"}
"e" {:name "+emmet"}
"h" (cmd "bprevious" "previous buffer")
"l" (cmd "bnext" "next buffer")
"o" (cmd "Telescope live_grep" "Grep files")
"p" (cmd "Telescope file_browser" "Open file-browser")
":" (cmd "Telescope commands" "Search command with fzf")
"m" {:name "+Code actions"
"d" (cmd "Lspsaga hover_doc" "Show documentation")
"b" (cmd "Lspsaga lsp_finder" "Find stuff")
"x" (cmd "Lspsaga preview_definition" "Preview definition")
"o" (cmd "SymbolsOutline" "Outline")
"S" (cmd "Telescope lsp_document_symbols" "Symbols in document")
"s" (cmd "Telescope lsp_dynamic_workspace_symbols" "Symbols in workspace")
"t" (cmd "Lspsaga signature_help" "Show signature help")
"n" (cmd "Lspsaga rename" "Rename")
"v" (cmd "Lspsaga code_action" "Apply codeaction")
"a" (cmd "Lspsaga show_cursor_diagnostics" "Cursor diagnostics")
"A" (cmd "Lspsaga show_line_diagnostics" "Line diagnostics")
2021-05-03 16:35:39 +00:00
"h" (cmd "RustToggleInlayHints" "Toggle inlay hints")
"r" [#(trouble.open "lsp_references") "Show references"]
"E" [#(trouble.open "lsp_document_diagnostics") "List diagnostics"]
"e" [#(trouble.open "lsp_workspace_diagnostics") "Show diagnostics"]
2021-05-02 15:15:33 +00:00
"g" [vim.lsp.buf.definition "Go to definition"]
"i" [vim.lsp.buf.implementation "Show implementation"]
2021-05-03 16:35:39 +00:00
"f" [vim.lsp.buf.formatting "format file"]}
2021-05-02 15:15:33 +00:00
"f" {:name "+folds"
"o" (cmd "foldopen" "open fold")
"n" (cmd "foldclose" "close fold")
"j" (rebind "zj" "jump to next fold")
"k" (rebind "zk" "jump to previous fold")}
"v" {:name "+view-and-layout"
"n" (cmd "set relativenumber!" "toggle relative numbers")
"m" (cmd "set nonumber! norelativenumber" "toggle numbers")
"g" (cmd "Goyo | set linebreak" "toggle focus mode")
"i" (cmd "IndentGuidesToggle" "toggle indent guides")}
"b" {:name "+buffers"
"b" (cmd "Buffers" "select open buffer")
"c" (cmd "bdelete!" "close open buffer")
"w" (cmd "bwipeout!" "wipeout open buffer")}}
{:prefix "<leader>"})
2021-04-29 18:04:17 +00:00
(wk.register
2021-05-02 15:15:33 +00:00
{"<tab>" "which_key_ignore"
"gss" "init selection"
"z" {:name "+folds"
"c" (cmd "foldclose" "close fold")
"o" (cmd "foldopen" "open fold")}})
2021-04-30 10:53:30 +00:00
(wk.register
2021-05-02 15:15:33 +00:00
{"<tab>" "which_key_ignore"}
{:mode "i"})
2021-04-29 19:08:05 +00:00
2021-04-30 10:53:30 +00:00
(wk.register
2021-05-02 15:15:33 +00:00
{:name "+Selection"
"j" "increment selection"
"k" "decrement selection"
"l" "increment node"
"h" "decrement node"}
{:prefix "gs"
:mode "v"})
2021-04-30 10:53:30 +00:00
2021-04-02 17:54:14 +00:00
(set nvim.o.timeoutlen 200)