Skip to content
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

Copying the current line to clipboard or primary selection without using the mouse #11

Open
Aster89 opened this issue Mar 28, 2020 · 3 comments

Comments

@Aster89
Copy link

Aster89 commented Mar 28, 2020

Premise: Mice bring deseases.

Your program uses the readline library, so it allows me to take full advantage of the vi editing mode that I use, except that pressing v does not open the editor to edit the command. This, by itself, is not a problem, since your program is just for that, editing the command easily.

However, when I want to copy the command from the shell to somewhere else (e.g. here), I have to approaches:

  • selecting the command with the mouse (to have it stored in the primary selection), which is against the premise;
  • using this approach (to have it stored in the primary selection and/or clipboard, as I like), which assumes that I can edit the command in vi when pressing v.

I don't know if it's possible for you to allow in-editor editing of the command. Maybe you have another way to copy the command to the clipboard or primary selection?

@codekitchen
Copy link
Owner

Yeah honestly I've just been using the mouse to copy/paste when I need to, but definitely open to any better options.

I'm not sure how shells open vi when you press v in vi editing mode. I don't see anything about that in the readline docs, it might be something that shells have implemented themselves. I'll have to look into it further.

@Aster89
Copy link
Author

Aster89 commented Mar 31, 2020

I don't think it has to do with readline. Well, I don't know what the whole readline is for, but I think that essentially bash copies the current line (well, I guess there's an entity where the currently being edited line is stored), opens a temporary file, and pastes the line there. Plus, upon closing the session, whatever that file contains the last time it was saved is executed.

Ok, maybe you needn't this, sorry.

@codekitchen
Copy link
Owner

Yeah, I figured it had to be something like that. I'm a little hesitant to implement that in pipeline just to have a good way to get the command onto the clipboard.

As far as more directly putting the command on the clipboard, this would be pretty easy on MacOS as the pbcopy command is guaranteed to be available. As far as I know, there's no equivalent program guaranteed to be installed on Linux even if a full X environment is installed, I'd probably have to make pipeline depend on xclip or something I think?

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

No branches or pull requests

2 participants