nvim: use Telescope for text-case instead of default mappings

This commit is contained in:
Fernando Schauenburg 2024-07-21 01:27:30 +02:00
parent 37aec2fac7
commit 19c3cd9ab8

View file

@ -1,7 +1,59 @@
local description = "󰬴 [c]hange text [c]ase"
local theme = function()
return require("telescope.themes").get_cursor()
end
return { return {
"johmsalas/text-case.nvim", "johmsalas/text-case.nvim",
event = { "BufReadPost", "BufNewFile" }, dependencies = "nvim-telescope/telescope.nvim",
opts = { prefix = "<leader>c" }, cmd = {
"TextCaseOpenTelescope",
"TextCaseOpenTelescopeQuickChange",
"TextCaseOpenTelescopeLSPChange",
"TextCaseStartReplacingCommand",
},
keys = {
{
"<leader>cc",
function()
require("telescope").extensions.textcase.normal_mode(theme())
end,
mode = "n",
desc = description,
},
--[[
Ideally this would be the mapping for visual mode, but it doesn't work
due to bugs in textcase.
{
"<leader>cc",
function()
require("telescope").extensions.textcase.visual_mode(theme())
end,
mode = "v",
desc = description,
},
The mapping below works, but I can't set the theme to `cursor`.
--]]
{
"<leader>cc",
"<cmd>TextCaseOpenTelescope<cr>",
mode = "v",
desc = description,
},
},
config = function()
require("textcase").setup {
default_keymappings_enabled = false,
}
require("telescope").load_extension("textcase")
end,
} }