2021-07-04 16:22:16 +02:00
|
|
|
-- if not package.loaded['which-key'] then
|
|
|
|
-- return
|
|
|
|
-- end
|
2021-07-07 02:42:29 +02:00
|
|
|
local status_ok, which_key = pcall(require, "which-key")
|
|
|
|
if not status_ok then
|
|
|
|
return
|
|
|
|
end
|
2021-07-04 16:07:11 +02:00
|
|
|
|
2021-07-07 02:42:29 +02:00
|
|
|
which_key.setup {
|
2021-07-05 03:14:01 +02:00
|
|
|
plugins = {
|
|
|
|
marks = true, -- shows a list of your marks on ' and `
|
|
|
|
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
|
|
|
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
|
|
|
-- No actual key bindings are created
|
|
|
|
presets = {
|
|
|
|
operators = false, -- adds help for operators like d, y, ...
|
|
|
|
motions = false, -- adds help for motions
|
|
|
|
text_objects = false, -- help for text objects triggered after entering an operator
|
|
|
|
windows = true, -- default bindings on <c-w>
|
|
|
|
nav = true, -- misc bindings to work with windows
|
|
|
|
z = true, -- bindings for folds, spelling and others prefixed with z
|
|
|
|
g = true, -- bindings for prefixed with g
|
2021-06-30 00:55:01 +02:00
|
|
|
},
|
2021-07-05 03:14:01 +02:00
|
|
|
},
|
|
|
|
icons = {
|
|
|
|
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
|
|
|
separator = "➜", -- symbol used between a key and it's label
|
|
|
|
group = "+", -- symbol prepended to a group
|
|
|
|
},
|
|
|
|
window = {
|
|
|
|
border = "single", -- none, single, double, shadow
|
|
|
|
position = "bottom", -- bottom, top
|
|
|
|
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
|
|
|
|
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
|
|
|
|
},
|
|
|
|
layout = {
|
|
|
|
height = { min = 4, max = 25 }, -- min and max height of the columns
|
|
|
|
width = { min = 20, max = 50 }, -- min and max width of the columns
|
|
|
|
spacing = 3, -- spacing between columns
|
|
|
|
},
|
|
|
|
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
|
|
|
|
show_help = true, -- show help message on the command line when the popup is visible
|
2021-06-30 00:55:01 +02:00
|
|
|
}
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
-- Set leader
|
2021-07-05 03:14:01 +02:00
|
|
|
if O.leader_key == " " or O.leader_key == "space" then
|
|
|
|
vim.api.nvim_set_keymap("n", "<Space>", "<NOP>", { noremap = true, silent = true })
|
|
|
|
vim.g.mapleader = " "
|
2021-06-30 00:55:01 +02:00
|
|
|
else
|
2021-07-05 03:14:01 +02:00
|
|
|
vim.api.nvim_set_keymap("n", O.leader_key, "<NOP>", { noremap = true, silent = true })
|
|
|
|
vim.g.mapleader = O.leader_key
|
2021-06-30 00:55:01 +02:00
|
|
|
end
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
local opts = {
|
2021-07-05 03:14:01 +02:00
|
|
|
mode = "n", -- NORMAL mode
|
|
|
|
prefix = "<leader>",
|
|
|
|
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
|
|
|
silent = true, -- use `silent` when creating keymaps
|
|
|
|
noremap = true, -- use `noremap` when creating keymaps
|
|
|
|
nowait = false, -- use `nowait` when creating keymaps
|
2021-06-30 00:55:01 +02:00
|
|
|
}
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
-- no hl
|
2021-07-05 03:14:01 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<Leader>h", ':let @/=""<CR>', { noremap = true, silent = true })
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
-- explorer
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-07-05 03:14:01 +02:00
|
|
|
vim.api.nvim_set_keymap(
|
|
|
|
"n",
|
|
|
|
"<Leader>e",
|
|
|
|
":lua require'lv-nvimtree'.toggle_tree()<CR>",
|
|
|
|
{ noremap = true, silent = true }
|
|
|
|
)
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-07-06 17:30:01 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<Leader>f", ":Telescope find_files<CR>", { noremap = true, silent = true })
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
-- dashboard
|
2021-07-05 03:14:01 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<Leader>;", ":Dashboard<CR>", { noremap = true, silent = true })
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
-- Comments
|
2021-07-05 03:14:01 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<leader>/", ":CommentToggle<CR>", { noremap = true, silent = true })
|
|
|
|
vim.api.nvim_set_keymap("v", "<leader>/", ":CommentToggle<CR>", { noremap = true, silent = true })
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
-- close buffer
|
2021-07-05 22:17:51 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", { noremap = true, silent = true })
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-07-07 05:08:53 +02:00
|
|
|
-- open lv-config
|
|
|
|
vim.api.nvim_set_keymap(
|
|
|
|
"n",
|
|
|
|
"<leader>.",
|
|
|
|
":e " .. CONFIG_PATH .. "/lv-config.lua<CR>",
|
|
|
|
{ noremap = true, silent = true }
|
|
|
|
)
|
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
local mappings = {
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-07-07 05:08:53 +02:00
|
|
|
["."] = "LunarConfig",
|
2021-07-05 03:14:01 +02:00
|
|
|
["/"] = "Comment",
|
|
|
|
["c"] = "Close Buffer",
|
|
|
|
["e"] = "Explorer",
|
|
|
|
["f"] = "Find File",
|
|
|
|
["h"] = "No Highlight",
|
2021-07-07 05:08:53 +02:00
|
|
|
[";"] = "Dashboard",
|
2021-07-05 03:14:01 +02:00
|
|
|
b = {
|
|
|
|
name = "Buffers",
|
|
|
|
j = { "<cmd>BufferPick<cr>", "jump to buffer" },
|
2021-07-06 17:30:01 +02:00
|
|
|
f = { "<cmd>Telescope buffers<cr>", "Find buffer" },
|
2021-07-05 03:14:01 +02:00
|
|
|
w = { "<cmd>BufferWipeout<cr>", "wipeout buffer" },
|
|
|
|
e = {
|
|
|
|
"<cmd>BufferCloseAllButCurrent<cr>",
|
|
|
|
"close all but current buffer",
|
|
|
|
},
|
|
|
|
h = { "<cmd>BufferCloseBuffersLeft<cr>", "close all buffers to the left" },
|
|
|
|
l = {
|
|
|
|
"<cmd>BufferCloseBuffersRight<cr>",
|
|
|
|
"close all BufferLines to the right",
|
2021-06-30 00:55:01 +02:00
|
|
|
},
|
2021-07-05 03:14:01 +02:00
|
|
|
D = {
|
|
|
|
"<cmd>BufferOrderByDirectory<cr>",
|
|
|
|
"sort BufferLines automatically by directory",
|
|
|
|
},
|
|
|
|
L = {
|
|
|
|
"<cmd>BufferOrderByLanguage<cr>",
|
|
|
|
"sort BufferLines automatically by language",
|
|
|
|
},
|
|
|
|
},
|
2021-07-05 22:17:51 +02:00
|
|
|
p = {
|
|
|
|
name = "Packer",
|
|
|
|
c = { "<cmd>PackerCompile<cr>", "Compile" },
|
|
|
|
i = { "<cmd>PackerInstall<cr>", "Install" },
|
2021-07-07 01:15:37 +02:00
|
|
|
r = { "<cmd>lua require('lv-utils').reload_lv_config()<cr>", "Reload" },
|
2021-07-05 22:17:51 +02:00
|
|
|
s = { "<cmd>PackerSync<cr>", "Sync" },
|
|
|
|
u = { "<cmd>PackerUpdate<cr>", "Update" },
|
|
|
|
},
|
2021-06-30 00:55:01 +02:00
|
|
|
|
2021-07-05 03:14:01 +02:00
|
|
|
-- " Available Debug Adapters:
|
|
|
|
-- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
|
|
|
|
-- " Adapter configuration and installation instructions:
|
|
|
|
-- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation
|
|
|
|
-- " Debug Adapter protocol:
|
|
|
|
-- " https://microsoft.github.io/debug-adapter-protocol/
|
|
|
|
-- " Debugging
|
2021-07-05 06:52:36 +02:00
|
|
|
d = {
|
2021-07-05 22:17:51 +02:00
|
|
|
name = "Debug",
|
|
|
|
t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" },
|
|
|
|
b = { "<cmd>lua require'dap'.step_back()<cr>", "Step Back" },
|
|
|
|
c = { "<cmd>lua require'dap'.continue()<cr>", "Continue" },
|
|
|
|
C = { "<cmd>lua require'dap'.run_to_cursor()<cr>", "Run To Cursor" },
|
|
|
|
d = { "<cmd>lua require'dap'.disconnect()<cr>", "Disconnect" },
|
|
|
|
g = { "<cmd>lua require'dap'.session()<cr>", "Get Session" },
|
|
|
|
i = { "<cmd>lua require'dap'.step_into()<cr>", "Step Into" },
|
|
|
|
o = { "<cmd>lua require'dap'.step_over()<cr>", "Step Over" },
|
|
|
|
u = { "<cmd>lua require'dap'.step_out()<cr>", "Step Out" },
|
|
|
|
p = { "<cmd>lua require'dap'.pause.toggle()<cr>", "Pause" },
|
|
|
|
r = { "<cmd>lua require'dap'.repl.toggle()<cr>", "Toggle Repl" },
|
|
|
|
s = { "<cmd>lua require'dap'.continue()<cr>", "Start" },
|
|
|
|
q = { "<cmd>lua require'dap'.stop()<cr>", "Quit" },
|
2021-07-05 06:52:36 +02:00
|
|
|
},
|
2021-07-05 03:14:01 +02:00
|
|
|
g = {
|
|
|
|
name = "Git",
|
|
|
|
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
|
|
|
|
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
|
|
|
|
l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
|
|
|
|
p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
|
|
|
|
r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
|
|
|
|
R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
|
|
|
|
s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
|
|
|
|
u = {
|
|
|
|
"<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
|
|
|
|
"Undo Stage Hunk",
|
2021-06-30 00:55:01 +02:00
|
|
|
},
|
2021-07-05 03:14:01 +02:00
|
|
|
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
|
|
|
|
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
|
|
|
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
|
|
|
|
C = {
|
|
|
|
"<cmd>Telescope git_bcommits<cr>",
|
|
|
|
"Checkout commit(for current file)",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
l = {
|
|
|
|
name = "LSP",
|
2021-07-05 08:57:06 +02:00
|
|
|
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
|
2021-07-05 03:14:01 +02:00
|
|
|
d = {
|
|
|
|
"<cmd>Telescope lsp_document_diagnostics<cr>",
|
|
|
|
"Document Diagnostics",
|
|
|
|
},
|
2021-07-05 08:57:06 +02:00
|
|
|
w = {
|
2021-07-05 03:14:01 +02:00
|
|
|
"<cmd>Telescope lsp_workspace_diagnostics<cr>",
|
|
|
|
"Workspace Diagnostics",
|
2021-06-30 00:55:01 +02:00
|
|
|
},
|
2021-07-07 02:50:57 +02:00
|
|
|
f = { "<cmd>Neoformat<cr>", "Format" },
|
2021-07-05 03:14:01 +02:00
|
|
|
i = { "<cmd>LspInfo<cr>", "Info" },
|
2021-07-05 16:43:37 +02:00
|
|
|
j = { "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<cr>", "Next Diagnostic" },
|
|
|
|
k = { "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<cr>", "Prev Diagnostic" },
|
2021-07-05 03:14:01 +02:00
|
|
|
q = { "<cmd>Telescope quickfix<cr>", "Quickfix" },
|
2021-07-05 08:57:06 +02:00
|
|
|
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
|
2021-06-30 00:55:01 +02:00
|
|
|
s = {
|
2021-07-05 03:14:01 +02:00
|
|
|
O.plugin.symbol_outline.active and "<cmd>SymbolsOutline<cr>" or "<cmd> Telescope lsp_document_symbols<cr>",
|
|
|
|
"Document Symbols",
|
2021-06-30 00:55:01 +02:00
|
|
|
},
|
|
|
|
S = {
|
2021-07-05 03:14:01 +02:00
|
|
|
"<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
|
|
|
|
"Workspace Symbols",
|
2021-07-02 18:28:16 +02:00
|
|
|
},
|
2021-07-05 03:14:01 +02:00
|
|
|
},
|
|
|
|
s = {
|
|
|
|
name = "Search",
|
|
|
|
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
|
|
|
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
|
2021-07-06 17:30:01 +02:00
|
|
|
f = { "<cmd>Telescope find_files<cr>", "Find File" },
|
2021-07-05 03:14:01 +02:00
|
|
|
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
|
|
|
|
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
|
2021-07-06 17:30:01 +02:00
|
|
|
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
|
2021-07-05 03:14:01 +02:00
|
|
|
R = { "<cmd>Telescope registers<cr>", "Registers" },
|
2021-07-06 17:30:01 +02:00
|
|
|
t = { "<cmd>Telescope live_grep<cr>", "Text" },
|
2021-07-05 03:14:01 +02:00
|
|
|
},
|
|
|
|
S = {
|
|
|
|
name = "Session",
|
|
|
|
s = { "<cmd>SessionSave<cr>", "Save Session" },
|
|
|
|
l = { "<cmd>SessionLoad<cr>", "Load Session" },
|
|
|
|
},
|
|
|
|
T = {
|
|
|
|
name = "Treesitter",
|
|
|
|
i = { ":TSConfigInfo<cr>", "Info" },
|
|
|
|
},
|
2021-06-30 00:55:01 +02:00
|
|
|
}
|
2021-06-26 20:34:59 +02:00
|
|
|
|
2021-07-05 06:52:36 +02:00
|
|
|
-- if O.plugin.trouble.active then
|
|
|
|
-- mappings["d"] = {
|
|
|
|
-- name = "Diagnostics",
|
|
|
|
-- t = { "<cmd>TroubleToggle<cr>", "trouble" },
|
|
|
|
-- w = { "<cmd>TroubleToggle lsp_workspace_diagnostics<cr>", "workspace" },
|
|
|
|
-- d = { "<cmd>TroubleToggle lsp_document_diagnostics<cr>", "document" },
|
|
|
|
-- q = { "<cmd>TroubleToggle quickfix<cr>", "quickfix" },
|
|
|
|
-- l = { "<cmd>TroubleToggle loclist<cr>", "loclist" },
|
|
|
|
-- r = { "<cmd>TroubleToggle lsp_references<cr>", "references" },
|
|
|
|
-- }
|
|
|
|
-- end
|
2021-06-30 04:45:48 +02:00
|
|
|
|
2021-07-06 16:03:42 +02:00
|
|
|
if O.plugin.symbol_outline.active then
|
2021-07-06 17:30:01 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<leader>o", ":SymbolsOutline<CR>", { noremap = true, silent = true })
|
|
|
|
mappings["o"] = "Symbols outline"
|
2021-07-05 03:14:01 +02:00
|
|
|
end
|
2021-07-02 18:28:16 +02:00
|
|
|
|
|
|
|
if O.plugin.ts_playground.active then
|
2021-07-05 03:14:01 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<leader>Th", ":TSHighlightCapturesUnderCursor<CR>", { noremap = true, silent = true })
|
|
|
|
mappings[""] = "Highlight Capture"
|
2021-07-02 18:28:16 +02:00
|
|
|
end
|
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
if O.plugin.zen.active then
|
2021-07-05 03:14:01 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<leader>z", ":ZenMode<CR>", { noremap = true, silent = true })
|
|
|
|
mappings["z"] = "Zen"
|
2021-06-30 00:55:01 +02:00
|
|
|
end
|
2021-07-06 19:40:10 +02:00
|
|
|
if O.plugin.floatterm.active then
|
|
|
|
vim.api.nvim_set_keymap("n", "<leader>gg", "<CMD>lua _G.__fterm_lazygit()<CR>", { noremap = true, silent = true })
|
|
|
|
vim.api.nvim_set_keymap("n", "<A-i>", "<CMD>lua require('FTerm').toggle()<CR>", { noremap = true, silent = true })
|
2021-07-07 01:15:37 +02:00
|
|
|
vim.api.nvim_set_keymap(
|
|
|
|
"t",
|
|
|
|
"<A-i>",
|
|
|
|
"<C-\\><C-n><CMD>lua require('FTerm').toggle()<CR>",
|
|
|
|
{ noremap = true, silent = true }
|
|
|
|
)
|
2021-07-06 19:40:10 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<A-l>", "<CMD>lua _G.__fterm_lazygit()<CR>", { noremap = true, silent = true })
|
2021-07-07 01:15:37 +02:00
|
|
|
vim.api.nvim_set_keymap(
|
|
|
|
"t",
|
|
|
|
"<A-l>",
|
|
|
|
"<C-\\><C-n><CMD>lua _G.__fterm_lazygit()<CR>",
|
|
|
|
{ noremap = true, silent = true }
|
|
|
|
)
|
2021-07-05 03:14:01 +02:00
|
|
|
mappings["gg"] = "LazyGit"
|
2021-07-01 04:32:35 +02:00
|
|
|
end
|
2021-07-02 03:06:07 +02:00
|
|
|
if O.plugin.telescope_project.active then
|
2021-07-05 03:14:01 +02:00
|
|
|
-- open projects
|
|
|
|
vim.api.nvim_set_keymap(
|
|
|
|
"n",
|
2021-07-06 07:39:37 +02:00
|
|
|
"<leader>P",
|
2021-07-05 03:14:01 +02:00
|
|
|
":lua require'telescope'.extensions.project.project{}<CR>",
|
|
|
|
{ noremap = true, silent = true }
|
|
|
|
)
|
2021-07-05 21:35:06 +02:00
|
|
|
mappings["P"] = "Projects"
|
2021-06-30 00:55:01 +02:00
|
|
|
end
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
-- [";"] = "Dashboard",
|
2021-06-28 18:45:45 +02:00
|
|
|
|
2021-06-30 00:55:01 +02:00
|
|
|
if O.lang.latex.active then
|
2021-07-05 03:14:01 +02:00
|
|
|
mappings["L"] = {
|
|
|
|
name = "+Latex",
|
|
|
|
c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" },
|
|
|
|
f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" },
|
|
|
|
i = { "<cmd>VimtexInfo<cr>", "Project Information" },
|
|
|
|
s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" },
|
|
|
|
t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" },
|
|
|
|
v = { "<cmd>VimtexView<cr>", "View PDF" },
|
|
|
|
}
|
2021-06-30 00:55:01 +02:00
|
|
|
end
|
2021-06-26 19:20:07 +02:00
|
|
|
|
2021-07-02 18:28:16 +02:00
|
|
|
if O.lushmode then
|
2021-07-05 03:14:01 +02:00
|
|
|
mappings["L"] = {
|
|
|
|
name = "+Lush",
|
|
|
|
l = { ":Lushify<cr>", "Lushify" },
|
|
|
|
x = { ":lua require('lush').export_to_buffer(require('lush_theme.cool_name'))", "Lush Export" },
|
|
|
|
t = { ":LushRunTutorial<cr>", "Lush Tutorial" },
|
|
|
|
q = { ":LushRunQuickstart<cr>", "Lush Quickstart" },
|
|
|
|
}
|
2021-07-02 18:28:16 +02:00
|
|
|
end
|
|
|
|
|
2021-07-07 03:42:26 +02:00
|
|
|
-- for _, v in pairs(O.user_which_key) do
|
|
|
|
-- end
|
|
|
|
for k, v in pairs(O.user_which_key) do
|
|
|
|
mappings[k] = v
|
|
|
|
-- table.insert(mappings, O.user_which_key[1])
|
|
|
|
-- print(k)
|
|
|
|
-- print(v)
|
|
|
|
end
|
|
|
|
|
2021-07-05 03:14:01 +02:00
|
|
|
local wk = require "which-key"
|
2021-06-30 00:55:01 +02:00
|
|
|
wk.register(mappings, opts)
|