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.

nnn-completion.bash 1.5 KiB

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