My build of nnn with minor changes
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

41 行
850 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. dragon "$@"
  17. }
  18. function add_file() {
  19. echo -n "$@" >> "$selection"
  20. echo -ne "\0" >> "$selection"
  21. }
  22. echo -n > "$selection"
  23. # which dnd
  24. # upstream calls it dragon
  25. dnd --print-path --target | while read f
  26. do
  27. if echo -n "$f" | grep '^\(https\?\|ftps\?\|s\?ftp\):\/\/' ; then
  28. curl -LJO "$f"
  29. add_file "$PWD/$(basename "$f")"
  30. elif [ -e "$f" ]; then
  31. add_file "$f"
  32. fi
  33. done &