Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was 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

@paxsali

Description

@paxsali

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions