Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

[enhancement] add FFF_CD_ON_EXIT variable to controll cd on exit #198

Open
paxsali opened this issue Apr 22, 2023 · 0 comments
Open

[enhancement] add FFF_CD_ON_EXIT variable to controll cd on exit #198

paxsali opened this issue Apr 22, 2023 · 0 comments

Comments

@paxsali
Copy link

paxsali commented Apr 22, 2023

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant