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

How to use this Plugin with arrow keys? #64

Closed
maxreuben opened this issue Dec 28, 2021 · 5 comments
Closed

How to use this Plugin with arrow keys? #64

maxreuben opened this issue Dec 28, 2021 · 5 comments

Comments

@maxreuben
Copy link

How can i retool this plugin to make it use arrow keys instead of hjkl? Is it possible? I don't know Vimscript so I can't really tell.

@matze
Copy link
Owner

matze commented Dec 28, 2021

Disable auto-mapping and then bind <Up> and <Down> as usual, i.e.

let g:move_map_keys = 0

vmap <Down> <Plug>MoveBlockDown
vmap <Up> <Plug>MoveBlockUp
nmap <Down> <Plug>MoveLineDown
nmap <Up> <Plug>MoveLineUp

@matze matze closed this as completed Dec 28, 2021
@maxreuben
Copy link
Author

Thank you for your help.

@maxreuben
Copy link
Author

maxreuben commented Dec 28, 2021

Neither Alt nor Ctrl keys are getting mapped in any of my terminals (alacritty, gnome-terminal, tabby). Is there a way to prevent the terminal from prefixing the ESC character somehow? Or at least a workaround so that that it can be mapped in vim? I tried this:

 map <ESC>[1;5B <A-Down>
 map <ESC>[1;5A <A-Up>
 map! <ESC>[1;5B <A-Down>
 map! <ESC>[1;5A <A-Up>
 
 let g:move_map_keys = 0
 
 vmap <A-Down> <Plug>MoveBlockDown
 vmap <A-Up>   <Plug>MoveBlockUp
 nmap <A-Down> <Plug>MoveLineDown
 nmap <A-Up>   <Plug>MoveLineUp

But it didn't work.

@matze
Copy link
Owner

matze commented Dec 28, 2021

You can see what sequence is sent by going into insert mode, typing C-v and then typing whatever you are interested in. If I type Alt-Up in gnome-terminal I get <M-Up>.

@maxreuben
Copy link
Author

Thanks, I figured it out.

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

No branches or pull requests

2 participants