feat(home/base/tui/editors/neovim): astronvim v4 - leader => Leader

This commit is contained in:
Ryan Yin
2024-04-13 00:32:46 +08:00
parent c5dcc7e24d
commit ac844a6a3d
@@ -43,7 +43,7 @@ return {
}, },
g = { -- vim.g.<key> g = { -- vim.g.<key>
-- configure global vim variables (vim.g) -- configure global vim variables (vim.g)
-- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` -- NOTE: `mapLeader` and `maplocalLeader` must be set in the AstroNvim opts or before `lazy.setup`
-- This can be found in the `lua/lazy_setup.lua` file -- This can be found in the `lua/lazy_setup.lua` file
}, },
}, },
@@ -73,7 +73,7 @@ return {
-- second key is the lefthand side of the map -- second key is the lefthand side of the map
-- mappings seen under group name "Buffer" -- mappings seen under group name "Buffer"
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" }, ["<Leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
-- quick save -- quick save
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
@@ -82,51 +82,51 @@ return {
-- 1. If {cmd} is a List it runs directly (no 'shell') -- 1. If {cmd} is a List it runs directly (no 'shell')
-- 2. If {cmd} is a String it runs in the 'shell' -- 2. If {cmd} is a String it runs in the 'shell'
-- search and replace globally -- search and replace globally
["<leader>ss"] = { '<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" }, ["<Leader>ss"] = { '<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" },
["<leader>sw"] = { ["<Leader>sw"] = {
'<cmd>lua require("spectre").open_visual({select_word=true})<CR>', '<cmd>lua require("spectre").open_visual({select_word=true})<CR>',
desc = "Search current word", desc = "Search current word",
}, },
["<leader>sp"] = { ["<Leader>sp"] = {
'<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>',
desc = "Search on current file", desc = "Search on current file",
}, },
-- refactoring -- refactoring
["<leader>ri"] = { ["<Leader>ri"] = {
function() require("refactoring").refactor "Inline Variable" end, function() require("refactoring").refactor "Inline Variable" end,
desc = "Inverse of extract variable", desc = "Inverse of extract variable",
}, },
["<leader>rb"] = { function() require("refactoring").refactor "Extract Block" end, desc = "Extract Block" }, ["<Leader>rb"] = { function() require("refactoring").refactor "Extract Block" end, desc = "Extract Block" },
["<leader>rbf"] = { ["<Leader>rbf"] = {
function() require("refactoring").refactor "Extract Block To File" end, function() require("refactoring").refactor "Extract Block To File" end,
desc = "Extract Block To File", desc = "Extract Block To File",
}, },
["<leader>rr"] = { ["<Leader>rr"] = {
function() require("telescope").extensions.refactoring.refactors() end, function() require("telescope").extensions.refactoring.refactors() end,
desc = "Prompt for a refactor to apply", desc = "Prompt for a refactor to apply",
}, },
["<leader>rp"] = { ["<Leader>rp"] = {
function() require("refactoring").debug.printf { below = false } end, function() require("refactoring").debug.printf { below = false } end,
desc = "Insert print statement to mark the calling of a function", desc = "Insert print statement to mark the calling of a function",
}, },
["<leader>rv"] = { ["<Leader>rv"] = {
function() require("refactoring").debug.print_var() end, function() require("refactoring").debug.print_var() end,
desc = "Insert print statement to print a variable", desc = "Insert print statement to print a variable",
}, },
["<leader>rc"] = { ["<Leader>rc"] = {
function() require("refactoring").debug.cleanup {} end, function() require("refactoring").debug.cleanup {} end,
desc = "Cleanup of all generated print statements", desc = "Cleanup of all generated print statements",
}, },
-- yank_history -- yank_history
["<leader>yh"] = { ["<Leader>yh"] = {
function() require("telescope").extensions.yank_history.yank_history() end, function() require("telescope").extensions.yank_history.yank_history() end,
desc = "Preview Yank History", desc = "Preview Yank History",
}, },
-- undo history -- undo history
["<leader>uh"] = { "<cmd>Telescope undo<cr>", desc = "Telescope undo" }, ["<Leader>uh"] = { "<cmd>Telescope undo<cr>", desc = "Telescope undo" },
-- implementation/definition preview -- implementation/definition preview
["gpd"] = { "<cmd>lua require('goto-preview').goto_preview_definition()<CR>", desc = "goto_preview_definition" }, ["gpd"] = { "<cmd>lua require('goto-preview').goto_preview_definition()<CR>", desc = "goto_preview_definition" },
@@ -148,28 +148,28 @@ return {
-- Visual mode -- Visual mode
v = { v = {
-- search and replace globally -- search and replace globally
["<leader>sw"] = { '<esc><cmd>lua require("spectre").open_visual()<CR>', desc = "Search current word" }, ["<Leader>sw"] = { '<esc><cmd>lua require("spectre").open_visual()<CR>', desc = "Search current word" },
}, },
-- visual mode(what's the difference between v and x???) -- visual mode(what's the difference between v and x???)
x = { x = {
-- refactoring -- refactoring
["<leader>ri"] = { ["<Leader>ri"] = {
function() require("refactoring").refactor "Inline Variable" end, function() require("refactoring").refactor "Inline Variable" end,
desc = "Inverse of extract variable", desc = "Inverse of extract variable",
}, },
["<leader>re"] = { ["<Leader>re"] = {
function() require("refactoring").refactor "Extract Function" end, function() require("refactoring").refactor "Extract Function" end,
desc = "Extracts the selected code to a separate function", desc = "Extracts the selected code to a separate function",
}, },
["<leader>rf"] = { ["<Leader>rf"] = {
function() require("refactoring").refactor "Extract Function To File" end, function() require("refactoring").refactor "Extract Function To File" end,
desc = "Extract Function To File", desc = "Extract Function To File",
}, },
["<leader>rv"] = { ["<Leader>rv"] = {
function() require("refactoring").refactor "Extract Variable" end, function() require("refactoring").refactor "Extract Variable" end,
desc = "Extracts occurrences of a selected expression to its own variable", desc = "Extracts occurrences of a selected expression to its own variable",
}, },
["<leader>rr"] = { ["<Leader>rr"] = {
function() require("telescope").extensions.refactoring.refactors() end, function() require("telescope").extensions.refactoring.refactors() end,
desc = "Prompt for a refactor to apply", desc = "Prompt for a refactor to apply",
}, },