fedepujol / move.nvim

Gain the power to move lines and blocks and auto-indent them!
GNU General Public License v3.0
348 stars 6 forks source link

Require mappings don't work #5

Closed fedepujol closed 2 years ago

fedepujol commented 2 years ago

This mappings:

vnoremap <silent> <A-j> <cmd>lua require('move').MoveBlock(1)<CR>
vnoremap <silent> <A-k> <cmd>lua require('move').MoveBlock(-1)<CR>
vnoremap <silent> <A-l> <cmd>lua require('move').MoveHBlock(1)<CR>
vnoremap <silent> <A-h> <cmd>lua require('move').MoveHBlock(-1)<CR>

and their lua equivalent:

vim.keymap.set('v', '<A-j>', "<Cmd>lua require('move').MoveBlock(1)<CR>", { noremap = true, silent = true })
vim.keymap.set('v', '<A-k>', "<Cmd>lua require('move').MoveBlock(-1)<CR>", { noremap = true, silent = true })
vim.keymap.set('v', '<A-l>', "<Cmd>lua require('move').MoveHBlock(1)<CR>", { noremap = true, silent = true })
vim.keymap.set('v', '<A-h>', "<Cmd>lua require('move').MoveHBlock(-1)<CR>", { noremap = true, silent = true })

Single line/char operations works fine.

fedepujol commented 2 years ago

It seems there is a problem in the command definition of MoveBlock

command! -nargs=1 -range=%  MoveBlock   lua require('move').MoveBlock(<args>, <line1>, <line2>)

Where it takes line1 and line2 as arguments. This could be related to the issue.

fedepujol commented 2 years ago

Closing issue. The bug is still there but only when used in the forms declare above.