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-plugin-helper 636 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env sh
  2. # Description: Helper script for plugins
  3. #
  4. # Shell: POSIX compliant
  5. # Author: Anna Arad
  6. selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
  7. ## Ask nnn to switch to directory $1 in context $2.
  8. ## If $2 is not provided, the function asks explicitly.
  9. nnn_cd () {
  10. dir=$1
  11. if [ -z "$NNN_PIPE" ]; then
  12. echo "No pipe file found" 1>&2
  13. return
  14. fi
  15. if [ -n "$2" ]; then
  16. context=$2
  17. else
  18. echo -n "Choose context 1-4 (blank for current): "
  19. read context
  20. fi
  21. echo -n ${context:-0}$dir > $NNN_PIPE
  22. }
  23. cmd_exists () {
  24. which "$1" > /dev/null 2>&1
  25. echo $?
  26. }