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.
 
 
 
 
 
 

51 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. -b
  16. -c
  17. -d
  18. -e
  19. -E
  20. -f
  21. -H
  22. -i
  23. -K
  24. -n
  25. -o
  26. -p
  27. -r
  28. -s
  29. -S
  30. -t
  31. -v
  32. -h
  33. )
  34. if [[ $prev == -b ]]; then
  35. local bookmarks=$(echo $NNN_BMS | awk -F: -v RS=\; '{print $1}')
  36. COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
  37. elif [[ $prev == -p ]]; then
  38. COMPREPLY=( $(compgen -f -d -- "$cur") )
  39. elif [[ $prev == -e ]]; then
  40. local sessions_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions
  41. COMPREPLY=( $(cd "$sessions_dir" && compgen -f -d -- "$cur") )
  42. elif [[ $cur == -* ]]; then
  43. COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
  44. else
  45. COMPREPLY=( $(compgen -f -d -- "$cur") )
  46. fi
  47. }
  48. complete -o filenames -F _nnn nnn