mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-23 21:12:22 +00:00
other which-key plugin
This commit is contained in:
parent
db337b3e23
commit
fa294ce3a7
4 changed files with 75 additions and 66 deletions
|
@ -2,79 +2,76 @@
|
|||
{require {a aniseed.core
|
||||
nvim aniseed.nvim
|
||||
utils utils
|
||||
fennel aniseed.fennel}
|
||||
fennel aniseed.fennel
|
||||
wk which-key}
|
||||
require-macros [macros]})
|
||||
|
||||
|
||||
(utils.keymap :n :<leader> ":<c-u>WhichKey '<Space>'<CR>")
|
||||
(utils.keymap :v :<leader> ":<c-u>WhichKeyVisual '<Space>'<CR>")
|
||||
|
||||
(utils.keymap :i :<C-Space> "compe#complete()" {:expr true})
|
||||
(utils.keymap :i :<esc> "compe#close('<esc>')" {:expr true})
|
||||
|
||||
|
||||
|
||||
(fn le [s] (.. ":call luaeval(\"" s "\")"))
|
||||
(wk.setup {})
|
||||
|
||||
(set nvim.g.which_key_map {})
|
||||
(nvim.command "call which_key#register('<Space>', \"g:which_key_map\")")
|
||||
(fn cmd [s desc] [(.. "<cmd>" s "<cr>") desc])
|
||||
(fn le [s desc] (cmd (.. "call luaeval(\"" s "\")") desc))
|
||||
(fn rebind [s desc] [s desc])
|
||||
|
||||
(set nvim.g.which_key_map
|
||||
{ "h" [ ":bprevious" "previous buffer"]
|
||||
"l" [ ":bnext" "next buffer"]
|
||||
"f" "which_key_ignore"
|
||||
"s" "which_key_ignore"
|
||||
"o" [":Telescope live_grep" "Grep files"]
|
||||
"p" [":Telescope file_browser" "Open file-browser"]
|
||||
"[" ["<Plug>(YoinkPostPasteSwapBack)" "Swap last paste backwards"]
|
||||
"]" ["<Plug>(YoinkPostPasteSwapForward)" "Swap last paste backwards"]
|
||||
":" [":Commands" "Search command with fzf"]
|
||||
"c" { :name "+comment_out"}
|
||||
(wk.register
|
||||
{ "c" { :name "+comment out"}
|
||||
"e" { :name "+emmet"}
|
||||
|
||||
"z" { :name "+folds"
|
||||
"c" ["foldclose" "close fold"]
|
||||
"o" ["foldopen" "open fold"]}
|
||||
|
||||
"m" { :name "+Code-actions"
|
||||
"d" [ ":Lspsaga hover_doc" "show documentation"]
|
||||
"b" [ ":Lspsaga lsp_finder" "find stuff"]
|
||||
"x" [ ":Lspsaga preview_definition" "Preview definition"]
|
||||
"o" [ ":SymbolsOutline" "Outline"]
|
||||
"S" [ ":Telescope lsp_document_symbols" "symbols in document"]
|
||||
"s" [ ":Telescope lsp_dynamic_workspace_symbols" "symbols in workspace"]
|
||||
"t" [ ":Lspsaga signature_help" "Show signature help"]
|
||||
"n" [ ":Lspsaga rename" "rename"]
|
||||
"v" [ ":Lspsaga code_action" "apply codeaction"]
|
||||
"a" [ ":Lspsaga show_cursor_diagnostics" "Cursor diagnostics"]
|
||||
"A" [ ":Lspsaga show_line_diagnostics" "Line diagnostics"]
|
||||
"E" [ ":Telescope lsp_workspace_diagnostics" "List diagnostics"]
|
||||
"e" [ (le "vim.lsp.diagnostic.goto_next()") "Jump to the next error"]
|
||||
"g" [ (le "vim.lsp.buf.definition()") "go to definition"]
|
||||
"i" [ (le "vim.lsp.buf.implementation()") "show implementation"]
|
||||
"r" [ ":Telescope lsp_references" "show references"]
|
||||
"f" [ (le "vim.lsp.buf.formatting()") "format file"]}
|
||||
|
||||
"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")
|
||||
"E" (cmd "Telescope lsp_workspace_diagnostics" "List diagnostics")
|
||||
"r" (cmd "Telescope lsp_references" "Show references")
|
||||
"e" (le "vim.lsp.diagnostic.goto_next()" "Jump to the next error")
|
||||
"g" (le "vim.lsp.buf.definition()" "Go to definition")
|
||||
"i" (le "vim.lsp.buf.implementation()" "Show implementation")
|
||||
"f" (le "vim.lsp.buf.formatting()" "format file")}
|
||||
|
||||
"f" { :name "+folds"
|
||||
"o" [ ":foldopen" "open fold"]
|
||||
"n" [ ":foldclose" "close fold"]
|
||||
"j" [ "zj" "jump to next fold"]
|
||||
"k" [ "zk" "jump to previous fold"]}
|
||||
"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" [":set relativenumber!" "toggle relative numbers"]
|
||||
"m" [":set nonumber! norelativenumber" "toggle numbers"]
|
||||
"g" [":Goyo | set linebreak" "toggle focus mode"]
|
||||
"i" [":IndentGuidesToggle" "toggle indent guides"]}
|
||||
"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" [":Buffers" "select open buffer"]
|
||||
"c" [":bdelete!" "close open buffer"]
|
||||
"w" [":bwipeout!" "wipeout open buffer"]}})
|
||||
"b" (cmd "Buffers" "select open buffer")
|
||||
"c" (cmd "bdelete!" "close open buffer")
|
||||
"w" (cmd "bwipeout!" "wipeout open buffer")}}
|
||||
|
||||
{ :prefix "<leader>"})
|
||||
|
||||
(wk.register
|
||||
{ :name "+folds"
|
||||
"c" (cmd "foldclose" "close fold")
|
||||
"o" (cmd "foldopen" "open fold")}
|
||||
{ :prefix "z"})
|
||||
|
||||
|
||||
(set nvim.o.timeoutlen 200)
|
||||
|
||||
(nvim.command
|
||||
"autocmd! VimEnter * :unmap <space>ig
|
||||
autocmd! FileType which_key")
|
||||
|
|
|
@ -19,11 +19,11 @@ end
|
|||
local function _1_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _1_()
|
||||
return {require("aniseed.core"), require("aniseed.fennel"), require("aniseed.nvim"), require("utils")}
|
||||
return {require("aniseed.core"), require("aniseed.fennel"), require("aniseed.nvim"), require("utils"), require("which-key")}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_1_)
|
||||
if ok_3f_0_ then
|
||||
_0_0["aniseed/local-fns"] = {["require-macros"] = {macros = true}, require = {a = "aniseed.core", fennel = "aniseed.fennel", nvim = "aniseed.nvim", utils = "utils"}}
|
||||
_0_0["aniseed/local-fns"] = {["require-macros"] = {macros = true}, require = {a = "aniseed.core", fennel = "aniseed.fennel", nvim = "aniseed.nvim", utils = "utils", wk = "which-key"}}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
|
@ -34,18 +34,23 @@ local a = _local_0_[1]
|
|||
local fennel = _local_0_[2]
|
||||
local nvim = _local_0_[3]
|
||||
local utils = _local_0_[4]
|
||||
local wk = _local_0_[5]
|
||||
local _2amodule_2a = _0_0
|
||||
local _2amodule_name_2a = "keybinds"
|
||||
do local _ = ({nil, _0_0, {{nil}, nil, nil, nil}})[2] end
|
||||
utils.keymap("n", "<leader>", ":<c-u>WhichKey '<Space>'<CR>")
|
||||
utils.keymap("v", "<leader>", ":<c-u>WhichKeyVisual '<Space>'<CR>")
|
||||
utils.keymap("i", "<C-Space>", "compe#complete()", {expr = true})
|
||||
utils.keymap("i", "<esc>", "compe#close('<esc>')", {expr = true})
|
||||
local function le(s)
|
||||
return (":call luaeval(\"" .. s .. "\")")
|
||||
wk.setup({})
|
||||
local function cmd(s, desc)
|
||||
return {("<cmd>" .. s .. "<cr>"), desc}
|
||||
end
|
||||
nvim.g.which_key_map = {}
|
||||
nvim.command("call which_key#register('<Space>', \"g:which_key_map\")")
|
||||
nvim.g.which_key_map = {[":"] = {":Commands", "Search command with fzf"}, ["["] = {"<Plug>(YoinkPostPasteSwapBack)", "Swap last paste backwards"}, ["]"] = {"<Plug>(YoinkPostPasteSwapForward)", "Swap last paste backwards"}, b = {b = {":Buffers", "select open buffer"}, c = {":bdelete!", "close open buffer"}, name = "+buffers", w = {":bwipeout!", "wipeout open buffer"}}, c = {name = "+comment_out"}, e = {name = "+emmet"}, f = {j = {"zj", "jump to next fold"}, k = {"zk", "jump to previous fold"}, n = {":foldclose", "close fold"}, name = "+folds", o = {":foldopen", "open fold"}}, h = {":bprevious", "previous buffer"}, l = {":bnext", "next buffer"}, m = {A = {":Lspsaga show_line_diagnostics", "Line diagnostics"}, E = {":Telescope lsp_workspace_diagnostics", "List diagnostics"}, S = {":Telescope lsp_document_symbols", "symbols in document"}, a = {":Lspsaga show_cursor_diagnostics", "Cursor diagnostics"}, b = {":Lspsaga lsp_finder", "find stuff"}, d = {":Lspsaga hover_doc", "show documentation"}, e = {le("vim.lsp.diagnostic.goto_next()"), "Jump to the next error"}, f = {le("vim.lsp.buf.formatting()"), "format file"}, g = {le("vim.lsp.buf.definition()"), "go to definition"}, i = {le("vim.lsp.buf.implementation()"), "show implementation"}, n = {":Lspsaga rename", "rename"}, name = "+Code-actions", o = {":SymbolsOutline", "Outline"}, r = {":Telescope lsp_references", "show references"}, s = {":Telescope lsp_dynamic_workspace_symbols", "symbols in workspace"}, t = {":Lspsaga signature_help", "Show signature help"}, v = {":Lspsaga code_action", "apply codeaction"}, x = {":Lspsaga preview_definition", "Preview definition"}}, o = {":Telescope live_grep", "Grep files"}, p = {":Telescope file_browser", "Open file-browser"}, s = "which_key_ignore", v = {g = {":Goyo | set linebreak", "toggle focus mode"}, i = {":IndentGuidesToggle", "toggle indent guides"}, m = {":set nonumber! norelativenumber", "toggle numbers"}, n = {":set relativenumber!", "toggle relative numbers"}, name = "+view-and-layout"}, z = {c = {"foldclose", "close fold"}, name = "+folds", o = {"foldopen", "open fold"}}}
|
||||
local function le(s, desc)
|
||||
return cmd(("call luaeval(\"" .. s .. "\")"), desc)
|
||||
end
|
||||
local function rebind(s, desc)
|
||||
return {s, desc}
|
||||
end
|
||||
wk.register({[":"] = cmd("Telescope commands", "Search command with fzf"), b = {b = cmd("Buffers", "select open buffer"), c = cmd("bdelete!", "close open buffer"), name = "+buffers", w = cmd("bwipeout!", "wipeout open buffer")}, c = {name = "+comment out"}, e = {name = "+emmet"}, f = {j = rebind("zj", "jump to next fold"), k = rebind("zk", "jump to previous fold"), n = cmd("foldclose", "close fold"), name = "+folds", o = cmd("foldopen", "open fold")}, h = cmd("bprevious", "previous buffer"), l = cmd("bnext", "next buffer"), m = {A = cmd("Lspsaga show_line_diagnostics", "Line diagnostics"), E = cmd("Telescope lsp_workspace_diagnostics", "List diagnostics"), S = cmd("Telescope lsp_document_symbols", "Symbols in document"), a = cmd("Lspsaga show_cursor_diagnostics", "Cursor diagnostics"), b = cmd("Lspsaga lsp_finder", "Find stuff"), d = cmd("Lspsaga hover_doc", "Show documentation"), e = le("vim.lsp.diagnostic.goto_next()", "Jump to the next error"), f = le("vim.lsp.buf.formatting()", "format file"), g = le("vim.lsp.buf.definition()", "Go to definition"), i = le("vim.lsp.buf.implementation()", "Show implementation"), n = cmd("Lspsaga rename", "Rename"), name = "+Code actions", o = cmd("SymbolsOutline", "Outline"), r = cmd("Telescope lsp_references", "Show references"), s = cmd("Telescope lsp_dynamic_workspace_symbols", "Symbols in workspace"), t = cmd("Lspsaga signature_help", "Show signature help"), v = cmd("Lspsaga code_action", "Apply codeaction"), x = cmd("Lspsaga preview_definition", "Preview definition")}, o = cmd("Telescope live_grep", "Grep files"), p = cmd("Telescope file_browser", "Open file-browser"), v = {g = cmd("Goyo | set linebreak", "toggle focus mode"), i = cmd("IndentGuidesToggle", "toggle indent guides"), m = cmd("set nonumber! norelativenumber", "toggle numbers"), n = cmd("set relativenumber!", "toggle relative numbers"), name = "+view-and-layout"}}, {prefix = "<leader>"})
|
||||
wk.register({c = cmd("foldclose", "close fold"), name = "+folds", o = cmd("foldopen", "open fold")}, {prefix = "z"})
|
||||
nvim.o.timeoutlen = 200
|
||||
return nvim.command("autocmd! VimEnter * :unmap <space>ig\n autocmd! FileType which_key")
|
||||
return nil
|
|
@ -310,6 +310,10 @@ _G.packer_plugins = {
|
|||
loaded = true,
|
||||
path = "/home/leon/.local/share/nvim/site/pack/packer/start/webapi-vim"
|
||||
},
|
||||
["which-key.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/leon/.local/share/nvim/site/pack/packer/start/which-key.nvim"
|
||||
},
|
||||
["yats.vim"] = {
|
||||
loaded = true,
|
||||
path = "/home/leon/.local/share/nvim/site/pack/packer/start/yats.vim"
|
||||
|
|
|
@ -17,6 +17,9 @@ require("packer").startup(function(use)
|
|||
|
||||
use "simrat39/symbols-outline.nvim"
|
||||
|
||||
use "folke/which-key.nvim"
|
||||
|
||||
|
||||
-- better quickfix window
|
||||
use "kevinhwang91/nvim-bqf"
|
||||
|
||||
|
@ -43,7 +46,7 @@ require("packer").startup(function(use)
|
|||
"junegunn/goyo.vim",
|
||||
cmd = "Goyo",
|
||||
}
|
||||
use "liuchengxu/vim-which-key"
|
||||
|
||||
use "mhinz/vim-signify"
|
||||
use "tpope/vim-fugitive"
|
||||
use "preservim/nerdcommenter"
|
||||
|
|
Loading…
Reference in a new issue