Closed tjkirch closed 4 years ago
^ This push rebases on master, per https://github.com/cantino/mcfly/pull/95#discussion_r461765585
^ This push addresses https://github.com/cantino/mcfly/pull/95#discussion_r461769704 by splitting HistoryFormat::Plain
into Bash
and Zsh
, with extended_history
only in Zsh
. (This might also help to handle bash's HISTTIMEFORMAT
in the future, similar to zsh's extended history.) It defaults to bash because that's probably most common, but the mcfly.*sh
files all specify their format now.
While this brings up McFly history in fish for me with ctrl^R, I am unable to get it to actually execute anything. Hitting either Tab or Return simply exits from McFly as if I had hit Esc.
While this brings up McFly history in fish for me with ctrl^R, I am unable to get it to actually execute anything. Hitting either Tab or Return simply exits from McFly as if I had hit Esc.
@scott2b What version of fish are you running?
It might help to comment out the removal of the temp file in mcfly.fish, then try again, and paste the content of that file here. Then we can see if the problem is inside mcfly or in mcfly.fish.
I am using fish 3.1.2
My mcfly.output.... files consistently look like:
run
somecommand
Where somecommand is something that would have come from my history.
Oh, but there's one file that is different. It is named mcfly.XXXXXXXX.g83UFnZd, note the missing .output.
part of the name.
And the contents look more like a full history (it's about 10000 lines). E.g. a sample:
: 1592274472:0;mv 05* 05.Week05
: 1592274492:0;mv 06* 06.Week06
: 1592274504:0;mv 07* 07.Week07
: 1592274534:0;git add Lectures/02.Week02
: 1592274540:0;git add Lectures/03.Week03
: 1592274546:0;git add Lectures/04.Week04
: 1592274550:0;git add Lectures/05.Week05
My mcfly.output.... files consistently look like:
run somecommand
Where somecommand is something that would have come from my history.
@scott2b That's the format of the McFly temp files before the change in this PR that makes them work with fish. Are you sure you built and installed McFly with the change from this PR, and put it in your PATH? The change isn't merged yet.
I manually copied mcfly.fish into my fish functions directory and am sourcing that file and calling the binding function in my config.fish file.
Are you saying I should do a full install of mcfly from this branch?
I manually copied mcfly.fish into my fish functions directory and am sourcing that file and calling the binding function in my config.fish file.
Are you saying I should do a full install of mcfly from this branch?
Yeah, the Rust code changed too, so you have to build from this branch and use that McFly binary.
Ok. My bad. I did not realize that. I should have dug deeper into the PR. Thank you for your time. I'll give that a shot.
That was it! This is really great. Thank you so much @tjkirch
^ This push addresses @cantino's concerns by rebasing on master, then removing the MCFLY_PATH
modifications in mcfly.bash
(so there are no longer any changes in that file) and incorporates the path check from the bash/zsh files into mcfly.fish
. Retested fish 2, fish 3, and bash OK.
Thanks @tjkirch! Sorry for the delay and thank you for your contribution!
Yay! Thank you. Works in my fish shell. :smiley:
@tjkirch, I've been sometimes seeing commandline
in my zsh output:
@tjkirch, I've been sometimes seeing
commandline
in my zsh output:
Interesting, I haven't seen that. I can't think of anything in the code that would insert "commandline" literally. I have a few thoughts:
commandline "echo hi"
it should be about the same; two enter presses will echo hi.)So I think this was user error on my part. I haven't seen it again. Thanks @tjkirch!
Implementation notes:
mcfly.fish
is based on the bash/zsh implementations, with the key bindings function inspired by fzf.mcfly_key_bindings
after sourcing the file, rather than automatically, in case the user doesn't like the default ones./usr/bin/env fish
because I believe fish shell path is less likely to be consistent than bash/zsh.MCFLY_HISTORY
file, because we can get the last command easily during a fish postexec function. It's pointed at /dev/null, and temporary file cleanup is skipped.HistoryFormat
enum, defaulting to the current formatPlain
, lets us specify fish-format history so we can import/load.HistoryCommand
struct is used to represent each command in the history file, since it's no longer necessarily one line per entry.search -o
files was extended to allow sending more commands back to the shell, in particular a 'delete' command for fish, which needs to handle history deletion itself rather than through file edits.Possible future improvements:
FishJson
variant ofHistoryFormat
(named as appropriate, based on the format fish selects) and aMCFLY_HISTORY_FORMAT
environment variable that the user can set to select it.when
inHistoryCommand
, if available.Testing done:
Fixes cantino/mcfly#89.