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

Enable cd on exit by sourcing the main script #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ A simple file manager written in `bash`.
**NOTE:** `fff` can be uninstalled easily using `make uninstall`. This removes all of files from your system.

### CD on Exit
#### Bash
```sh
# Add this to your .bashrc or equivalent.
. fff
```
#### Bash and Zsh
```sh
# Add this to your .bashrc, .zshrc or equivalent.
Expand Down
10 changes: 10 additions & 0 deletions fff
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
#
# fff - fucking fast file-manager.

# Enable cd on exit by sourcing fff
if (return 0 2>/dev/null); then
function fff {
command fff "$@"
[[ ${FFF_CD_ON_EXIT:-1} == 1 ]] &&
cd "$(cat "${XDG_CACHE_HOME:-${HOME}/.cache}/fff/.fff_d")"
}
return
fi

get_os() {
# Figure out the current operating system to set some specific variables.
# '$OSTYPE' typically stores the name of the OS kernel.
Expand Down