mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[zsh] improve viscd
This commit is contained in:
parent
30c90cdfb6
commit
0f082b90a1
1 changed files with 2 additions and 2 deletions
|
@ -8,9 +8,9 @@ mkcd() { mkdir -p "$@" && cd "${@[-1]}"; }
|
|||
|
||||
viscd() {
|
||||
local temp_file chosen_dir
|
||||
temp_file="$(mktemp)"
|
||||
temp_file="$(mktemp -t ranger_cd.XXXXXXXXXX)"
|
||||
ranger --choosedir="$temp_file" -- "${@:-$PWD}"
|
||||
if chosen_dir="$(<"$temp_file")" && [[ -n "$chosen_dir" ]]; then
|
||||
if chosen_dir="$(<"$temp_file")" && [[ -n "$chosen_dir" && "$chosen_dir" != "$PWD" ]]; then
|
||||
cd -- "$chosen_dir"
|
||||
fi
|
||||
rm -f -- "$temp_file"
|
||||
|
|
Loading…
Reference in a new issue