felix
felix copied to clipboard
How to configure lwd functionality in the fish environment?
How to configure lwd functionality in the fish environment?
Hi, Currently the script is for POSIX shell, and does not work in fish as is. I, as a someone who doesn't know anything about fish, believe that it should work though by replacing it in fish syntax and add to config file of fish. Could you give it a try?
FYI, fx --init
outputs these lines:
eval "$(
if [ -n "$XDG_RUNTIME_DIR" ]; then
runtime_dir="$XDG_RUNTIME_DIR/felix"
elif [ -n "$TMPDIR" ]; then
runtime_dir="$TMPDIR/felix"
else
runtime_dir=/tmp/felix
fi
mkdir -p "$runtime_dir"
# Clean up leftover LWD files
find "$runtime_dir" -type f -and -mmin +1 -delete
cat << EOF
fx() {
local RUNTIME_DIR="$runtime_dir"
SHELL_PID=\$\$ command fx "\$@"
if [ -f "\$RUNTIME_DIR/\$\$" ]; then
cd "\$(cat "\$RUNTIME_DIR/\$\$")"
rm "\$RUNTIME_DIR/\$\$"
fi
}
EOF
)"
Sorry all, it looks like this task is beyond my abilities.
I found a workaround using https://github.com/edc/bass plugin for fish.
Basically I created a function felix
in functions/ dir that runs:
function felix
bass "source <(fx --init); fx $argv"
end
and then the ZQ command in felix changes to the LWD as expected. Hope that helps!