-- Mapping data with "desc" stored directly by vim.keymap.set(). -- -- Please use this mappings table to set keyboard mapping since this is the -- lower level configuration and more robust one. (which-key will -- automatically pick-up stored data by this setting.) local utils = require "astronvim.utils" require("telescope").load_extension("refactoring") return { -- first key is the mode n = { -- second key is the lefthand side of the map -- mappings seen under group name "Buffer" ["bn"] = { "tabnew", desc = "New tab" }, -- quick save [""] = { ":w!", desc = "Save File" }, -- change description but the same command ["tp"] = { function() utils.toggle_term_cmd("ipython") end, desc = "ToggleTerm python" }, -- search and replace globally ['ss'] = {'lua require("spectre").toggle()', desc = "Toggle Spectre" }, ['sw'] = {'lua require("spectre").open_visual({select_word=true})', desc = "Search current word" }, ['sp'] ={'lua require("spectre").open_file_search({select_word=true})', desc = "Search on current file" }, -- refactoring ["ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Refactoring Inline Variable" }, ["rb"] = { function() require('refactoring').refactor('Extract Block') end, desc = "Extract Block" }, ["rbf"] = { function() require('refactoring').refactor('Extract Block To File') end, desc = "Extract Block To File" }, ["rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" }, ["rp"] = { function() require('refactoring').debug.printf({below = false}) end, desc = "Print debug info" }, ["rv"] = { function() require('refactoring').debug.print_var() end, desc = "Print debug var" }, ["rc"] = { function() require('refactoring').debug.cleanup({}) end, desc = "Cleanup debugging" }, }, v = { -- search and replace globally ['sw'] = {'lua require("spectre").open_visual()', desc = "Search current word" }, }, x = { -- refactoring ["ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Refactoring Inline Variable" }, ["re"] = { function() require('refactoring').refactor('Extract Function') end, desc = "Extract Function" }, ["rf"] = { function() require('refactoring').refactor('Extract Function To File') end, desc = "Extract Function To File" }, ["rv"] = { function() require('refactoring').refactor('Extract Variable') end, desc = "Extract Variable" }, ["rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" }, }, t = { -- setting a mapping to false will disable it -- [""] = false, }, }