antonmedv / fx

Terminal JSON viewer & processor
https://fx.wtf
MIT License
19.08k stars 438 forks source link

[feature] Add ability to capture selected value to clipboard #208

Closed ditsuke closed 1 year ago

ditsuke commented 2 years ago

What

Ability to copy selected value to keyboard

Why

Useful as a quick way to extract some value from JSON and work with it without using a mouse to copy.

History

Previously requested in #69.

banjo commented 2 years ago

This feature would be highly appreciated.

antonmedv commented 2 years ago

What key to bind?) c?

antonmedv commented 2 years ago

cc - copy content

cp - copy path

banjo commented 2 years ago

That sounds good. One example could be.

ck - copy key cv - copy value (or cp - copy content) cp - copy path

4l1fe commented 2 years ago

That sounds good. One example could be.

ck - copy key cv - copy value (or cp - copy content) cp - copy path

What do you about the same commands but yank based? yk, yv, yp. That looks familiar to those who use vim, tmux and etc.

antonmedv commented 2 years ago

What defaults for vim?

4l1fe commented 2 years ago

What defaults for vim?

Neovim copy Kakoune copy

public-rant commented 2 years ago

Just an idea,

y - yank key yy - yank value Y - yank path

waydegg commented 2 years ago

Right now I'm having to result to using Tmux to copy whatever I have in fx, but this would be super nice to have. I'm considering learning some Go just so that this can be added in 😄

antonmedv commented 2 years ago

What do you about the same commands but yank based? yk, yv, yp.

Lets do this way.

ditsuke commented 2 years ago

What do you about the same commands but yank based? yk, yv, yp.

Lets do this way.

I like them! How about with yy defaulting to the value?

antonmedv commented 2 years ago

Why yy to value?)

ditsuke commented 2 years ago

Why yy to value?)

yy yanks the current line in vim. Bringing over the idiom to fx, it should be handy that yy yanks the value considering it the most common use case.

public-rant commented 2 years ago

Why yy to value?)

yy yanks the current line in vim. Bringing over the idiom to fx, it should be handy that yy yanks the value considering it the most common use case.

This was exactly my thinking 😀

antonmedv commented 1 year ago

Done!

Keys are yy yk yp.