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 663 B

il y a 4 ans
il y a 4 ans
il y a 4 ans
12345678910111213141516171819202122232425262728293031323334
  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. export selection
  8. ## Ask nnn to switch to directory $1 in context $2.
  9. ## If $2 is not provided, the function asks explicitly.
  10. nnn_cd () {
  11. dir=$1
  12. if [ -z "$NNN_PIPE" ]; then
  13. echo "No pipe file found" 1>&2
  14. return
  15. fi
  16. if [ -n "$2" ]; then
  17. context=$2
  18. else
  19. printf "Choose context 1-4 (blank for current): "
  20. read -r context
  21. fi
  22. printf "%s" "${context:-0}$dir" > "$NNN_PIPE"
  23. }
  24. cmd_exists () {
  25. which "$1" > /dev/null 2>&1
  26. echo $?
  27. }