-
-
Notifications
You must be signed in to change notification settings - Fork 26k
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
when typing history -c the result is ➜ ~ history -c fc: event not found: -c #739
Comments
1 |
This is because of the alias to fc located here : https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/aliases.zsh |
|
well, is there other solution to clean the history ?
|
Delete ~/.zhistory.
|
history -r does work with zsh and is no bashism. history -r does not work when history is aliased to fc. Would you mind considering this a bug in your configuration? :) |
The placement of |
Ok, I created a new issue here: #789 |
Although this isn't a real fix, if you need to run "history -r" or "history -c" you can make a quick bash script. echo -e '#!/bin/bash\nhistory -c' >> rmhistory.sh && chmod x rmhistory.sh && ./rmhistory.sh |
I'm not sure what the takeaway on this is... So:
It would be nice if this got fixed. Also, why can't
bash's also, @mztriz , I'm not sure what you are trying to do with your example code but it looks wrong. |
We could convert the current alias into a function, that way we could pass arguments like |
Here's my solution: # Show history
fn_history() {
# Delete the history file if `-c` argument provided.
# This won't affect the `history` command output until the next login.
if [[ "${@[(i)-c]}" -le $# ]]; then
echo -n >| "$HISTFILE"
else
fc $@ -l 1
fi
}
# Timestamp format
case $HIST_STAMPS in
"mm/dd/yyyy") alias history='fn_history -f' ;;
"dd.mm.yyyy") alias history='fn_history -E' ;;
"yyyy-mm-dd") alias history='fn_history -i' ;;
*) alias history='fn_history' ;;
esac The EDIT: I pushed into https://github.com/mcornella/oh-my-zsh/tree/fix-history-alias |
This commit changes the history alias into a function which puts the passed arguments before `-l 1`. It also provides a temporary workaround to the lack of a `history -c` command in zsh. This resolves ohmyzsh#739 and resolves ohmyzsh#789.
@mcornella - Thank you! |
This commit changes the history alias into a function which puts the passed arguments before `-l 1`. It also provides a temporary workaround to the lack of a `history -c` command in zsh. For more information see issues ohmyzsh#739 and ohmyzsh#789.
Hi everyone, I pushed a solution at #3422, hopefully you can take a look and 1 if it works well |
This commit changes the history alias into a function which puts the passed arguments before `-l 1`. It also provides a temporary workaround to the lack of a `history -c` command in zsh. For more information see issues ohmyzsh#739 and ohmyzsh#789.
This commit changes the history alias into a function which puts the passed arguments before `-l 1`. It also provides a temporary workaround to the lack of a `history -c` command in zsh. For more information see issues ohmyzsh#739 and ohmyzsh#789.
This commit changes the history alias into a function which puts the passed arguments before `-l 1`. It also provides a temporary workaround to the lack of a `history -c` command in zsh. For more information see issues \ohmyzsh#739 and \ohmyzsh#789.
I know this is very old, but had the same issue with |
You could to this as workaround.
With this way you don't delete the file, just truncate it. |
fc: event not found: -c and i can't delete the file .zsh_history...(didn't use sudo permission, afraid there will be something wrong if i delete this file.) |
You can safely delete the file, it will be recreated next time you start the terminal. |
Appreciate ur reply! It did recreated and the history was cleared! |
this bug still persists. anybody find a workaround? |
Just delete the file .zsh_history and the history shall be gone. (not so much a bug as a difference between bash and zsh...i think) |
OMG, from Dec 11, 2011 to Nov 6, 2016, 5 years but the problem is still here! |
There's a PR pending to be tested by more people that fixes both |
Fun fact: it's Sept 2017, and this is this still an issue. |
can't you just |
It seems that this also causes a problem with
|
Seems it's still an issue on Sept 2018 :) |
|
|
What does |
It worked after upgrading with
Edit: Nevermind 😄 |
Confirmed that |
It doesn's seem to work on a Mac OS Catalina though. I receive the history output starting from the line number used as an offset. |
Can you open a new issue with details? |
rm ~/.zsh_history then close the terminal when you comeback it's gone |
when typing history -c the result is
➜ ~ history -c fc: event not found: -c
I donot understand the result . Is my oh-my-zsh setting wrong?
I install the command with ➜ ~ wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh and change nothing...
It may be a bug!!
The text was updated successfully, but these errors were encountered: