My build of nnn with minor changes
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

39 wiersze
786 B

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