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