def SelectFromList(prompt, items):
 vim_items = [prompt]
 vim_items.extend([u'{0}: {1}'.format((i + 1), item) for (i, item) in enumerate(items)])
 vim.eval(u'inputsave()')
 try:
  selected = (GetIntValue(((u'inputlist( ' + json.dumps(vim_items)) + u' )')) - 1)
 except KeyboardInterrupt:
  selected = (-1)
 finally:
  vim.eval(u'inputrestore()')
 if ((selected < 0) or (selected >= len(items))):
  raise RuntimeError(NO_SELECTION_MADE_MSG)
 return selected

def SelectFromList ( prompt , items ) : vim_items = [ prompt ] vim_items . extend ( [ u'{0}: {1}' . format ( ( i + 1 ) , item ) for ( i , item ) in enumerate ( items ) ] ) vim . eval ( u'inputsave()' ) try : selected = ( GetIntValue ( ( ( u'inputlist( ' + json . dumps ( vim_items ) ) + u' )' ) ) - 1 ) except KeyboardInterrupt : selected = ( - 1 ) finally : vim . eval ( u'inputrestore()' ) if ( ( selected < 0 ) or ( selected >= len ( items ) ) ) : raise RuntimeError ( NO_SELECTION_MADE_MSG ) return selected
ask the user to select an item from the list |items| .