My build of nnn with minor changes
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

39 lignes
781 B

  1. #
  2. # Rudimentary Bash completion definition for nnn.
  3. #
  4. # Author:
  5. # Arun Prakash Jana <engineerarun@gmail.com>
  6. #
  7. _nnn () {
  8. COMPREPLY=()
  9. local IFS=$' \n'
  10. local cur=$2 prev=$3
  11. local -a opts
  12. opts=(
  13. -b
  14. -d
  15. -e
  16. -h
  17. -i
  18. -l
  19. -p
  20. -s
  21. -S
  22. -v
  23. -w
  24. )
  25. if [[ $prev == -b ]]; then
  26. local bookmarks=$(echo $NNN_BMS | awk -F: -v RS=\; '{print $1}')
  27. COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
  28. elif [[ $prev == -p ]]; then
  29. COMPREPLY=( $(compgen -f -d -- "$cur") )
  30. elif [[ $cur == -* ]]; then
  31. COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
  32. else
  33. COMPREPLY=( $(compgen -f -d -- "$cur") )
  34. fi
  35. }
  36. complete -o filenames -F _nnn nnn