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.6 KiB

il y a 5 ans
il y a 5 ans
il y a 5 ans
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. -U
  43. -V
  44. -w
  45. -x
  46. -h
  47. )
  48. if [[ $prev == -b ]]; then
  49. local bookmarks=$(echo $NNN_BMS | awk -F: -v RS=\; '{print $1}')
  50. COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
  51. elif [[ $prev == -l ]]; then
  52. return 1
  53. elif [[ $prev == -p ]]; then
  54. COMPREPLY=( $(compgen -f -d -- "$cur") )
  55. elif [[ $prev == -P ]]; then
  56. local plugins=$(echo $NNN_PLUG | awk -F: -v RS=\; '{print $1}')
  57. COMPREPLY=( $(compgen -W "$plugins" -- "$cur") )
  58. elif [[ $prev == -s ]]; then
  59. local sessions_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions
  60. COMPREPLY=( $(cd "$sessions_dir" && compgen -f -d -- "$cur") )
  61. elif [[ $prev == -t ]]; then
  62. return 1
  63. elif [[ $prev == -T ]]; then
  64. local keys=$(echo "a d e r s t v" | awk -v RS=' ' '{print $0}')
  65. COMPREPLY=( $(compgen -W "$keys" -- "$cur") )
  66. elif [[ $cur == -* ]]; then
  67. COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
  68. else
  69. COMPREPLY=( $(compgen -f -d -- "$cur") )
  70. fi
  71. }
  72. complete -o filenames -F _nnn nnn