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.
 
 
 
 
 
 

53 lignes
1.0 KiB

  1. #
  2. # Rudimentary Bash completion definition for nnn.
  3. #
  4. # Author:
  5. # Arun Prakash Jana <engineerarun@gmail.com>
  6. #
  7. _nnn ()
  8. {
  9. COMPREPLY=()
  10. local IFS=$'\n'
  11. local cur=$2 prev=$3
  12. local -a opts
  13. opts=(
  14. -a
  15. -A
  16. -b
  17. -c
  18. -d
  19. -E
  20. -g
  21. -H
  22. -K
  23. -n
  24. -o
  25. -p
  26. -Q
  27. -r
  28. -R
  29. -s
  30. -S
  31. -v
  32. -V
  33. -x
  34. -h
  35. )
  36. if [[ $prev == -b ]]; then
  37. local bookmarks=$(echo $NNN_BMS | awk -F: -v RS=\; '{print $1}')
  38. COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
  39. elif [[ $prev == -p ]]; then
  40. COMPREPLY=( $(compgen -f -d -- "$cur") )
  41. elif [[ $prev == -s ]]; then
  42. local sessions_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions
  43. COMPREPLY=( $(cd "$sessions_dir" && compgen -f -d -- "$cur") )
  44. elif [[ $cur == -* ]]; then
  45. COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
  46. else
  47. COMPREPLY=( $(compgen -f -d -- "$cur") )
  48. fi
  49. }
  50. complete -o filenames -F _nnn nnn