Skip to content

Allow direct output of text or raw data, rather than needing to pipe output through cat #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
map588 opened this issue Jan 25, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@map588
Copy link
Contributor

map588 commented Jan 25, 2025

I am trying to use cb as a custom clipboard for neovim, and because of all the output formatting, my buffers get full of non-ascii characters of the output cli when that specific clipboard is empty, and preferably I could either use 'paste' or 'show' to just, put out the data with no frills.

Its tedious to try and make shell commands using lua (at least for me) that pipe output to something like cat, and it feels odd to me this feature does not already exist.

That feature being, just vomit out the raw contents of that clipboard (if its not a file or directory, and it exists), and do nothing otherwise. I am annoyed that I am reliant on 'echo' and 'cat' to move data in and out of clipboards from stdin and stdout, I guess. That seems like a trivial thing but its been the bane of my little project.

Yes, I set the environment variables and double checked. Its probably a Lua skill issue, and its certainly possibly in the current state to accomplish what I am trying to do, but it stood out to me as odd that trying to just grug-brain text in and out of a clipboard was not a trivial thing. All the other features are awesome and for CLI use, its nice to see, but I wish there were an actual silent flag.

I looked through the code, and I am not C++ certified enough to understand how it fits together, I do not think I could submit a pull request.

@map588 map588 added the enhancement New feature or request label Jan 25, 2025
@Slackadays
Copy link
Owner

I could probably add a --raw flag to disable everything except the raw content. Would that be a good solution for you?

@map588
Copy link
Contributor Author

map588 commented Jan 25, 2025

Yes, that would be perfect. Would it be possible to have --raw for copy and paste? The reason being is I need to put "'s around everything coming from neovim for it to just except text and not try to find a file that wouldn't exist. So with the raw flag it might behave like:

cb copy 123
cb paste
output>>123

and so on for any other clipboard, like cb cp25 123; cb p25 => 123

Thank you for the quick response!

@map588
Copy link
Contributor Author

map588 commented Jan 25, 2025

I was planning on making the neovim module basically:

index = 1
cb copy(index) [whatever was put in the neovim clipboard buffer]

-- (then asynchronously)

if cb paste_history == null
   cb load index  _nvim-history
else
   cb paste(index) | cb add_nvim-history

cb add_nvim-history "\n"

(++index)%(max+1)

Then I could use something like fzf-tmux to select from all the history of nvim copies, which would be pretty cool. All of the cb commands in the example would use the flag --raw except for load and add I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants