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.

nnn-completion.bash 836 B

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