I want to enter in normal mode from terminal with as natural.
After map to exit from terminal mode with tnoremap <Esc> <C-W>N as described on termal.txt help, the arrow keys have stopped working (eg: arrow-up/down to navigate over shell command history).
Pressing arrow keys on terminal mode, I got the error: E21: Cannot make changes, 'modifiable' is off
steps to reproduce:
put tnoremap <Esc> <C-W>N on ~/.vimrc
open vim
open a terminal :terminal
execute a comand on terminal (eg: ls)
hit arrow-up to get the last executed command
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
This is not a very good example. Typing arrow keys results in a sequence that starts with Esc.
I'll change it to:
tnoremap N
But you can make work:
tnoremap N
set notimeout ttimeout timeoutlen=100
I didn't know that arrow keys results in a sequence starting with esc.
It explains the problem.
I will try to find a comfortable map for me... however, the habit of hitting to escape from "typing mode" (insert-mode for common buffers or terminal-mode for terminal buffers) is very strong. It's a kind of muscle-memory.
thanks.
This is not a very good example. Typing arrow keys results in a sequence that starts with Esc.
I'll change it to:
tnoremap N
But you can make work:
tnoremap N
set notimeout ttimeout timeoutlen=100
Is tnoremap N what we should use to make it work. Or did Markdown erase the rest of your suggestion @brammool ?
(If I type tnoremap <Esc> <C-W>N without backticks, it displays as follows : tnoremap N )
They are erased by markdown. The original comment was:
I'll change it to: tnoremap <F1> <C-W>N But you can make <Esc> work: tnoremap <Esc> <C-W>N set notimeout ttimeout timeoutlen=100
OK @k-takata . I noticed that the docs were changed to fix this, please ignore my PR #3674
However, the error still persists for me.
My .vimrc contains
tnoremap <Esc> <C-W>N
set notimeout ttimeout timeoutlen=100
Whenever, I press the arrow keys, it goes into terminal-normal mode.
FYI, I am using version 8.1.563 currently
Seeing the Bram's comment again, set notimeout ttimeout timeoutlen=100 looks incorrect.
It sets notimeout but also sets timeoutlen=100 (not ttimeoutlen=100).
However, setting ttimeoutlen=100 doesn't fix the problem, because all Esc are eaten by the mapping.
One idea is:
tnoremap <Esc> <C-W>N tnoremap <Esc><Esc> <C-W>N set timeout timeoutlen=1000 " Default set ttimeout ttimeoutlen=100 " Set by defaults.vim
Cursor keys should work with this.
If Esc is typed once, Vim waits timeoutlen and goes to terminal-normal mode.
If Esc is typed twice, it goes to terminal-normal mode immediately.
Double tapping the Esc key seems to be good enough - it's slightly annoying if you press Esc in term mode, and then get term-mode after a second. Would there be any issues/side-effects with timeoutlen=0 ?
Possible duplicate of #2216.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
Mappings with are expected to only work in some situations. If they don't work, then don't use them. I'll add an extra note at the example for mapping in the terminal.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
Closed #2716.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
I'm wondering why neovim works with esc + arrow keys?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
Status here:
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()