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.
 
 
 
 
 
 

45 lignes
930 B

  1. #!/usr/bin/env sh
  2. # Description: Provides drag and drop window for files.
  3. #
  4. # Files that are dropped will be added to nnn's selection
  5. # Some web based files will be downloaded to current directory with curl
  6. # and it may overwrite some existing files
  7. #
  8. # The user has to press mm to clear nnn's selection first
  9. #
  10. # Dependency: https://github.com/mwh/dragon
  11. # Shell: POSIX compliant
  12. # Author: 0xACE
  13. selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
  14. dnd()
  15. {
  16. if which dragon-drag-and-drop; then
  17. dragon-drag-and-drop "$@"
  18. else
  19. dragon "$@"
  20. fi
  21. }
  22. function add_file() {
  23. echo -n "$@" >> "$selection"
  24. echo -ne "\0" >> "$selection"
  25. }
  26. echo -n > "$selection"
  27. # which dnd
  28. # upstream calls it dragon
  29. dnd --print-path --target | while read f
  30. do
  31. if echo -n "$f" | grep '^\(https\?\|ftps\?\|s\?ftp\):\/\/' ; then
  32. curl -LJO "$f"
  33. add_file "$PWD/$(basename "$f")"
  34. elif [ -e "$f" ]; then
  35. add_file "$f"
  36. fi
  37. done &