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.
 
 
 
 
 
 

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