Closed DeepReef11 closed 4 months ago
This is because when executed interactively from Command line, it is not in Visual mode already. Both MiniMove.move_selection()
and MiniMove.move_line()
are more oriented towards using it in mappings which don't change mode. Like it is done in 'mini.move'.
Closing as expected behavior.
Is there any particular reason you wanted to use that interactively?
I'm trying to add arrow keybinding (and keep hjkl).
-- vim.keymap.set('n', '<M-Up>', '<cmd>lua MiniMove.move_selection("up")<cr>', { desc = 'MiniMove line' })
-- vim.keymap.set('n', '<M-Up>', '<cmd>lua MiniMove.move_line("up")<cr>', { desc = 'MiniMove line' })
-- vim.keymap.set('n', '<M-Down>', '<cmd>lua MiniMove.move_line("down")<cr>', { desc = 'MiniMove line' })
-- vim.keymap.set('n', '<M-Left>', '<cmd>lua MiniMove.move_line("left")<cr>', { desc = 'MiniMove line' })
-- vim.keymap.set('n', '<M-Right>', '<cmd>lua MiniMove.move_line("right")<cr>', { desc = 'MiniMove line' })
vim.keymap.set('n', '<M-Up>', '<cmd>lua MiniMove.move_selection("up")<cr>', { desc = 'MiniMove line' })
This should be Visual mode mapping, not Normal. Replace 'n'
with 'x'
and it should work.
Right! My mistake. Thanks a lot!
I'm leaving this here in case someone is looking for the same binding:
require('mini.move').setup()
vim.keymap.set('x', '<M-Up>', '<cmd>lua MiniMove.move_selection("up")<cr>', { desc = 'MiniMove selection' })
vim.keymap.set('x', '<M-Down>', '<cmd>lua MiniMove.move_selection("down")<cr>', { desc = 'MiniMove selection' })
vim.keymap.set('x', '<M-Left>', '<cmd>lua MiniMove.move_selection("left")<cr>', { desc = 'MiniMove selection' })
vim.keymap.set('x', '<M-Right>', '<cmd>lua MiniMove.move_selection("right")<cr>', { desc = 'MiniMove selection' })
vim.keymap.set('n', '<M-Up>', '<cmd>lua MiniMove.move_line("up")<cr>', { desc = 'MiniMove line' })
vim.keymap.set('n', '<M-Down>', '<cmd>lua MiniMove.move_line("down")<cr>', { desc = 'MiniMove line' })
vim.keymap.set('n', '<M-Left>', '<cmd>lua MiniMove.move_line("left")<cr>', { desc = 'MiniMove line' })
vim.keymap.set('n', '<M-Right>', '<cmd>lua MiniMove.move_line("right")<cr>', { desc = 'MiniMove line' })
Contributing guidelines
Module(s)
move
Description
The following command doesn't work with a selection lua MiniMove.move_selection("up")
I was able to get move_line working fine
Neovim version
0.9.5
Steps to reproduce
Expected behavior
Selection move up.
Actual behavior
Nothing