Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mappings like <C-Up> seems won't work with <Plug>(VM-Add-Cursor-Up) together #146

Open
JamesWZM opened this issue Oct 14, 2020 · 28 comments

Comments

@JamesWZM
Copy link

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
@mg979
Copy link
Owner

mg979 commented Oct 14, 2020

Terminal emulator? Does it work in vim?

@mg979
Copy link
Owner

mg979 commented Oct 14, 2020

Also try to run the tutorial and see if it works there (it uses a minimal vimrc).

@JamesWZM
Copy link
Author

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: worked well and I enjoy it faster than vim-multipul-cursor

@savchenko
Copy link

vim version is 7.4.629

Can you try with the v8.1.X or nVim >= v0.3.4?

@mg979
Copy link
Owner

mg979 commented Oct 19, 2020

It could be a terminal issue, he should try with another terminal. Vim 7 is not supported anyway.

@rmGFW
Copy link

rmGFW commented Oct 22, 2020

I have the same problem.
not work on my neovim
my neovim is the latest
and I use iterm2 as my terminal

another question

how can I change map to or other

@mg979
Copy link
Owner

mg979 commented Oct 22, 2020

@rmGFW if that key combination doesn't work on your terminal try other keys. To remap keys: :help vm-mappings.

@mg979
Copy link
Owner

mg979 commented Oct 22, 2020

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

@palcalde
Copy link

palcalde commented Nov 3, 2020

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```

@palcalde
Copy link

palcalde commented Nov 3, 2020

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

@mg979
Copy link
Owner

mg979 commented Nov 3, 2020

@palcalde terminal emulator?

@palcalde
Copy link

palcalde commented Nov 4, 2020

Iterm2 Build 3.3.12

@rmGFW
Copy link

rmGFW commented Nov 4, 2020

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 ,

@rmGFW
Copy link

rmGFW commented Nov 4, 2020

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 and ,it will not work

@mg979
Copy link
Owner

mg979 commented Nov 4, 2020

@palcalde try MacVim or use different mappings. I'm pretty sure it's a terminal issue.

@palcalde
Copy link

palcalde commented Nov 5, 2020

Oh no worries! Adding the mappings in my vimrc works like a charm 👍
btw thanks for the project, works really well!

@palcalde
Copy link

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

@MuhammedZakir
Copy link

MuhammedZakir commented Nov 11, 2020

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/

@palcalde
Copy link

palcalde commented Nov 12, 2020

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>jand <leader>k to add cursor up and down.

Thanks for your help anyway!

@horseinthesky
Copy link

@mg979 Is there a way to remap (VM-Add-Cursor-Up) and (VM-Add-Cursor-Down)?
It interferes with my mappings.

@wangwenqiangGitHub
Copy link

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

@alexzanderr
Copy link

alexzanderr commented Jun 26, 2021

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

@ldpbuaa
Copy link

ldpbuaa commented Nov 8, 2021

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.

@richardm-stripe
Copy link

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

@thiago-scherrer
Copy link

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

@jkahne
Copy link

jkahne commented Dec 1, 2022

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

@ApolloTang
Copy link

@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

@tannersltwtr
Copy link

In Iterm2, I fixed this issue by setting my profiles keymappings to use the xterm defaults. Fixed it immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests