You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to propose the addition of a --clip or similar option to the bat utility. This feature would allow users to copy the contents of a file directly to the clipboard, eliminating the need for a separate command-line utility like xclip or xsel.
Use Case And current workarounds
This feature would be particularly beneficial in copying text from files where users frequently need to copy file contents quickly.
Current alternatives are piping to xclip or xsel, or using a text editor like vim to open and copy contents of a file manually.
Additionally, if implemented, a way to Select Specific Parts of the File:
It would be valuable to have the ability to selectively copy parts of the file, similar to the functionality provided by commands like head or tail. For instance, being able to copy the first 10 lines (head 10) or a specific range of lines would enhance the flexibility of this feature.
The text was updated successfully, but these errors were encountered:
I feel your pain with copying files, but I'm not sure if this would be within the scope of bat. The cat command is used for printing the contents of one or more files, and bat is follows suit as a syntax-highlighting printer for various file formats. Copying text directly from files feels like it would be better suited to a dedicated command, both for maintainability and compatability reasons.
If you don't mind using shell aliases, I might have something that works better for you:
alias pbcopy="xclip -selection clipboard -in"alias pbpaste="xclip -selection clipboard -out"
MacOS uses pbcopy and pbpaste, which are simple commands that use standard input and standard output to copy/paste from the clipboard. The above aliases work similarly, and it makes copying as painless as:
pbcopy < some_file.txt
head -n20 some_file.txt | pbcopy
pbpaste | bat -l txt
I would like to propose the addition of a --clip or similar option to the bat utility. This feature would allow users to copy the contents of a file directly to the clipboard, eliminating the need for a separate command-line utility like xclip or xsel.
Use Case And current workarounds
This feature would be particularly beneficial in copying text from files where users frequently need to copy file contents quickly.
Current alternatives are piping to xclip or xsel, or using a text editor like vim to open and copy contents of a file manually.
Additionally, if implemented, a way to Select Specific Parts of the File:
It would be valuable to have the ability to selectively copy parts of the file, similar to the functionality provided by commands like
head
ortail
. For instance, being able to copy the first 10 lines (head 10
) or a specific range of lines would enhance the flexibility of this feature.The text was updated successfully, but these errors were encountered: