"function! MyPopupCallback(selection) " if a:selection != -1 " echo "Selected item: " . a:selection " else " echo "Menu closed without selection" " endif "endfunction " ""let s:menu_items = ['Item 1', 'Item 2', 'Item 3'] " "" Bind the popup menu to F10 "noremap :call ShowPopupMenu() " "function! ShowPopupMenu() " let s:selected_item = popup_menu(['red', 'green'], #{ " \ 'callback': 'MyPopupCallback', " \ }) "endfunction noremap :call ShowPopup() function! ShowPopup() call popup_atcursor(['red', 'green', 'blue'], #{} ) endfunction autocmd TextChangedI * call ShowPopup() "function! MyCompletionCallback(arg_lead, cmd_line, cursor_pos) " let candidates = ['Item 1', 'Item 2', 'Item 3'] " return complete(col('.'), candidates) "endfunction " "" Bind the completion menu to F10 "inoremap :call ShowCompletionMenu() " "function! ShowCompletionMenu() " call complete(col('.'), ['j', 'b', 'k'] ) "endfunction "inoremap =ListMonths() " "func ListMonths() " call complete(col('.'), ['January', 'February', 'March', " \ 'April', 'May', 'June', 'July', 'August', 'September', " \ 'October', 'November', 'December']) " return '' "endfunc