mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[zsh] add viscd function
This commit is contained in:
parent
e036df7c48
commit
30c90cdfb6
1 changed files with 10 additions and 0 deletions
|
@ -6,6 +6,16 @@ bytecount() { wc -c "$@" | numfmt --to=iec-i; }
|
||||||
|
|
||||||
mkcd() { mkdir -p "$@" && cd "${@[-1]}"; }
|
mkcd() { mkdir -p "$@" && cd "${@[-1]}"; }
|
||||||
|
|
||||||
|
viscd() {
|
||||||
|
local temp_file chosen_dir
|
||||||
|
temp_file="$(mktemp)"
|
||||||
|
ranger --choosedir="$temp_file" -- "${@:-$PWD}"
|
||||||
|
if chosen_dir="$(<"$temp_file")" && [[ -n "$chosen_dir" ]]; then
|
||||||
|
cd -- "$chosen_dir"
|
||||||
|
fi
|
||||||
|
rm -f -- "$temp_file"
|
||||||
|
}
|
||||||
|
|
||||||
is_linux() { [[ "$OSTYPE" == linux* ]]; }
|
is_linux() { [[ "$OSTYPE" == linux* ]]; }
|
||||||
is_macos() { [[ "$OSTYPE" == darwin* ]]; }
|
is_macos() { [[ "$OSTYPE" == darwin* ]]; }
|
||||||
is_android() { [[ "$OSTYPE" == linux-android ]]; }
|
is_android() { [[ "$OSTYPE" == linux-android ]]; }
|
||||||
|
|
Loading…
Reference in a new issue