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