Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure lwd functionality in the fish environment? #241

Open
SadSock opened this issue Sep 25, 2023 · 3 comments
Open

How to configure lwd functionality in the fish environment? #241

SadSock opened this issue Sep 25, 2023 · 3 comments

Comments

@SadSock
Copy link

SadSock commented Sep 25, 2023

How to configure lwd functionality in the fish environment?

@kyoheiu
Copy link
Owner

kyoheiu commented Sep 25, 2023

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
  )"

@SadSock
Copy link
Author

SadSock commented Sep 28, 2023

Sorry all, it looks like this task is beyond my abilities.

@Parzival1918
Copy link

Parzival1918 commented Jan 17, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants