Git Product home page Git Product logo

Comments (4)

joelim-work avatar joelim-work commented on August 12, 2024

I'm guessing you have sh linked to fish, so with the default setting set shell sh, all shell commands will be interpreted by fish. If you want to use a different shell within lf, then just configure something like set shell bash.

from lf.

cgxxv avatar cgxxv commented on August 12, 2024

@joelim-work Thanks for your replay. I don't have a linked sh for fish. But even I have a linked sh for fish maybe the better way is using the absolute path for this shell interpreter.

set shell bash

cmd rg_search ${{
    res="$( \
        RG_PREFIX="rg --column \
            --hidden \
            --line-number \
            --no-heading \
            --no-ignore \
            --glob '!.git/*' \
            --color=always \
            --smart-case "
        preview="
            filepath=\$(echo {}|awk -F ':' '{print \$1}')
            currentline=\$(echo {}|awk -F : '{print \$2}')
            startline=\$([ \$currentline -ge 50 ] && expr \$currentline - 50 || expr 0)
            endline=\$(expr \$currentline + 50)
            bat -n --line-range \$startline:\$endline --highlight-line \$currentline --color always \$filepath
        "
        FZF_DEFAULT_COMMAND="$RG_PREFIX ''" \
            fzf --bind "change:reload:$RG_PREFIX {q} || true" \
            --ansi --header 'Search in files' \
            --preview "$preview" \
            | cut -d':' -f1
    )"
    [ ! -z "$res" ] && lf -remote "send $id select \"$res\""
}}
map fs :rg_search

I use chsh to switch shell and test the case.
When I switched to zsh works fine, while with fish shell failed and show the top error. Not test for bash.

from lf.

joelim-work avatar joelim-work commented on August 12, 2024

When executing shell commands (e.g. map x $var=123; echo "$var"), lf uses the shell that's configured using set shell ....

Your login shell (set using chsh) is not relevant here.


Here is a more minimal config example:

set shell bash
# set shell fish
# set shell zsh

map x $var=123; echo "$var"

For me set shell bash and set shell zsh work, but set shell fish doesn't, which is what I would expect since var=123 isn't valid syntax in fish.

from lf.

Trid-collab avatar Trid-collab commented on August 12, 2024

I am facing the same issue with integrations for my fish shell even though I have set shell fish
I found it works when I convert the integration to compatible with fish

from lf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.