I’m using atuin 18.3.0 and I also have a fzf zsh integration setup.
I use the M-c keybind that fzf created to quickly change to a subdirectory. The command this generates is something like
builtin cd – /Users/collin/.dotfiles/ghostty
I’m able to modify it to strip out the builtin
prefix before it goes into zsh history with this:
function zshaddhistory() {
local line=${1%%$'\n'}
if [[ "$line" = "builtin cd -- "* ]]; then
print -s "cd ${line#"builtin cd -- "}"
return 1
fi
return 0
}
However, this does not work for atuin history. I don’t want to exclude it from atuin history, but rather do what my zshaddhistory
function is doing, removing the builtin cd --
prefix beforehand.
Is there a way to do this? I’ve also tried adding a preexec
function to .zshrc
to do the same thing, and that did not work. FWIW I am initializing atuin at the end of .zshrc
.
TY