-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
alt key bindings no longer work #5576
Comments
ESC is ESC. Try |
why did you close this? it's regression vim->neovim! and alt key sends esc+foo sequence. is this documented in neovim incompatibilities list? |
Just change the mappings to:
It's not a regression,
Not even gVim works with the mappings you have. Specifying |
thanks for the detailed reply! however, what is vim/nvim compatible way? You say |
@justinmk care to give example how to define the bindings compatible with vim/nvim? perhaps some function? |
|
is there way to reuse adding definitions? duplicating large blocks between |
least i was able to come up with. " vim/nvim compatible alt key binding
" https://github.com/neovim/neovim/issues/5576
if has('nvim')
" map <A-n> :bnext<CR>
function! s:alt_key(key)
return "<A-". a:key . ">"
endfun
else
" map <Esc>n :bnext<CR>
function! s:alt_key(key)
return "<Esc>". a:key
endfun
endif
function! s:map_alt(key, action)
exec "map " . s:alt_key(a:key). " " a:action
endfun
function! s:imap_alt(key, action)
exec "imap " . s:alt_key(a:key). " " a:action
endfun -map <Esc>n :bnext<CR>
-map <Esc>p :bprevious<CR>
-map <Esc>l :ls<CR>
-map <Esc>1 :buffer 1<CR>
-map <Esc>2 :buffer 2<CR>
-map <Esc>3 :buffer 3<CR>
-map <Esc>4 :buffer 4<CR>
-map <Esc>5 :buffer 5<CR>
-map <Esc>6 :buffer 6<CR>
-map <Esc>7 :buffer 7<CR>
-map <Esc>8 :buffer 8<CR>
-map <Esc>9 :buffer 9<CR>
-map <Esc>0 :buffer 10<CR>
-map <Esc>u :bunload<CR>
-map <Esc>e :e <C-D>
+call s:map_alt("n", ":bnext<CR>")
+call s:map_alt("p", ":bprevious<CR>")
+call s:map_alt("l", ":ls<CR>")
+call s:map_alt("1", ":buffer 1<CR>")
+call s:map_alt("2", ":buffer 2<CR>")
+call s:map_alt("3", ":buffer 3<CR>")
+call s:map_alt("4", ":buffer 4<CR>")
+call s:map_alt("5", ":buffer 5<CR>")
+call s:map_alt("6", ":buffer 6<CR>")
+call s:map_alt("7", ":buffer 7<CR>")
+call s:map_alt("8", ":buffer 8<CR>")
+call s:map_alt("9", ":buffer 9<CR>")
+call s:map_alt("0", ":buffer 10<CR>")
+call s:map_alt("u", ":bunload<CR>")
+call s:map_alt("e", ":e <C-D>")
- map <Esc>\ :call CommentToggle()<CR>j
- imap <Esc>\ <ESC>:call CommentToggle()<CR>j
- map <Esc>' :call CommentToggle()<CR>j
- imap <Esc>' <ESC>:call CommentToggle()<CR>j
+ call s:map_alt("\\", ":call CommentToggle()<CR>j")
+ call s:imap_alt("\\", "<ESC>:call CommentToggle()<CR>j")
+ call s:map_alt("'", ":call CommentToggle()<CR>j")
+ call s:imap_alt("'", "<ESC>:call CommentToggle()<CR>j") |
nvim --version
: 0.1.5, 0.1.6$TERM
: xterm, screenActual behaviour
Expected behaviour
Steps to reproduce using
nvim -u NORC
Now press
alt
+l
-> nothing happens in nvimThe text was updated successfully, but these errors were encountered: