set -- $fx #1947
Replies: 6 comments 1 reply
-
You have two different shells involved:
The Actually I'm not sure why you're starting another shell in the first place, I can only assume it is for debugging purposes. |
Beta Was this translation helpful? Give feedback.
-
not sure why you're starting another shell
I want to have lf temporarily consumed by an interactive shell. Yes, I
can issue short commands directly using `:$` but for more complex ones
that needs a full shell, I launch a new one.
I'm basically using lf as a file selector for my script `"$@"`
arguments. After selecting files I run `./some_`
IFS isn't passed down to the child `zsh` shell process
I see. That's the root of the problem then. How can I issue these
commands on startup?
```
IFS=$"\n"
set -- "${@#"${PWD}/"}"
```
|
Beta Was this translation helpful? Give feedback.
-
I was looking at the lf wiki and I noticed a couple of related entries
to my issue.
1. Putting lf into bg:
map <c-z> $kill -STOP "$PPID"
for some reason, I don't get any shell and the terminal gets stuck. I
can't issue a `fg` command to restore lf.
2. I see that some scripts already use `set -- $(cat
~/.local/share/lf/files)` which is basically what I need. The difference
is that the scripts I'm using are one time command runs that are not
worth adding to lfrc just to run them.
|
Beta Was this translation helpful? Give feedback.
-
On Sat Apr 5, 2025 at 10:44 PM PDT, Joe Lim wrote:
In an interactive shell, you're generally expected to manually type out all commands.
True, but lf makes it easier to view and select files with really long,
chaotic and funky names. I can choose them with tab completion from the
shell, but lf makes the selection process much faster. Again, I'm just
using lf as a selector for vargs (i.e `$@`)
Maybe you can try adding the commands to your `.zshrc` file
Really interesting.. The IFS part works as expected
```
if [ -n "$LF_LEVEL" ]; then
IFS=$'\n'
set -- $fx
fi
```
and I get
```
$ printf "%s" "$IFS" | od -c
0000000 \n
```
However, the `set -- $fx` part doesn't work for some reason. It combines
all of $fx in $1 as one string. Which doesn't make sense for me. What's
stranger is that issuing a command in the shell `set -- $fx` fixes the
issues.
I wonder why that's the case. It should be the same since it's sourced
by ~/.zshrc.
I tried again using bash and bash works as expected. $fx is loaded
into $@ properly. Could be some weird shell stuff is going on with zsh.
Really curious why that is the case.
Thank you for your help
|
Beta Was this translation helpful? Give feedback.
-
P.S: any ideas for why the fg, bg trick not working for me?
… 1. Putting lf into bg:
> map <c-z> $kill -STOP "$PPID"
for some reason, I don't get any shell and the terminal gets stuck. I
can't issue a `fg` command to restore lf.
|
Beta Was this translation helpful? Give feedback.
-
Note that changing IFS value causes some of bash and zsh extensions to
complain:
bash: complete: default -o bashdefault: invalid option name
bash: complete: default -o bashdefault: invalid option name
bash: complete: default -o bashdefault: invalid option name
bash: complete: default -o bashdefault: invalid option name
bash: complete: default -o bashdefault: invalid option name
bash: complete: default -o bashdefault: invalid option name
bash: complete: default -o bashdefault: invalid option name
bash: complete: default -o bashdefault: invalid option name
bash: complete: bashdefault -o nospace -o dirnames: invalid option name
bash: complete: default -o nospace -v: invalid option name
bash: complete: default -o bashdefault: invalid option name
bash: complete: default -o bashdefault: invalid option name
and zsh:
exit
diB daB -- Empty a function {}
(eval):zle:1: not enough arguments for -C
_main_complete:compset:94: can only be called from completion function
_setup:37: compstate: assignment to invalid subscript range
(eval):zle:1: not enough arguments for -C
_main_complete:compset:94: can only be called from completion function
_setup:37: compstate: assignment to invalid subscript range
(eval):zle:1: not enough arguments for -C
_main_complete:compset:94: can only be called from completion function
_setup:37: compstate: assignment to invalid subscript range
(eval):zle:1: not enough arguments for -C
_main_complete:compset:94: can only be called from completion function
_setup:37: compstate: assignment to invalid subscript range
(eval):zle:1: not enough arguments for -C
_main_complete:compset:94: can only be called from completion function
_setup:37: compstate: assignment to invalid subscript range
(eval):zle:1: not enough arguments for -C
_main_complete:compset:94: can only be called from completion function
_setup:37: compstate: assignment to invalid subscript range
(eval):zle:1: not enough arguments for -C
_main_complete:compset:94: can only be called from completion function
_setup:37: compstate: assignment to invalid subscript range
(eval):zle:1: not enough arguments for -C
_main_complete:compset:94: can only be called from completion function
_setup:37: compstate: assignment to invalid subscript range
I made sure to make the IFS conditional to load after all plugins are
loaded in bashrc and zshrc. But it seems that completion functions would
still complain.
I'm trying to replicate these messages in a way independent or outside
of lf to file a bug to those components. I'm not sure if it's because lf
does some things in the background or not.
|
Beta Was this translation helpful? Give feedback.
-
I have
set ifs "\n"
in lfrc and I launch the shell as$zsh -o shwordsplit
Running
set -- $fx
works as expected for file names with no spaces. However, if I have a filename that contains spaces:which doesn't make sense for me because IFS is set as new line:
so $fx should be expanded as "/home/user/one two" and "/home/user/orig" instead of how it currently is.
Relevant issues:
Beta Was this translation helpful? Give feedback.
All reactions