Skip to content

Commit

Permalink
fix: don't create select mode mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
mawkler authored Feb 11, 2024
1 parent 6bc91cd commit 5d85b74
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ use { "johmsalas/text-case.nvim",
end,
keys = {
"ga", -- Default invocation prefix
{ "ga.", "<cmd>TextCaseOpenTelescope<CR>", mode = { "n", "v" }, desc = "Telescope" },
{ "ga.", "<cmd>TextCaseOpenTelescope<CR>", mode = { "n", "x" }, desc = "Telescope" },
},
}
```
Expand Down
4 changes: 2 additions & 2 deletions lua/textcase/extensions/whichkey.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ function M.register(mode, mappings)
noremap = true,
nowait = true,
},
v = {
mode = "v",
x = {
mode = "x",
buffer = nil,
silent = true,
noremap = true,
Expand Down
4 changes: 2 additions & 2 deletions lua/textcase/plugin/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function M.register_keybindings(prefix, method_table, keybindings, opts)
if keybindings[feature] ~= nil then
local mode = "n"
if feature == "visual" then
mode = "v"
mode = "x"
end
local desc = method_table.desc

Expand Down Expand Up @@ -68,7 +68,7 @@ function M.register_keybindings(prefix, method_table, keybindings, opts)
.. "')<cr>"

vim.keymap.set("n", keybind, command, { desc = desc })
vim.keymap.set("v", keybind, command, { desc = desc })
vim.keymap.set("x", keybind, command, { desc = desc })
end
end

Expand Down
2 changes: 1 addition & 1 deletion lua/textcase/plugin/presets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local all_methods = {

-- Setup default keymappings for the plugin but only for the methods that are enabled.
local function setup_default_keymappings()
whichkey.register("v", {
whichkey.register("x", {
[M.options.prefix] = {
name = "text-case",
},
Expand Down
6 changes: 3 additions & 3 deletions tests/textcase/telescope/telescope_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("Telescope Integration", function()
describe("visual mode via ga. keymapping", function()
before_each(function()
vim.api.nvim_set_keymap("n", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
vim.api.nvim_set_keymap("v", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
vim.api.nvim_set_keymap("x", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
end)

local buffer_lines = {
Expand All @@ -70,7 +70,7 @@ describe("Telescope Integration", function()
describe("visual mode lines via ga. keymapping", function()
before_each(function()
vim.api.nvim_set_keymap("n", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
vim.api.nvim_set_keymap("v", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
vim.api.nvim_set_keymap("x", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
end)

local buffer_lines = {
Expand All @@ -97,7 +97,7 @@ describe("Telescope Integration", function()
describe("visual block mode via ga. keymapping", function()
before_each(function()
vim.api.nvim_set_keymap("n", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
vim.api.nvim_set_keymap("v", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
vim.api.nvim_set_keymap("x", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
end)

describe("when the words are aligned", function()
Expand Down

0 comments on commit 5d85b74

Please sign in to comment.