My build of nnn with minor changes
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

.nnn-plugin-helper 663 B

hace 4 años
hace 4 años
hace 4 años
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. }