lf: Shell is not set to zsh properly

In my lfrc I set my shell as zsh, however none of my aliases/zsh plugins seem to work. Is there anything I’m doing wrong/missing? In my lfrc I put set shell zsh.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

@chama-chomo It’s not crazy if it works for you. I think it requires you to configure your xdg-open to open text files with the editor and also in the same terminal. And sometimes you want to be explicit about opening a file in an editor even though you are using a different program set to open the corresponding file type. Besides these, I don’t know if there are any disadvantages.

@BlakeWeissman It sounds like you bumbed into #480 which is an open bug that I can’t do much at the moment. The original issue reported about aliases not being available should probably be considered by design. We simply wrap the commands within sh -c ... and shells do not export aliases for such non-interactive use. Instead of -i option, I think you may also try adding source ~/.zshrc to the commands where you make use of your aliases, although I agree with @mohkale that it is better simply to expand your aliases manually inside the commands.

@chama-chomo Oh, seems like this is an lf issue. Not a shell one. But I can’t quite track down why so we should ask the main developer. I’ve actually had this same issue with OPENER in the past but just assumed that was how OPENER is supposed to work. It’s common to try to supply arguments to an EDITOR so we should really account for this.

@gokcehan My findings so far:

  • EDITOR='command -flag' lf makes lf unable to open files because lf tries to run a command named command -flag instead of command with an argument -flag.
  • Doing !sh -c '$EDITOR "$f"' works fine, so I suspect the quoting issue is with lf and not the shell.

I’ll look more into how lf does this to try and see what’s causing it.

~/.zshrc Run for interactive shells.

zshrc is only run for interactive shells so you’re gonna need -i to get it to be evaluated. That’s strange though. Are you using some sort of framework such as ohmyzsh or is it a personal config?

I just tried

lf
:set shell zsh
:set shellopts -i
!alias

and it outputted the same aliases I have in zshell.