You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug vmap J :m '>+1<CR>gv=gv and vmap K :m '<-2<CR>gv=gv do not work as expected.
These mappings work in vim but not in VSCodeVim. Normally, they allow you to highlight a few lines and then move them with J or K.
To Reproduce
Steps to reproduce the behavior:
Add the two remaps above to your .vimrc.
In VSCodeVim, use them by highlighting a line with V. Then try moving the line down with the J mapping.
Observe these mappings do not work.
Expected behavior
Normally, these maps allow you to highlight a few lines and then move them with J or K.
Log
2024-09-15 14:50:01.540 [debug] Handling key: V
2024-09-15 14:50:01.541 [debug] Status bar: -- VISUAL LINE --
2024-09-15 14:50:03.263 [debug] Handling key: J
2024-09-15 14:50:03.263 [debug] Remapping J to :,m, ,',>,+,1,
,g,v,=,g,v
2024-09-15 14:50:03.263 [debug] Handling key: :
2024-09-15 14:50:03.287 [debug] Status bar: :'<,'>|
2024-09-15 14:50:03.287 [debug] Handling key: m
2024-09-15 14:50:03.290 [debug] Status bar: :'<,'>m|
2024-09-15 14:50:03.290 [debug] Handling key:
2024-09-15 14:50:03.294 [debug] Status bar: :'<,'>m |
2024-09-15 14:50:03.294 [debug] Handling key: '
2024-09-15 14:50:03.297 [debug] Status bar: :'<,'>m '|
2024-09-15 14:50:03.298 [debug] Handling key: >
2024-09-15 14:50:03.300 [debug] Status bar: :'<,'>m '>|
2024-09-15 14:50:03.301 [debug] Handling key: +
2024-09-15 14:50:03.304 [debug] Status bar: :'<,'>m '>+|
2024-09-15 14:50:03.304 [debug] Handling key: 1
2024-09-15 14:50:03.307 [debug] Status bar: :'<,'>m '>+1|
2024-09-15 14:50:03.307 [debug] Handling key:
2024-09-15 14:50:03.308 [info] Executing :'<,'>m '>+1
2024-09-15 14:50:03.308 [debug] Adding Transformation {"type":"deleteRange","range":[{"line":3,"character":0},{"line":4,"character":0}],"manuallySetCursorPositions":true}
2024-09-15 14:50:03.308 [debug] Adding Transformation {"type":"insertText","position":{"line":4,"character":6},"text":"\n\t"context"","diff":{"type":0,"line":4,"character":1}}
2024-09-15 14:50:03.319 [debug] 2 change(s) to c:\Users\KhanY_z23jg7i\repos\price-fetcher\metrics.go because undefined
2024-09-15 14:50:03.321 [debug] Set nextStepStartPosition to [3, 0]
2024-09-15 14:50:03.321 [debug] Status bar: -- NORMAL --
2024-09-15 14:50:03.321 [debug] Handling key: g
2024-09-15 14:50:03.323 [debug] Handling key: v
2024-09-15 14:50:03.324 [debug] Status bar: -- VISUAL LINE --
2024-09-15 14:50:03.324 [debug] Handling key: =
2024-09-15 14:50:03.366 [debug] Status bar: -- NORMAL --
2024-09-15 14:50:03.366 [debug] Handling key: g
2024-09-15 14:50:03.367 [debug] Handling key: v
2024-09-15 14:50:03.368 [debug] Status bar: -- VISUAL LINE --
2024-09-15 14:50:03.368 [debug] Finished history step with 2 change(s)
2024-09-15 14:50:03.802 [debug] Handling key: J
2024-09-15 14:50:03.803 [debug] Remapping J to :,m, ,',>,+,1,
,g,v,=,g,v
2024-09-15 14:50:03.803 [debug] Handling key: :
2024-09-15 14:50:03.826 [debug] Status bar: :'<,'>|
2024-09-15 14:50:03.826 [debug] Handling key: m
2024-09-15 14:50:03.830 [debug] Status bar: :'<,'>m|
2024-09-15 14:50:03.830 [debug] Handling key:
2024-09-15 14:50:03.834 [debug] Status bar: :'<,'>m |
2024-09-15 14:50:03.834 [debug] Handling key: '
2024-09-15 14:50:03.837 [debug] Status bar: :'<,'>m '|
2024-09-15 14:50:03.838 [debug] Handling key: >
2024-09-15 14:50:03.841 [debug] Status bar: :'<,'>m '>|
2024-09-15 14:50:03.841 [debug] Handling key: +
2024-09-15 14:50:03.844 [debug] Status bar: :'<,'>m '>+|
2024-09-15 14:50:03.845 [debug] Handling key: 1
2024-09-15 14:50:03.848 [debug] Status bar: :'<,'>m '>+1|
2024-09-15 14:50:03.849 [debug] Handling key:
2024-09-15 14:50:03.849 [info] Executing :'<,'>m '>+1
2024-09-15 14:50:03.849 [debug] Adding Transformation {"type":"deleteRange","range":[{"line":3,"character":0},{"line":4,"character":0}],"manuallySetCursorPositions":true}
2024-09-15 14:50:03.849 [debug] Adding Transformation {"type":"insertText","position":{"line":4,"character":10},"text":"\n\t"fmt"","diff":{"type":0,"line":4,"character":1}}
2024-09-15 14:50:03.854 [debug] 2 change(s) to c:\Users\KhanY_z23jg7i\repos\price-fetcher\metrics.go because undefined
2024-09-15 14:50:03.854 [debug] Set nextStepStartPosition to [3, 0]
2024-09-15 14:50:03.855 [debug] Status bar: -- NORMAL --
2024-09-15 14:50:03.855 [debug] Handling key: g
2024-09-15 14:50:03.857 [debug] Handling key: v
2024-09-15 14:50:03.857 [debug] Status bar: -- VISUAL LINE --
2024-09-15 14:50:03.857 [debug] Handling key: =
2024-09-15 14:50:03.874 [debug] Status bar: -- NORMAL --
2024-09-15 14:50:03.874 [debug] Handling key: g
2024-09-15 14:50:03.876 [debug] Handling key: v
2024-09-15 14:50:03.876 [debug] Status bar: -- VISUAL LINE --
2024-09-15 14:50:03.876 [debug] Finished history step with 2 change(s)
2024-09-15 14:50:09.734 [debug] Handling key:
2024-09-15 14:50:09.735 [debug] Status bar: -- NORMAL --
2024-09-15 14:50:11.993 [info] Active editor: output:vscodevim.vim.Vim
Environment (please complete the following information):
Extension (VsCodeVim) version: v1.28.1
VSCode version: Version: 1.93.1 (user setup)
OS: Windows 11
The text was updated successfully, but these errors were encountered:
In VISUAL or VISUAL LINE mode, J and K now move lines up and down, while automatically adjusting indentation.
Most nvim tricks can be accomplish using the settings.json or keybindings.json since they offer a lot of options to play with.
The issue is broader. Might be related to the whole move command or to an even bigger group.
Following remaps also does not work as expected:
noremap<C-j>:m +1<cr>noremap<C-k>:m -2<cr>
To actually execute that command with either keybinding it is necessary to either enter insert mode or press <C-c>. I'm not aware of other possible ways if there are. But anyways this behavior is not expectable.
But hold on on insert mode solution. Things are fine when entering with any of: i, a, I, A. But it gets buggy when doing so with o or O - because the command is executed even later, once escaped to normal mode.
It gets even more buggy when you use your keybinding more than once before updating with:
either enter insert mode or press <C-c>
Seems like a line below/above is replaced by the one that was intended to move to that place. At least when a line contains non-blank characters. Basically, like if you did: yy(k/j)Vp
Interestingly, when you execute command directly :m <+/-><number><cr> it is done immediately, as expected.
Describe the bug
vmap J :m '>+1<CR>gv=gv
andvmap K :m '<-2<CR>gv=gv
do not work as expected.These mappings work in vim but not in VSCodeVim. Normally, they allow you to highlight a few lines and then move them with
J
orK
.To Reproduce
Steps to reproduce the behavior:
.vimrc
.V
. Then try moving the line down with theJ
mapping.Expected behavior
Normally, these maps allow you to highlight a few lines and then move them with
J
orK
.Log
2024-09-15 14:50:01.540 [debug] Handling key: V
2024-09-15 14:50:01.541 [debug] Status bar: -- VISUAL LINE --
2024-09-15 14:50:03.263 [debug] Handling key: J
2024-09-15 14:50:03.263 [debug] Remapping J to :,m, ,',>,+,1,
,g,v,=,g,v
2024-09-15 14:50:03.263 [debug] Handling key: :
2024-09-15 14:50:03.287 [debug] Status bar: :'<,'>|
2024-09-15 14:50:03.287 [debug] Handling key: m
2024-09-15 14:50:03.290 [debug] Status bar: :'<,'>m|
2024-09-15 14:50:03.290 [debug] Handling key:
2024-09-15 14:50:03.294 [debug] Status bar: :'<,'>m |
2024-09-15 14:50:03.294 [debug] Handling key: '
2024-09-15 14:50:03.297 [debug] Status bar: :'<,'>m '|
2024-09-15 14:50:03.298 [debug] Handling key: >
2024-09-15 14:50:03.300 [debug] Status bar: :'<,'>m '>|
2024-09-15 14:50:03.301 [debug] Handling key: +
2024-09-15 14:50:03.304 [debug] Status bar: :'<,'>m '>+|
2024-09-15 14:50:03.304 [debug] Handling key: 1
2024-09-15 14:50:03.307 [debug] Status bar: :'<,'>m '>+1|
2024-09-15 14:50:03.307 [debug] Handling key:
2024-09-15 14:50:03.308 [info] Executing :'<,'>m '>+1
2024-09-15 14:50:03.308 [debug] Adding Transformation {"type":"deleteRange","range":[{"line":3,"character":0},{"line":4,"character":0}],"manuallySetCursorPositions":true}
2024-09-15 14:50:03.308 [debug] Adding Transformation {"type":"insertText","position":{"line":4,"character":6},"text":"\n\t"context"","diff":{"type":0,"line":4,"character":1}}
2024-09-15 14:50:03.319 [debug] 2 change(s) to c:\Users\KhanY_z23jg7i\repos\price-fetcher\metrics.go because undefined
2024-09-15 14:50:03.321 [debug] Set nextStepStartPosition to [3, 0]
2024-09-15 14:50:03.321 [debug] Status bar: -- NORMAL --
2024-09-15 14:50:03.321 [debug] Handling key: g
2024-09-15 14:50:03.323 [debug] Handling key: v
2024-09-15 14:50:03.324 [debug] Status bar: -- VISUAL LINE --
2024-09-15 14:50:03.324 [debug] Handling key: =
2024-09-15 14:50:03.366 [debug] Status bar: -- NORMAL --
2024-09-15 14:50:03.366 [debug] Handling key: g
2024-09-15 14:50:03.367 [debug] Handling key: v
2024-09-15 14:50:03.368 [debug] Status bar: -- VISUAL LINE --
2024-09-15 14:50:03.368 [debug] Finished history step with 2 change(s)
2024-09-15 14:50:03.802 [debug] Handling key: J
2024-09-15 14:50:03.803 [debug] Remapping J to :,m, ,',>,+,1,
,g,v,=,g,v
2024-09-15 14:50:03.803 [debug] Handling key: :
2024-09-15 14:50:03.826 [debug] Status bar: :'<,'>|
2024-09-15 14:50:03.826 [debug] Handling key: m
2024-09-15 14:50:03.830 [debug] Status bar: :'<,'>m|
2024-09-15 14:50:03.830 [debug] Handling key:
2024-09-15 14:50:03.834 [debug] Status bar: :'<,'>m |
2024-09-15 14:50:03.834 [debug] Handling key: '
2024-09-15 14:50:03.837 [debug] Status bar: :'<,'>m '|
2024-09-15 14:50:03.838 [debug] Handling key: >
2024-09-15 14:50:03.841 [debug] Status bar: :'<,'>m '>|
2024-09-15 14:50:03.841 [debug] Handling key: +
2024-09-15 14:50:03.844 [debug] Status bar: :'<,'>m '>+|
2024-09-15 14:50:03.845 [debug] Handling key: 1
2024-09-15 14:50:03.848 [debug] Status bar: :'<,'>m '>+1|
2024-09-15 14:50:03.849 [debug] Handling key:
2024-09-15 14:50:03.849 [info] Executing :'<,'>m '>+1
2024-09-15 14:50:03.849 [debug] Adding Transformation {"type":"deleteRange","range":[{"line":3,"character":0},{"line":4,"character":0}],"manuallySetCursorPositions":true}
2024-09-15 14:50:03.849 [debug] Adding Transformation {"type":"insertText","position":{"line":4,"character":10},"text":"\n\t"fmt"","diff":{"type":0,"line":4,"character":1}}
2024-09-15 14:50:03.854 [debug] 2 change(s) to c:\Users\KhanY_z23jg7i\repos\price-fetcher\metrics.go because undefined
2024-09-15 14:50:03.854 [debug] Set nextStepStartPosition to [3, 0]
2024-09-15 14:50:03.855 [debug] Status bar: -- NORMAL --
2024-09-15 14:50:03.855 [debug] Handling key: g
2024-09-15 14:50:03.857 [debug] Handling key: v
2024-09-15 14:50:03.857 [debug] Status bar: -- VISUAL LINE --
2024-09-15 14:50:03.857 [debug] Handling key: =
2024-09-15 14:50:03.874 [debug] Status bar: -- NORMAL --
2024-09-15 14:50:03.874 [debug] Handling key: g
2024-09-15 14:50:03.876 [debug] Handling key: v
2024-09-15 14:50:03.876 [debug] Status bar: -- VISUAL LINE --
2024-09-15 14:50:03.876 [debug] Finished history step with 2 change(s)
2024-09-15 14:50:09.734 [debug] Handling key:
2024-09-15 14:50:09.735 [debug] Status bar: -- NORMAL --
2024-09-15 14:50:11.993 [info] Active editor: output:vscodevim.vim.Vim
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: