help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

history_comment_char and yank-last-arg


From: Jens Schmidt
Subject: history_comment_char and yank-last-arg
Date: Mon, 29 Jul 2024 00:25:12 +0200
User-agent: Mozilla Thunderbird

I'm an avid user of yank-last-arg, and every now and then I'd
really like the following to work (where, while typing the "cp"
statement, I notice that directory "bar/" does not yet exist):

cp foo bar/<M-#>

  => "#cp foo bar/" pushed to history

mkdir <M-.>

  => ding!

No good.  yank-last-arg won't process the tokens of the commented
previous line.  Today I set off to find out why, and came across
history_comment_char.  So I tried setting

  histchars=$'!^\001'

and hurray! I could access also the tokens of a previously
commented line with yank-last-arg.

Well, a couple of minutes later I learned that the history
comment char is also used to store history timestamps, which I'm
also an avid user of.

Of course, I could redo my past bash histories to use the new
history comment char for all timestamps, but it seems wrong.
Plus I'm not sure whether setting history_comment_char to
something different than '#' would have other funny side effects.
(Though a cursory search through the sources does not seem to
indicate that.)

What do you recommend?

Would a feature request to enable my scenario above be something
realistic?  For example, by introducing a fourth "histchar" or a
completely new option?

[ If it matters, I do *not* use history expansion, that is, I use
  "set +o histexpand". ]

Thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]