My build of nnn with minor changes
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

53 líneas
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. -g
  20. -H
  21. -K
  22. -n
  23. -o
  24. -p
  25. -Q
  26. -r
  27. -R
  28. -s
  29. -S
  30. -t
  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