Moving a block vertically results in whole line movement instead
I can confirm MoveBlock doesn't work, just move the cursor to the bottom and select all the lines.
I can't reproduce this on my machine. @Mte90 does this happen on every file? Can you provide a example config on how you're using the plugin?
I changed that line https://github.com/Mte90/dotfiles/blob/master/.config/nvim/lua/mappings.lua#L36 with "MoveBlock" selecting multiple lines and I got the cursor moved with all the selected lines. I don't know if it is related https://github.com/fedepujol/move.nvim/issues/12
I've managed to reproduce this issue (thanks @Mte90 for the info!). The problem here is the vim-mode of the mapping to use MoveBlock.
MoveBlock only works in visual-mode, unlike MoveLine which works in normal-mode.
-- This won't work
vim.keymap.set('n', '<A-j>', ':MoveBlock(1)<CR>', opts)
-- This will
vim.keymap.set('v', '<A-j>', ':MoveBlock(1)<CR>', opts)
@Mte90 Try changing the mode to 'v' in your mapping and let me know.
Closing due to inactivity. Feel free to re-open if it's not resolve.
I am also facing this problem now, this is my configuration, i use lunarvim
{
"fedepujol/move.nvim",
config = function()
local opts = { noremap = true, silent = true }
local opts = { noremap = true, silent = true }
-- Normal-mode commands
-- vim.keymap.set('n', '<S-j>', ':MoveLine(1)<CR>', opts)
-- vim.keymap.set('n', '<S-k>', ':MoveLine(-1)<CR>', opts)
-- vim.keymap.set('n', '<S-h>', ':MoveHChar(-1)<CR>', opts)
-- vim.keymap.set('n', '<S-l>', ':MoveHChar(1)<CR>', opts)
-- vim.keymap.set('n', '<leader>wf', ':MoveWord(1)<CR>', opts)
-- vim.keymap.set('n', '<leader>wb', ':MoveWord(-1)<CR>', opts)
-- Visual-mode commands
vim.keymap.set('v', '<S-j>', ':MoveBlock(1)<CR>', opts)
vim.keymap.set('v', '<S-k>', ':MoveBlock(-1)<CR>', opts)
vim.keymap.set('v', '<S-h>', ':MoveHBlock(-1)<CR>', opts)
vim.keymap.set('v', '<S-l>', ':MoveHBlock(1)<CR>', opts)
end,
},
https://github.com/fedepujol/move.nvim/assets/50194671/d0c1ec65-5e53-4776-a56f-6194fcc5b6f7
https://github.com/fedepujol/move.nvim/assets/50194671/0e5ee3ef-c8bc-4232-9418-017109d0d9de
Will check this out
The only way for me to reproduce this was doing something like:
- Select in
VisualBlocka block of lines - Trying to move the selected block up or down
That behaviour will clash MoveHBlock with the MoveBlock command. Are you doing something similar @edte?
Closing due to inactivity. Feel free to re-open