cobra.elv 439 B

1234567891011121314151617
  1. use str
  2. fn complete {|command @rest|
  3. (external $command) __complete $@rest 2>/dev/null | each {|line|
  4. if (str:has-prefix $line ":") {
  5. continue
  6. }
  7. var @result = (str:split &max=2 "\t" $line)
  8. var name = $result[0]
  9. var description = $name
  10. if (> (count $result) 1) {
  11. set description = $description' ('$result[1]')'
  12. }
  13. edit:complex-candidate $result[0] &display=$description &code-suffix=' '
  14. }
  15. }