pojokcodeid.nvim-lazy/lua/user/whichkey.lua

114 lines
4.3 KiB
Lua
Raw Normal View History

2023-01-15 00:17:41 +07:00
local status_ok, which_key = pcall(require, "which-key")
if not status_ok then
return
end
2023-04-18 08:13:36 +07:00
-- config for toggleterm
2024-02-29 06:45:01 +07:00
function _SET_TAB_TITLE()
-- set tab title
2024-05-21 08:33:21 +07:00
vim.cmd('silent !wezterm cli set-tab-title "' .. require("user.utils.whichkey")._get_folder_name() .. '"')
2024-03-21 08:08:27 +07:00
end
2024-04-18 07:17:54 +07:00
local icons = require("user.icons")
2023-01-15 00:17:41 +07:00
local setup = {
plugins = {
2024-04-18 07:17:54 +07:00
marks = false, -- shows a list of your marks on ' and `
registers = false, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
2023-01-15 00:17:41 +07:00
spelling = {
2024-04-18 07:17:54 +07:00
enabled = true,
suggestions = 20,
}, -- use which-key for spelling hints
2023-01-15 00:17:41 +07:00
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created
presets = {
2024-04-18 07:17:54 +07:00
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 = false, -- default bindings on <c-w>
nav = false, -- misc bindings to work with windows
z = false, -- bindings for folds, spelling and others prefixed with z
g = false, -- bindings for prefixed with g
2023-01-15 00:17:41 +07:00
},
2024-04-18 07:17:54 +07:00
}, -- add operators that will trigger motion and text object completion
2023-01-15 00:17:41 +07:00
-- to enable all native operators, set the preset / operators plugin above
-- operators = { gc = "Comments" },
key_labels = {
-- override the label used to display some keys. It doesn't effect WK in any other way.
-- For example:
-- ["<space>"] = "SPC",
-- ["<cr>"] = "RET",
-- ["<tab>"] = "TAB",
},
icons = {
2024-04-18 07:17:54 +07:00
breadcrumb = icons.ui.DoubleChevronRight, -- symbol used in the command line area that shows your active key combo
separator = icons.ui.BoldArrowRight, -- symbol used between a key and it's label
group = icons.ui.Plus, -- symbol prepended to a group
2023-01-15 00:17:41 +07:00
},
popup_mappings = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup
},
window = {
2023-02-12 07:52:40 +07:00
border = "rounded", -- none, single, double, shadow
2023-01-15 00:17:41 +07:00
position = "bottom", -- bottom, top
2024-04-18 07:17:54 +07:00
margin = { 1, 1, 1, 1 }, -- extra window margin [top, right, bottom, left]
2023-01-15 00:17:41 +07:00
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
winblend = 0,
},
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
align = "left", -- align columns left, center or right
},
ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label
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
2024-04-18 07:17:54 +07:00
show_keys = true, -- show the currently pressed key and its label as a message in the command line
2023-01-15 00:17:41 +07:00
triggers = "auto", -- automatically setup triggers
-- triggers = {"<leader>"} -- or specify a list manually
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for key maps that start with a native binding
-- most people should not need to change this
i = { "j", "k" },
v = { "j", "k" },
},
2024-04-18 07:17:54 +07:00
-- Disabled by default for Telescope
disable = {
buftypes = {},
filetypes = { "TelescopePrompt" },
},
2023-01-15 00:17:41 +07:00
}
local opts = {
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 = true, -- use `nowait` when creating keymaps
}
local opts2 = {
mode = "v", -- 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 = true, -- use `nowait` when creating keymaps
}
2023-02-22 10:52:37 +07:00
local wkey = {}
local data_exists, key = pcall(require, "core.config")
2023-02-22 10:52:37 +07:00
if data_exists then
wkey = key.whichkey
2023-02-22 10:52:37 +07:00
end
2023-01-15 00:17:41 +07:00
which_key.setup(setup)
2024-05-21 08:33:21 +07:00
which_key.register(require("user.utils.whichkey").mappings, opts)
2023-02-22 10:52:37 +07:00
which_key.register(wkey, opts)
2024-05-21 08:33:21 +07:00
which_key.register(require("user.utils.whichkey").mappings2, opts2)