cd on quit
rovr can change the current directory to wherever you were when you quit using the --cwd-file CLI option.
Using --cwd-file
Section titled “Using --cwd-file”The --cwd-file option writes the current working directory to a specified file when rovr exits:
# Create a temporary file and use it with rovrcwd_file=$(mktemp -t rovr_cwd.XXXXXX)rovr --cwd-file "$cwd_file"cd "$(cat "$cwd_file")"rm -f "$cwd_file"shell configuration
Section titled “shell configuration”You can create wrapper functions in your shell config for convenience:
rovr () { local cwd_file=$(mktemp -t rovr_cwd.XXXXXX) command rovr --cwd-file "$cwd_file" "$@" if [ -f "$cwd_file" ]; then cd "$(cat "$cwd_file")" rm -f "$cwd_file" fi}function rovr set cwd_file (mktemp -t rovr_cwd.XXXXXX) command rovr --cwd-file "$cwd_file" $argv if test -f "$cwd_file" cd (cat "$cwd_file") rm -f "$cwd_file" endenddef --env --wrapped rovr [...args: string] { let cwd_file = (mktemp -t rovr_cwd.XXXXXX) ^rovr --cwd-file $cwd_file ...$args if ($cwd_file | path exists) { cd ($cwd_file | open | str trim) rm $cwd_file }}function rovr { $cwd_file = [System.IO.Path]::GetTempFileName() & rovr.exe --cwd-file $cwd_file $args if (Test-Path $cwd_file) { Set-Location -Path (Get-Content $cwd_file) Remove-Item $cwd_file }}Powershell may prevent you from running such functions, so you may have to run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachinefor it to work. For more information on Set-ExecutionPolicy, refer to its
docs
Additional CLI options
Section titled “Additional CLI options”rovr also supports other Yazi-style CLI options for direct integration with scripts and tools:
--chooser-file
Section titled “--chooser-file”Write selected files to a specified file when rovr exits:
# Using a temporary filechooser_file=$(mktemp -t rovr_selected.XXXXXX)rovr --chooser-file "$chooser_file"while IFS= read -r file; do echo "Selected: $file"done < "$chooser_file"rm -f "$chooser_file"Combined usage
Section titled “Combined usage”You can use both options together:
# Using temporary files for both optionscwd_file=$(mktemp -t rovr_cwd.XXXXXX)chooser_file=$(mktemp -t rovr_selected.XXXXXX)rovr --cwd-file "$cwd_file" --chooser-file "$chooser_file"
# Process resultscd "$(cat "$cwd_file")"while IFS= read -r file; do echo "Selected: $file"done < "$chooser_file"
# Clean uprm -f "$cwd_file" "$chooser_file"integrations
Section titled “integrations”as much as it might be tempting, this will not work. i use helix btw and just like superfile, it just cannot launch the app. i’m not sure why, but it might be a conflict between terminal buffer areas. so something like yazi’s
[keys.normal]C-y = [ ':sh rm -f /tmp/unique-file', ':insert-output rovr %{buffer_name} --chooser-file=/tmp/unique-file', ':insert-output echo "\x1b[?1049h\x1b[?2004h" > /dev/tty', ':open %sh{cat /tmp/unique-file}', ':redraw',]will not work