hstr icon indicating copy to clipboard operation
hstr copied to clipboard

Doesn't work with multiline history records

Open zdmytriv opened this issue 5 years ago • 12 comments

Doesn't work with multiline history records

echo """1
2
3
"""

after looking up in hstr it finds and inserts only echo """1\ which only first line.

zdmytriv avatar Nov 30 '18 10:11 zdmytriv

I admit that this behavior is intentional as I didn't know how to fit multi-line history records in commands list nicely...

@zdmytriv @max-lobur would you have any suggestion/preference how can I improve HSTR? Like making multi-line command single line and indicating new lines using a character... any other idea?

dvorka avatar Dec 02 '18 17:12 dvorka

@dvorka thanks for takin a look. "\n" will be totally ok, usually other lines are just args, I primarily search for a command name not args, so this will work. Kind of

command --arg 1 --arg 2 \n...

or

command --arg 1 --arg 2\n--arg 3 --arg 4 

both will be better than trimming

max-lobur avatar Dec 03 '18 10:12 max-lobur

How about simply indenting the multilines by 1 or 2 whitespaces? As of now all history entries start on the very left, so indenting could be used to hint at a multiline entry.

dguendisch avatar Dec 06 '18 22:12 dguendisch

You would lose too much useful space

max-lobur avatar Dec 06 '18 22:12 max-lobur

Even if it didn't show all the lines, at least if it could insert them right that'd be much better already.

aljungberg avatar Oct 31 '19 15:10 aljungberg

Am I also fine if it displays first line only as long as long as full version is used.

metaflow avatar Apr 21 '20 07:04 metaflow

This would be super useful! Currently having a difficult time with ROS commands like:

rostopic pub -r 10 /husky_velocity_controller/cmd_vel geometry_msgs/Twist "linear:
  x: 0.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0" 

Does shopt -s cmdhist make a difference? This link might be useful: https://unix.stackexchange.com/questions/353386/when-is-a-multiline-history-entry-aka-lithist-in-bash-possible/353407

edmuthiah avatar May 16 '20 05:05 edmuthiah

Is there any workaround for this?

Sispheor avatar Jan 04 '21 15:01 Sispheor

I am also looking for this

sant527 avatar May 26 '21 03:05 sant527

Same here!

Initially I had both shopt -s cmdhist and shopt -s lithist enabled, but this doesn't work. Just having shopt -s cmdhist enabled works somewhat. When it's possible the command will be a single line separated by ;. But for example multiline strings are still not supported

DavidCDreher avatar Mar 24 '22 14:03 DavidCDreher

I am also looking for this

atlas-comstock avatar Sep 29 '23 04:09 atlas-comstock

same here

muratcankaracabey avatar Sep 30 '23 06:09 muratcankaracabey