-- -----------------------------------------------------------------------------
-- -------------------------------- KEYBINDS -----------------------------------
-- -----------------------------------------------------------------------------
-- --------------------------------- Keymaps -----------------------------------
-- Initialize dependencies
local substitute_loaded, substitute = pcall(require, "substitute")
local codesnap_loaded = pcall(require, "codesnap")
local icon_picker_loaded = pcall(require, "icon-picker")
local gist_loaded = pcall(require, "gist")
local rootiest = require("config.rootiest")
-- Initialize which-key
local wk = require("which-key")
wk.add({
{
"",
":ToggleTerm",
desc = "Toggle Terminal",
},
{
"gt",
rhs = function()
rootiest.toggle_lazygit_term()
end,
desc = "LazyGit Terminal",
},
-- Icon Picker group
{
mode = "n",
lhs = "I",
group = "IconPicker",
icon = { icon = "", color = "orange" },
cond = function()
return icon_picker_loaded
end,
},
-- Pick Icon
{
mode = "n",
lhs = "Ii",
rhs = "IconPickerNormal",
desc = "Pick Icon",
group = "IconPicker",
cond = function()
return icon_picker_loaded
end,
},
-- Yank Icon
{
mode = "n",
lhs = "Iy",
rhs = "IconPickerYank",
desc = "Yank Icon",
group = "IconPicker",
cond = function()
return icon_picker_loaded
end,
},
-- Insert Icon in insert mode
{
mode = "i",
lhs = "",
rhs = "IconPickerInsert",
desc = "Insert Icon",
group = "IconPicker",
cond = function()
return icon_picker_loaded
end,
},
-- Gists group
{
mode = "n",
lhs = "gn",
group = "Gists",
icon = { icon = "", color = "orange" },
cond = function()
return gist_loaded
end,
},
-- Create Gist
{
mode = { "n", "x" },
lhs = "gnc",
rhs = "GistCreate",
desc = "Create Gist",
cond = function()
return gist_loaded
end,
},
-- Find Gists
{
mode = "n",
lhs = "gnf",
rhs = "GistList",
desc = "Find Gists",
cond = function()
return gist_loaded
end,
},
{
"l",
group = "Lazy",
},
{
"lv",
"Lazy",
desc = "LazyVim",
},
{
"lx",
"LazyExtras",
desc = "LazyExtras",
},
{
"m",
group = "MiniMap",
icon = { icon = "", color = "yellow" },
},
-- Save selected code snapshot into clipboard
{
mode = "x",
lhs = "cy",
rhs = "CodeSnap",
desc = "Save selected code snapshot into clipboard",
cond = function()
return codesnap_loaded
end,
},
-- Save selected code snapshot in ~/Pictures
{
mode = "x",
lhs = "cs",
rhs = "CodeSnapSave",
desc = "Save selected code snapshot in ~/Pictures",
cond = function()
return codesnap_loaded
end,
},
-- Highlight and snapshot selected code into clipboard
{
mode = "x",
lhs = "ch",
rhs = "CodeSnapHighlight",
desc = "Highlight and snapshot selected code into clipboard",
cond = function()
return codesnap_loaded
end,
},
-- Save ASCII code snapshot into clipboard
{
mode = "x",
lhs = "ci",
rhs = "CodeSnapASCII",
desc = "Save ASCII code snapshot into clipboard",
cond = function()
return codesnap_loaded
end,
},
{
"gx",
"Browse",
mode = { "n", "x" },
desc = "Open URL/Link",
},
{
"lg",
"LazyGit",
desc = "LazyGit",
},
{
"fs",
rhs = function()
require("rip-substitute").sub()
end,
mode = { "n", "x" },
desc = "Rip Substitute",
},
{
"",
rhs = function()
require("kitty-navigator").navigateLeft()
end,
desc = "KittyNavigateLeft",
cond = function() -- Using Kitty
return rootiest.using_kitty()
end,
},
{
"",
rhs = function()
require("kitty-navigator").navigateDown()
end,
desc = "KittyNavigateDown",
cond = function() -- Using Kitty
return rootiest.using_kitty()
end,
},
{
"",
rhs = function()
require("kitty-navigator").navigateUp()
end,
desc = "KittyNavigateUp",
cond = function() -- Using Kitty
return rootiest.using_kitty()
end,
},
{
"",
rhs = function()
require("kitty-navigator").navigateRight()
end,
desc = "KittyNavigateRight",
cond = function() -- Using Kitty
return rootiest.using_kitty()
end,
},
{
"zk",
rhs = function()
rootiest.toggle_precognition()
end,
desc = "Toggle Precognition",
},
{
"a",
"Alternate",
desc = "Toggle Alternate",
cond = function()
return (
vim.bo.filetype == "c"
or vim.bo.filetype == "h"
or vim.bo.filetype == "cpp"
or vim.bo.filetype == "hpp"
)
end,
},
{
"wt",
rhs = function()
require("transparent").toggle()
end,
desc = "Toggle Transparency",
},
{
mode = "x",
lhs = "r",
rhs = function()
require("substitute").visual()
end,
desc = "Substitute",
},
{
"yo",
rhs = function()
rootiest.yank_line()
end,
desc = "Yank Line-text",
},
{ -- Toggle Hardmode with Hints
"h",
rhs = function()
rootiest.toggle_hardmode()
end,
desc = "Toggle Hardmode",
},
{ -- Toggle ZenMode
"z",
rhs = function()
require("zen-mode").toggle()
end,
desc = "Toggle ZenMode",
},
-- Substitute operator in normal mode
{
mode = "n",
lhs = "x",
rhs = function()
substitute.operator()
end,
desc = "Substitute operator",
cond = function()
return substitute_loaded
end,
},
-- Substitute line in normal mode
{
mode = "n",
lhs = "xx",
rhs = function()
substitute.line()
end,
desc = "Substitute line",
cond = function()
return substitute_loaded
end,
},
-- Substitute end of line in normal mode
{
mode = "n",
lhs = "X",
rhs = function()
substitute.eol()
end,
desc = "Substitute end of line",
cond = function()
return substitute_loaded
end,
},
-- Substitute visual selection in visual mode
{
mode = "x",
lhs = "x",
rhs = function()
substitute.visual()
end,
desc = "Substitute visual selection",
cond = function()
return substitute_loaded
end,
},
{ "u,", group = "Font" },
{ "u,l", "Nekifoch list", desc = "Fonts list" },
{
"u,c",
"Nekifoch check",
desc = "Check current font settings",
},
{
"u,f",
rhs = function()
require("nekifoch.nui_set_font")()
end,
desc = "Set font family",
},
{
"u,s",
rhs = function()
require("nekifoch.nui_set_size")()
end,
desc = "Set font size",
},
{ -- Yank buffer contents
"Y",
"%y",
desc = "Yank buffer contents",
},
})