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.

.cbcp 1.3 KiB

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