Closed kringalf closed 4 months ago
Try this:
PROMPT_COMMAND="history -a;${PROMPT_COMMAND#;}"
Thanks for the quick response, this helped and fixed the initial issue but i still notice something strange. When i init it like this everything works like a charm:
PROMPT_COMMAND='history -a ; ${PROMPT_COMMAND#;}'
alias cd='z'
alias cdi='zi'
But if i use this method "cd" (and cdi) takes ages and seemingly randomly crashes:
eval "$(zoxide init --cmd cd bash)"
PROMPT_COMMAND='history -a ; ${PROMPT_COMMAND#;}'
Also if I use the first method twice, if i try to use cd it takes ages, and then crashes:
user@host:~>z tmp
user@host:~/tmp>eval "$(zoxide init bash)"; PROMPT_COMMAND='history -a ;${PROMPT_COMMAND#;}'
sagu@linkmobility:~/tmp>z
Warning: Program '/bin/bash' crashed.
If i do it in a subshell it looks like this:
user@host:~>date;( eval "$(zoxide init bash)"; PROMPT_COMMAND='history -a ;${PROMPT_COMMAND#;}'; z tmp );date
Tue Feb 20 23:45:30 CET 2024
Segmentation fault (core dumped)
Tue Feb 20 23:45:39 CET 2024
What version of zoxide are you running? Are you still seeing this issue on the latest release?
I used the version that shipped with ubuntu 22.04
ii zoxide 0.4.3-2 amd64 Faster way to navigate your filesystem
once i switched to the cargo version this issue also seems to be gone, thx again :)
issue fixed
On my machine I use the following PROMPT_COMMAND which always updates my history file for working with multiple open shell's
PROMPT_COMMAND='history -a ; ${PROMPT_COMMAND}'
This causes the following error on running any command:user@host:~/scripts/git/repo/setup-my-machine (master *%=)>echo $PROMPT_COMMAND _zoxide_hook;history -a ; ${PROMPT_COMMAND} _zoxide_hook;history: command not found
If i change the PROMPT_COMMAND to:PROMPT_COMMAND='history -a ;_zoxide_hook ; ${PROMPT_COMMAND}'
bash crashes if i try to change a directory: `user@host:~/scripts/git/repo/setup-my-machine (master *%=)>zWarning: Program '/bin/bash' crashed.`