aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_defaults.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2024-10-04 10:34:21 -0500
committerGitHub <noreply@github.com>2024-10-04 10:34:21 -0500
commit289380bc40c7932c0fdfb406ec37a68745ba1cc9 (patch)
tree03ca0b4c429831fa47a18c6c02f8cb57c3b223fb /runtime/lua/vim/_defaults.lua
parent9a5bbaf813df598fafb7456c44d528e02648c1d8 (diff)
downloadrneovim-289380bc40c7932c0fdfb406ec37a68745ba1cc9.tar.gz
rneovim-289380bc40c7932c0fdfb406ec37a68745ba1cc9.tar.bz2
rneovim-289380bc40c7932c0fdfb406ec37a68745ba1cc9.zip
fix(defaults): use "range" instead of "count" for some mappings (#30642)
Some commands don't accept "count" and only work with "range". It's not clear why. The issue is tracked at [1], but this is a workaround for now. [1]: https://github.com/neovim/neovim/issues/30641
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
-rw-r--r--runtime/lua/vim/_defaults.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
index 6dd1c938de..6cad1dbca9 100644
--- a/runtime/lua/vim/_defaults.lua
+++ b/runtime/lua/vim/_defaults.lua
@@ -293,7 +293,8 @@ do
})
vim.keymap.set('n', ']a', function()
- vim.cmd.next({ count = vim.v.count1 })
+ -- count doesn't work with :next, must use range. See #30641.
+ vim.cmd.next({ range = { vim.v.count1 } })
end, {
desc = ':next',
})
@@ -320,32 +321,37 @@ do
-- Tags
vim.keymap.set('n', '[t', function()
- vim.cmd.tprevious({ count = vim.v.count1 })
+ -- count doesn't work with :tprevious, must use range. See #30641.
+ vim.cmd.tprevious({ range = { vim.v.count1 } })
end, { desc = ':tprevious' })
vim.keymap.set('n', ']t', function()
- vim.cmd.tnext({ count = vim.v.count1 })
+ -- count doesn't work with :tnext, must use range. See #30641.
+ vim.cmd.tnext({ range = { vim.v.count1 } })
end, { desc = ':tnext' })
vim.keymap.set('n', '[T', function()
- vim.cmd.trewind({ count = vim.v.count ~= 0 and vim.v.count or nil })
+ -- count doesn't work with :trewind, must use range. See #30641.
+ vim.cmd.trewind({ range = vim.v.count ~= 0 and { vim.v.count } or nil })
end, { desc = ':trewind' })
vim.keymap.set('n', ']T', function()
-- :tlast does not accept a count, so use :trewind if count given
if vim.v.count ~= 0 then
- vim.cmd.trewind({ count = vim.v.count })
+ vim.cmd.trewind({ range = { vim.v.count } })
else
vim.cmd.tlast()
end
end, { desc = ':tlast' })
vim.keymap.set('n', '[<C-T>', function()
- vim.cmd.ptprevious({ count = vim.v.count1 })
+ -- count doesn't work with :ptprevious, must use range. See #30641.
+ vim.cmd.ptprevious({ range = { vim.v.count1 } })
end, { desc = ' :ptprevious' })
vim.keymap.set('n', ']<C-T>', function()
- vim.cmd.ptnext({ count = vim.v.count1 })
+ -- count doesn't work with :ptnext, must use range. See #30641.
+ vim.cmd.ptnext({ range = { vim.v.count1 } })
end, { desc = ':ptnext' })
-- Buffers