neovim icon indicating copy to clipboard operation
neovim copied to clipboard

docs: 'timeoutlen' vs 'ttimeoutlen' confusion

Open UnkwUsr opened this issue 3 years ago • 0 comments

Problem

In short: notimeout behaves like timeoutlen=99999999 when nottimeout behaves like ttimeoutlen=0

Details, steps to test:

""""" testing 'timeout'
" timeout for mapped key sequences

" helper maps (to apply them, type `:source<CR>`)
" execute line under cursor (P.S. because of technical reasons, we need there
"                            1-key map)
nmap - ^y$:@"<CR>:echo @"<CR>

" maps for testing
nmap s  :echo 1<cr>
nmap sa :echo 2<cr>
" for testing you need to press only `s` and see how it acts


set timeout timeoutlen=1000
" behavior: on press `s`: you have to wait 1 second (or press any other key)
"                         to got '1' to be echoed

set timeout timeoutlen=0
" behavior: on press `s`: '1' is echoed immediately
"           on press `sa`: you can't do this. Because `s` is running immediately

set notimeout
" P.S. it is regardless of 'timeoutlen'
" behavior: on press `s`: you have to wait forever, or press any other key
                        " (but not `a`, as it will trigger `sa` map) to got
                        " '1' to be echoed
""""" testing 'ttimeout'
" timeout for key code sequences

" helper maps (to apply them, type `:source<CR>`)
" execute line under cursor
nmap - ^y$:@"<CR>:echo @"<CR>

" for testing type: `i<Esc>O`
" it can't be mapped as it will behave different then :D


set ttimeout ttimeoutlen=3000
" behavior: you have to wait 3 second before new line appear

set ttimeout ttimeoutlen=0
" behavior: there is no delays

set nottimeout
" P.S. it is regardless of 'ttimeoutlen'
" behavior: there is no delays

Expected behavior

Docs should clarify this points?

UnkwUsr avatar Mar 12 '23 17:03 UnkwUsr