Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

event not found: -0 #20

Closed
sirfoga opened this issue Apr 12, 2019 · 4 comments
Closed

event not found: -0 #20

sirfoga opened this issue Apr 12, 2019 · 4 comments

Comments

@sirfoga
Copy link
Contributor

sirfoga commented Apr 12, 2019

my system

$ uname -a
Linux novo 4.15.0-39-generic #42-Ubuntu SMP Tue Oct 23 15:48:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ zsh --version
zsh 5.4.2 (x86_64-ubuntu-linux-gnu)

my problem

when I open a shell (e.g gnome-terminal) 3 errors appear:

_shellhistory_last_command:fc:2: event not found: -0                            
_shellhistory_last_command_number:fc:1: event not found: -0
_shellhistory_last_command:fc:2: event not found: -0

I can keep using my shell, but no command data is logged.

solution

my solution

this PR

the question

why does fc not work with arg -0 ? Is there a problem with my shell setup?

@pawamoy thanks for your work

@pawamoy
Copy link
Owner

pawamoy commented Apr 14, 2019

So indeed it seems that fc -lnr -0 does not work on zsh. But using -1 is not right either, because it gives the last command, not the one that is about to be executed.

It seems the behavior differs from Bash to Zsh: https://stackoverflow.com/questions/25295186/access-to-last-command-in-zsh-not-previous-command-line

A solution could be to use echo $history[$HISTCMD] instead of the fc command. I'm gonna run some tests and report back 🙂

@pawamoy
Copy link
Owner

pawamoy commented Apr 14, 2019

I think I have a working solution now. Could you discard your PR #21 as it contains fixes for two issues? I'm gonna open a new one to fix issue #20, so you can review it if you like.

You can also re-open a new PR containing just the fix for #22 (which I think will need just one or two small changes 🙂)

@sirfoga
Copy link
Contributor Author

sirfoga commented Apr 14, 2019

yess, I've tried it (briefly) and it actually seems to be working :)

@pawamoy
Copy link
Owner

pawamoy commented Apr 30, 2019

Solved by #23!

@pawamoy pawamoy closed this as completed Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants