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.
 
 
 
 
 
 

72 lignes
1.6 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. -C
  19. -d
  20. -e
  21. -E
  22. -f
  23. -F
  24. -g
  25. -H
  26. -K
  27. -l
  28. -n
  29. -o
  30. -p
  31. -P
  32. -Q
  33. -r
  34. -R
  35. -s
  36. -S
  37. -t
  38. -T
  39. -u
  40. -V
  41. -w
  42. -x
  43. -h
  44. )
  45. if [[ $prev == -b ]]; then
  46. local bookmarks=$(echo $NNN_BMS | awk -F: -v RS=\; '{print $1}')
  47. COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
  48. elif [[ $prev == -l ]]; then
  49. return 1
  50. elif [[ $prev == -p ]]; then
  51. COMPREPLY=( $(compgen -f -d -- "$cur") )
  52. elif [[ $prev == -P ]]; then
  53. local plugins=$(echo $NNN_PLUG | awk -F: -v RS=\; '{print $1}')
  54. COMPREPLY=( $(compgen -W "$plugins" -- "$cur") )
  55. elif [[ $prev == -s ]]; then
  56. local sessions_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions
  57. COMPREPLY=( $(cd "$sessions_dir" && compgen -f -d -- "$cur") )
  58. elif [[ $prev == -t ]]; then
  59. return 1
  60. elif [[ $prev == -T ]]; then
  61. local keys=$(echo "a d e r s t v" | awk -v RS=' ' '{print $0}')
  62. COMPREPLY=( $(compgen -W "$keys" -- "$cur") )
  63. elif [[ $cur == -* ]]; then
  64. COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
  65. else
  66. COMPREPLY=( $(compgen -f -d -- "$cur") )
  67. fi
  68. }
  69. complete -o filenames -F _nnn nnn