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
1.4 KiB

  1. #!/usr/bin/env sh
  2. # Description: Copy selection to system clipboard as newline-separated entries
  3. # Dependencies:
  4. # - tr
  5. # - xclip/xsel (Linux)
  6. # - pbcopy (macOS)
  7. # - termux-clipboard-set (Termux)
  8. # - clip.exe (WSL)
  9. # - clip (Cygwin)
  10. # - wl-copy (Wayland)
  11. # - clipboard (Haiku)
  12. #
  13. # Limitation: breaks if a filename has newline in it
  14. #
  15. # Note: For a space-separated list:
  16. # xargs -0 < "$SELECTION"
  17. #
  18. # Shell: POSIX compliant
  19. # Author: Arun Prakash Jana
  20. IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" # protect trailing \n
  21. selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
  22. if which xsel >/dev/null 2>&1; then
  23. # Linux
  24. tr '\0' '\n' < "$selection" | xsel -bi
  25. elif which xclip >/dev/null 2>&1; then
  26. # Linux
  27. tr '\0' '\n' < "$selection" | xclip -sel clip
  28. elif which pbcopy >/dev/null 2>&1; then
  29. # macOS
  30. tr '\0' '\n' < "$selection" | pbcopy
  31. elif which termux-clipboard-set >/dev/null 2>&1; then
  32. # Termux
  33. tr '\0' '\n' < "$selection" | termux-clipboard-set
  34. elif which clip.exe >/dev/null 2>&1; then
  35. # WSL
  36. tr '\0' '\n' < "$selection" | clip.exe
  37. elif which clip >/dev/null 2>&1; then
  38. # Cygwin
  39. tr '\0' '\n' < "$selection" | clip
  40. elif which wl-copy >/dev/null 2>&1; then
  41. # Wayland
  42. tr '\0' '\n' < "$selection" | wl-copy
  43. elif which clipboard >/dev/null 2>&1; then
  44. # Haiku
  45. tr '\0' '\n' < "$selection" | clipboard --stdin
  46. fi