Skip to content

cd on quit

rovr can be configured to change the current directory to the directory you were when you quit it.

when cd_on_quit is enabled, rovr will write the path of its current directory to a file named rovr_quit_cd_path in your config directory right before it exits.

a small script or function in your shell’s configuration file can then read this file, cd into the saved directory, and then delete the file.

to enable this feature, you need to set the cd_on_quit option to true in your config.toml file.

config.toml
[settings]
cd_on_quit = true

After enabling the feature, you need to add a function to your shell’s configuration file. This function will wrap the rovr command.

rovr () {
"rovr" "$@"
cd_path_file="$XDG_CONFIG_HOME/rovr/rovr_quit_cd_path"
if [ -f "$cd_path_file" ]; then
cd "$(cat "$cd_path_file")"
rm -f "$cd_path_file"
fi
}