dylanaraps/fff

[enhancement] add FFF_CD_ON_EXIT variable to controll cd on exit

paxsali opened this issue · 0 comments

I have the following enhancement to propose:

Let the user controll fff's behavior via a variable FFF_CD_ON_EXIT.

If set, changes to the last directory fff was in, else no changes are made.

This would also mean you have to update your README.MD "CD on EXIT" section to this:

# Add this to your .bashrc, .zshrc or equivalent.
# Run 'fff' with 'f' or whatever you decide to name the function.
fff() {
    command fff "$@"
    if [[ -v FFF_CD_ON_EXIT ]]; then
        cd "$(<"${XDG_CACHE_HOME:=${HOME}/.cache}/fff/.fff_d")"
    fi
}

I don't know fish shell, so somebody else has to provide the fish-analogue.

How to use?

FFF_CD_ON_EXIT=t
fff

Obviously, FFF_CD_ON_EXIT is supposed to be permanently set in .bashrc also, if this should be the default behavior.

echo "export FFF_CD_ON_EXIT=t" >> ~/.bashrc

I already tested it on my machine. Works seamlessly.

That would be all.