vim-visual-multi
vim-visual-multi copied to clipboard
mappings like <C-Up> seems won't work with <Plug>(VM-Add-Cursor-Up) together
Describe the issue: It is the first day that I have tried vim-visual-multi, so I'm not that familiar with it. I tried to read the tutorial and doc, but
I have no idea why. <C-Up>
, <C-Down>
, <S-Left>
, <S-Right>
mapping seems not working for me in neovim.
I've checked the mapping of <C-Up>
, it is <Plug>(VM-Add-Cursor-Up)
, but it just won't work
I've tried to map <Plug>(VM-Add-Cursor-Up)
to another key, it worked well.
Also, map another function to <C-Up>
seems working well too! They just won't work together!
- Operating System: Centos7
- Vim Version: NVIM v0.4.4
- commit SHA/branch: master
Terminal emulator? Does it work in vim?
Also try to run the tutorial and see if it works there (it uses a minimal vimrc).
Well, I used it on putty, used ssh together with tmux working on a remote server computer.
I'm not sure that does it work one vim. I'm not using them together and the build-in vim version is 7.4.629, an old version.
I've tried to run the tutorial, and also failed to work.
ps: <C-n> worked well and I enjoy it faster than vim-multipul-cursor
vim version is 7.4.629
Can you try with the v8.1.X or nVim >= v0.3.4?
It could be a terminal issue, he should try with another terminal. Vim 7 is not supported anyway.
I have the same problem. <C-down> not work on my neovim my neovim is the latest and I use iterm2 as my terminal
another question
how can I change
@rmGFW if that key combination doesn't work on your terminal try other keys. To remap keys: :help vm-mappings
.
Also, I don't know in iterm, but for urxvt you can add this to .Xresources
:
URxvt.keysym.Control-Up: \033[1;5A
URxvt.keysym.Control-Down: \033[1;5B
URxvt.keysym.Control-Left: \033[1;5D
URxvt.keysym.Control-Right: \033[1;5C
URxvt.keysym.M-Down: \033[1;3B
URxvt.keysym.M-Up: \033[1;3A
URxvt.keysym.M-Left: \033[1;3D
URxvt.keysym.M-Right: \033[1;3C
Thanks for the plugin!
I do have the same problem, Option key does not work with nvim:
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/config -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/src -I/usr/local/include -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/src/nvim/auto -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/include
Compiled by brew@Catalina
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.4/share/nvim"
Run :checkhealth for more info```
Adding the mapping manually in my .vimrc works fine btw
let g:VM_maps = {}
let g:VM_maps["Add Cursor Down"] = '<M-j>' " new cursor down
let g:VM_maps["Add Cursor Up"] = '<M-k>' " new cursor up
@palcalde terminal emulator?
Iterm2 Build 3.3.12
Adding the mapping manually in my .vimrc works fine btw
let g:VM_maps = {} let g:VM_maps["Add Cursor Down"] = '<M-j>' " new cursor down let g:VM_maps["Add Cursor Up"] = '<M-k>' " new cursor up
it does not work on my vim ,
Adding the mapping manually in my .vimrc works fine btw
let g:VM_maps = {} let g:VM_maps["Add Cursor Down"] = '<M-j>' " new cursor down let g:VM_maps["Add Cursor Up"] = '<M-k>' " new cursor up
it does not work on my vim ,
it works ,but if I change the key binding to <M-n> and <M-p> ,it will not work
@palcalde try MacVim or use different mappings. I'm pretty sure it's a terminal issue.
Oh no worries! Adding the mappings in my vimrc works like a charm 👍 btw thanks for the project, works really well!
Ok, so in nvim with iterm 2 I do receive <M-j>when I press Option + j keys. However, in vim, it does not work cause I receive ^]j
when I press Option + j, so it seems Option key is mapped as ^] which means ESC in VIM.
With this mapping I'm able to use Option key in vim>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim Visual Multi
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:VM_maps = {}
" ESC is ^] which is what iterm sends for Option key in vim
let g:VM_maps["Add Cursor Down"] = '<ESC>j' " new cursor down
let g:VM_maps["Add Cursor Up"] = '<ESC>k' " new cursor up
Have you enabled Use option as meta key
? I am not on on Mac atm, so I can't test if this fixes the problem (though it should).
Terminal.app: https://www.shell-tips.com/mac/meta-key/
Iterm2: https://stackoverflow.com/questions/196357/making-iterm-to-translate-meta-key-in-the-same-way-as-in-other-oses
https://iterm2.com/faq.html
Q: How do I make the option/alt key act like Meta or send escape codes?
A: Go to Preferences > Profiles tab. Select your profile on the left, and then open the Keyboard tab. At the bottom is a set of buttons that lets you select the behavior of the Option key. For most users,
Esc+
will be the best choice.
Alternatively, if that does no work, you can map option+<key>
combinations to send custom escape sequences. [1] IIRC, you should be able to do this in Terminal.app too. However, the downside is that you will have to map each alt+<key>
shortcuts,
[1] https://thinkingeek.com/2012/11/17/mac-os-x-iterm-meta-key/
I tried, still does not send <M-j>
when pressing Option + j
It sends always ^]
no matter if I set meta or escape keys option in iterm. I've ended up using <leader>j
and <leader>k
to add cursor up and down.
Thanks for your help anyway!
@mg979 Is there a way to remap <Plug>(VM-Add-Cursor-Up) and <Plug>(VM-Add-Cursor-Down)? It interferes with my mappings.
Ok, so in nvim with iterm 2 I do receive when I press Option + j keys. However, in vim, it does not work cause I receive
^]j
when I press Option + j, so it seems Option key is mapped as ^] which means ESC in VIM.With this mapping I'm able to use Option key in vim>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Vim Visual Multi """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:VM_maps = {} " ESC is ^] which is what iterm sends for Option key in vim let g:VM_maps["Add Cursor Down"] = '<ESC>j' " new cursor down let g:VM_maps["Add Cursor Up"] = '<ESC>k' " new cursor up
how can map <S-Left>, <S-Right>
, ? I can't use Option key in vim
Adding the mapping manually in my .vimrc works fine btw
let g:VM_maps = {} let g:VM_maps["Add Cursor Down"] = '<M-j>' " new cursor down let g:VM_maps["Add Cursor Up"] = '<M-k>' " new cursor up
works in neovim 0.5
, thanks man, you made my day.
i have the remaps this way:
let g:VM_maps["Add Cursor Down"] = '<C-S-Down>' " new cursor down
let g:VM_maps["Add Cursor Up"] = '<C-S-Up>' " new cursor up
I got the same problem that <Ctrl+Up> and <Ctrl+Down> did not work as expected on macOS BigSur + Vim 8.2 + Iterm2. Finally, I realized <Ctrl+Up> and <Ctrl+Down> are system-level shortcut in macOS and this could be conflicting with the shortcuts of vim-visual-multi. In this case, it could be fixed by deactivating these shortcuts in System Preferences -> Keyboard -> Shortcuts -> Mission Control -> <Mission Cotrol> for <Ctrl+Up> and <Application windows> for <Ctrl+Down>. I know the fix could be irrelevant to this issue, but I'd like to post the solution here in case someone needs it.
I use Terminal.app on Mac and needed to follow these instructions: http://www.blogface.org/2015/03/ctrl-in-emacs-in-mac-terminal.html
The same here. Ctrl-Down/Ctrl-Up stopped working. But I'm using VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 7 2022 21:31:47) Included patches: 1-4525
I use Terminal.app on Mac and needed to follow these instructions: http://www.blogface.org/2015/03/ctrl-in-emacs-in-mac-terminal.html
This is what worked for me.
neovim 0.8.0
terminal
mac os Ventura 13.0.1
@ldpbuaa
I got the same problem that <Ctrl+Up> and <Ctrl+Down> did not work as expected on macOS BigSur + Vim 8.2 + Iterm2. Finally, I realized <Ctrl+Up> and <Ctrl+Down> are system-level shortcut in macOS and this could be conflicting with the shortcuts of vim-visual-multi. In this case, it could be fixed by deactivating these shortcuts in System Preferences -> Keyboard -> Shortcuts -> Mission Control -> for <Ctrl+Up> and for <Ctrl+Down>. I know the fix could be irrelevant to this issue, but I'd like to post the solution here in case someone needs it.
I didn't want to turn off my default Mission Control shortcut, instead, I found that I can remap with Meta key like so:
let g:VM_maps["Add Cursor Down"] = '∆' "/ M-j
let g:VM_maps["Add Cursor Up"] = '˚' "/ M-k
Ref: https://stackoverflow.com/a/5382863/3136861
In Iterm2, I fixed this issue by setting my profiles keymappings to use the xterm defaults. Fixed it immediately.