OhMyREPL.jl icon indicating copy to clipboard operation
OhMyREPL.jl copied to clipboard

Exctract history to clipboard/a script file

Open tecosaur opened this issue 3 years ago • 5 comments

Hello,

There's some minor functionality I've been wanting, and I'm not sure if it would be good as an addition to OhMyREPL or if I should just make a small package for it.

Often I find myself playing with something in the REPL, and then wanting to extract a few lines say to a function I'm writing, or as a script file.

FZF has the -m flag which lets you select multiple candidates with TAB. I'd like to use this to be able to easily grab bits of the history, and either

  • copy to clipboard, or
  • save to a file

With JLFzf, this is as simple as JLFzf.inter_fzf(JLFzf.read_repl_hist(), "-m", "--tiebreak=index", "--read0") |> clipboard, but I feel something more people than just me might find useful.

image

image

What do you think?

tecosaur avatar Jan 03 '22 08:01 tecosaur

I actually need this lol, right now I restart REPL and use up arrow to run correct commands in the correct order and take a screen shot

Moelf avatar Jan 03 '22 09:01 Moelf

Actually, I don't see why history completion couldn't use this so you can fill multiple lines in from history at once. All it takes is adding the -m flag.

tecosaur avatar Jan 03 '22 11:01 tecosaur

  • https://github.com/KristofferC/OhMyREPL.jl/pull/256

I also like it has the flexibility that you can re-order lines by marking them out of order

Moelf avatar Jan 03 '22 18:01 Moelf

I tried https://github.com/KristofferC/OhMyREPL.jl/pull/256#issuecomment-1031210203 but it didn't work for me.

KristofferC avatar Feb 07 '22 08:02 KristofferC

For the original request wanting to pick specific bits of REPL history and copying them to the clipboard, there's pickandcopy() from DoctorDocstrings.jl. (Seems to not be registered with General, so needs add https://github.com/miguelraz/DoctorDocstrings.jl)

It gives a terminal menu with the last n entries from the REPL (n = 25 by default), and lets you choose which ones to copy to the clipboard.

digital-carver avatar Aug 16 '22 09:08 digital-carver