lfcd has to be in bashrc

This commit is contained in:
Oliver Atkinson 2023-08-14 05:18:55 -06:00
parent 4049eaec3e
commit d9fe07f71a
2 changed files with 15 additions and 14 deletions

15
.bashrc
View File

@ -16,6 +16,7 @@ alias bell="paplay /usr/share/sounds/freedesktop/stereo/complete.oga"
alias useage="du -h -d 1 2> /dev/null | sort -h"
# For laptop multi-gpu offloading
alias nvidia_gpu="DRI_PRIME=1 __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia"
alias feh="swallow feh --force-aliasing --draw-exif --scale-down --draw-filename"
export DENO_INSTALL="/home/oliver/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
@ -28,3 +29,17 @@ export WINEPREFIX="$HOME/.wine/"
export DXVK_HUD="fps"
export EDITOR="nvim"
lfcd() {
tmp="$(mktemp)"
lfrun -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
# needs to be in the .bashrc so it can cd for us
cd "$dir"
fi
fi
fi
}

View File

@ -1,14 +0,0 @@
#!/bin/bash
tmp="$(mktemp)"
lfrun -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
fi