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
After my comments a couple of weeks ago on #71 (comment), I realized that not everything was working. So I revisited the configuration. My conclusion is that the default bindings for vim-move are not ideal.
Here are the problems as I see them:
I don't want to use C as the modifier because <C-l> is useful for redrawing the screen (and in neovim, also clearing any search highlighting).
I don't want to use S as the modifier because I'd like to figure out mappings that would work the same with vim and with JetBrains and VS code and the Shift key is often used in GUI apps to mean "extend the selection"
So that leaves the A modifier which on macOS is the Option key.
But if we select A, there are problems with using the h, j, k, l keys. In the terminal (at least iTerm), the recommended setting is to make the left Option key map to <Esc>+. The problem comes when you're in visual mode in the terminal and you hit Esc to exit out of Visual mode and then hit one of the above motion keys, such as h. What happens is that because of the vim-move mappings, this would be interpreted as a vim-move operation. One workaround is to hit Esc and wait until vim times out—but who wants to wait around? So the solution is to map to arrow keys instead of h and friends. Bonus: JetBrains and VS Code IDEs already use the arrow keys for moving line/statements, so the mappings will be similar or even the same (default VS code mappings for moving a line is indeed Option + arrow keys).
This is what I've figured out works very well for vim and neovim in iTerm2 terminal and in MacVim and VimR:
letg:move_map_keys=0ifhas("gui_running")
nmap<A-Down><Plug>MoveLineDownnmap<A-Up><Plug>MoveLineUpnmap<A-Left><Plug>MoveCharLeftnmap<A-Right><Plug>MoveCharRightvmap<A-Down><Plug>MoveBlockDownvmap<A-Up><Plug>MoveBlockUpvmap<A-Left><Plug>MoveBlockLeftvmap<A-Right><Plug>MoveBlockRightelsenmap<Esc><Down><Plug>MoveLineDownnmap<Esc><Up><Plug>MoveLineUpnmap<Esc><Left><Plug>MoveCharLeftnmap<Esc><Right><Plug>MoveCharRight" WARNING: if instead of using h,j,k,l, you tend to use arrow keys for motion" in Normal mode, then the mappings below may interfere when you try to exit" out of Visual mode with <Esc> and immediately hit an arrow key. In that" case, you might want to use the `C` modifier instead as here:"vmap <C-Down> <Plug>MoveBlockDown"vmap <C-Up> <Plug>MoveBlockUp"vmap <C-Left> <Plug>MoveBlockLeft"vmap <C-Right> <Plug>MoveBlockRightvmap<Esc><Down><Plug>MoveBlockDownvmap<Esc><Up><Plug>MoveBlockUpvmap<Esc><Left><Plug>MoveBlockLeftvmap<Esc><Right><Plug>MoveBlockRightendif
It took quite some time to figure this out. So I think that it would help mac users if either these were the defaults or there was a section in the README that listed all of these.
The text was updated successfully, but these errors were encountered:
Sorry for the late reply. I'd really prefer if we "just" list these bindings in the README and docs for the simple reason not to break existing configurations for who-knows-how-many Mac users.
After my comments a couple of weeks ago on #71 (comment), I realized that not everything was working. So I revisited the configuration. My conclusion is that the default bindings for
vim-move
are not ideal.Here are the problems as I see them:
C
as the modifier because<C-l>
is useful for redrawing the screen (and in neovim, also clearing any search highlighting).S
as the modifier because I'd like to figure out mappings that would work the same with vim and with JetBrains and VS code and the Shift key is often used in GUI apps to mean "extend the selection"A
modifier which on macOS is the Option key.A
, there are problems with using theh
,j
,k
,l
keys. In the terminal (at least iTerm), the recommended setting is to make the left Option key map to<Esc>+
. The problem comes when you're in visual mode in the terminal and you hit Esc to exit out of Visual mode and then hit one of the above motion keys, such ash
. What happens is that because of the vim-move mappings, this would be interpreted as a vim-move operation. One workaround is to hit Esc and wait until vim times out—but who wants to wait around? So the solution is to map to arrow keys instead ofh
and friends. Bonus: JetBrains and VS Code IDEs already use the arrow keys for moving line/statements, so the mappings will be similar or even the same (default VS code mappings for moving a line is indeed Option + arrow keys).This is what I've figured out works very well for vim and neovim in iTerm2 terminal and in MacVim and VimR:
It took quite some time to figure this out. So I think that it would help mac users if either these were the defaults or there was a section in the README that listed all of these.
The text was updated successfully, but these errors were encountered: