在 Vim CLI(使用脚本,不依赖插件)中,是否可以模仿:
:browse old
并创建一个编号菜单(egof 脚本)?
也许你正在寻找inputlist
?
" build your list in whatever way is appropriate for your task
let somelist = map(range(1,&lines-2), '"Item #".v:val')
let numberedlist = map(copy(somelist), 'string(v:key+1).": ".v:val')
let chosen = inputlist(['Pick an item:'] + numberedlist)
if 0 < chosen && chosen < len(somelist)
echo 'User chose item #' . chosen . ': <<<' . somelist[chosen-1] . '>>>'
else
echo 'Invalid selection!'
endif