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.
 
 
 
 
 
 

41 lignes
803 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. -n
  19. -o
  20. -p
  21. -s
  22. -S
  23. -t
  24. -v
  25. -h
  26. )
  27. if [[ $prev == -b ]]; then
  28. local bookmarks=$(echo $NNN_BMS | awk -F: -v RS=\; '{print $1}')
  29. COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
  30. elif [[ $prev == -p ]]; then
  31. COMPREPLY=( $(compgen -f -d -- "$cur") )
  32. elif [[ $cur == -* ]]; then
  33. COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
  34. else
  35. COMPREPLY=( $(compgen -f -d -- "$cur") )
  36. fi
  37. }
  38. complete -o filenames -F _nnn nnn