Open cgxxv opened 3 months ago
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
.
@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.
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
.
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
I have a lot of shell in my pc, my default shell is fish. While I don't want to write some fish shell for some lf integrations, I just want to use sh or bash for my integrations interpreter. It seems
set shell sh
not working.The problem: