chore(nvim): Better keymaps & removed unused plugins

This commit is contained in:
Pratik Tripathy
2024-12-15 21:49:59 +05:30
parent 80fdf243e3
commit c9b1826541
6 changed files with 54 additions and 330 deletions

View File

@@ -190,11 +190,9 @@ return {
desc = "Previous todo comment",
},
{ "<leader>dt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" },
{ "<leader>dT", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
-- TODO: Include hidden files
{ "<leader>lt", "<cmd>TodoTelescope<cr>", desc = "List Todo" },
{ "<leader>lT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "List Todo/Fix/Fixme" },
{ "<leader>fT", "<cmd>TodoTelescope<cr>", desc = "List Todo/Fix/Fixme" },
{ "<leader>ft", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "List Todo" },
},
},
@@ -280,29 +278,6 @@ return {
},
},
-- Inlay hints
{
"lvimuser/lsp-inlayhints.nvim",
cond = require("config.util").is_not_vscode(),
config = function()
require("lsp-inlayhints").setup()
-- Lazy load on LspAttach
vim.api.nvim_create_augroup("LspAttach_inlayhints", {})
vim.api.nvim_create_autocmd("LspAttach", {
group = "LspAttach_inlayhints",
callback = function(args)
if not (args.data and args.data.client_id) then
return
end
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
require("lsp-inlayhints").on_attach(client, bufnr)
end,
})
end,
},
-- LspSaga
{
@@ -406,7 +381,7 @@ return {
--
-- ["g?"] = actions.help(), -- Open mappings help window
{
"<leader>v",
"<leader>o",
function()
return require("nvim-navbuddy").open()
end,
@@ -414,137 +389,4 @@ return {
},
},
},
-- Refactor code: Refactoring book by Martin Fowler
{
"ThePrimeagen/refactoring.nvim",
cond = require("config.util").is_not_vscode(),
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
keys = {
{
"<leader>rs",
function()
require("telescope").extensions.refactoring.refactors()
end,
mode = "v",
desc = "Refactor",
},
{
"<leader>ri",
function()
require("refactoring").refactor("Inline Variable")
end,
mode = { "n", "v" },
desc = "Inline Variable",
},
{
"<leader>rb",
function()
require("refactoring").refactor("Extract Block")
end,
desc = "Extract Block",
},
{
"<leader>rf",
function()
require("refactoring").refactor("Extract Block To File")
end,
desc = "Extract Block To File",
},
{
"<leader>rP",
function()
require("refactoring").debug.printf({ below = false })
end,
desc = "Debug Print",
},
{
"<leader>rp",
function()
require("refactoring").debug.print_var({ normal = true })
end,
desc = "Debug Print Variable",
},
{
"<leader>rc",
function()
require("refactoring").debug.cleanup({})
end,
desc = "Debug Cleanup",
},
{
"<leader>rf",
function()
require("refactoring").refactor("Extract Function")
end,
mode = "v",
desc = "Extract Function",
},
{
"<leader>rF",
function()
require("refactoring").refactor("Extract Function To File")
end,
mode = "v",
desc = "Extract Function To File",
},
{
"<leader>rx",
function()
require("refactoring").refactor("Extract Variable")
end,
mode = "v",
desc = "Extract Variable",
},
{
"<leader>rp",
function()
require("refactoring").debug.print_var()
end,
mode = "v",
desc = "Debug Print Variable",
},
},
opts = {
prompt_func_return_type = {
go = false,
java = false,
cpp = false,
c = false,
h = false,
hpp = false,
cxx = false,
},
prompt_func_param_type = {
go = false,
java = false,
cpp = false,
c = false,
h = false,
hpp = false,
cxx = false,
},
printf_statements = {},
print_var_statements = {},
},
config = function(_, opts)
require("refactoring").setup(opts)
pcall(require("telescope").load_extension, "refactoring")
end,
},
-- which key integration
{
"folke/which-key.nvim",
optional = true,
opts = {
defaults = {
["<leader>r"] = { name = "+refactor" },
},
},
},
}