My build of nnn with minor changes
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

nnn-completion.bash 715 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 opts_with_args
  12. opts=(
  13. -c
  14. -e
  15. -h
  16. -i
  17. -l
  18. -S
  19. -v
  20. )
  21. opts_with_arg=(
  22. -c
  23. )
  24. # Do not complete non option names
  25. [[ $cur == -* ]] || return 1
  26. # Do not complete when the previous arg is an option expecting an argument
  27. for opt in "${opts_with_arg[@]}"; do
  28. [[ $opt == $prev ]] && return 1
  29. done
  30. # Complete option names
  31. COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
  32. return 0
  33. }
  34. complete -F _nnn nnn