popup menu <C-Up>/<C-Down> does not seem to work ?

25 views
Skip to first unread message

mckel...@gmail.com

unread,
Aug 13, 2020, 2:08:59 PM8/13/20
to vim_use
Hi,

running -

vim test.vim -S test.vim

my <C-Up> / <C-Down> do not work in the popup, but they do in the normal mapping.

Does anyone know why or what I am doing wrong ?

thx for all things vim,
-m

test.vim file -

" test.vim
function s:popup_filter(winid, key) abort
    if a:key ==# "\<C-Up>"
        call win_execute(a:winid, "normal! \<c-y>")
    elseif a:key ==# "\<C-Down>"
        call win_execute(a:winid, "normal! \<c-e>")
    elseif a:key ==# "\<C-k>"
        call win_execute(a:winid, "normal! \<c-y>")
    elseif a:key ==# "\<C-j>"
        call win_execute(a:winid, "normal! \<c-e>")
    elseif a:key ==# 'q'
        call popup_close(a:winid)
    endif
    return v:true
endfunction

call range(1, 20)
        \ ->map({_, i -> string(i)})
        \ ->popup_create({
        \   'close': 'button',
        \   'minwidth': 50,
        \   'maxwidth': 50,
        \   'minheight': 5,
        \   'maxheight': 5,
        \   'border': [],
        \   'mapping': v:false,
        \   'filter': funcref('s:popup_filter'),
        \   'filtermode': 'n'
        \ })

noremap <C-Up>   :echomsg "CTRL-Up"<CR>
noremap <C-Down> :echomsg "CTRL-Down"<CR>

mckel...@gmail.com

unread,
Aug 13, 2020, 9:03:32 PM8/13/20
to vim_use
Hi,

I resolved this by adding this to my .vimrc -

  exec "set <xHome>=\e[1;*H"
  exec "set <xEnd>=\e[1;*F"

Not exactly sure why but its all good :-)

thx and take care,
-m

mckel...@gmail.com

unread,
Aug 13, 2020, 10:57:47 PM8/13/20
to vim_use
Hi,

I meant <xUp> and <xDown> in my previous post, sorry.
As in -

  exec "set <xUp>=\e[1;*A"
  exec "set <xDown>=\e[1;*B"

thx,
-m

Reply all
Reply to author
Forward
0 new messages