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.
 
 
 
 
 
 

51 lignes
1007 B

  1. #!/usr/bin/env sh
  2. # Description: Open a Drag and drop window, to drop files onto other programs
  3. #
  4. # Dependency: https://github.com/mwh/dragon
  5. # Shell: POSIX compliant
  6. # Author: 0xACE
  7. selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
  8. resp=f
  9. all=
  10. dnd()
  11. {
  12. dragon "$@"
  13. }
  14. function use_all()
  15. {
  16. echo -n "mark --all (a) [default=none]: "
  17. read resp
  18. if [ "$resp" = "a" ]; then
  19. all="--all"
  20. else
  21. all=""
  22. fi
  23. }
  24. if [ -s "$selection" ]; then
  25. echo -n "work with selection (s), current working directory (d) or current file (f) [default=f]: "
  26. read resp
  27. else
  28. echo -n "work with current working directory (d) or current file (f) [default=f]: "
  29. read resp
  30. if [ "$resp" = "s" ]; then
  31. resp=f
  32. fi
  33. fi
  34. if [ "$resp" = "s" ]; then
  35. use_all
  36. sed -z 's|'"$PWD/"'||g' < "$selection" | xargs -0 dnd "$all" &
  37. elif [ "$resp" = "d" ]; then
  38. use_all
  39. dnd "$all" "$PWD/"* &
  40. else
  41. if [ -n "$1" ] && [ -e "$1" ]; then
  42. dnd "$1" &
  43. fi
  44. fi