sxyazi / yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.
https://yazi-rs.github.io
MIT License
14.54k stars 331 forks source link

To be able to pass a yazi config as an argument like `yazi --config "path_to_config"` #1148

Closed luccahuguet closed 2 months ago

luccahuguet commented 3 months ago

Please describe the problem you're trying to solve

cant pass config as an argument, have to always edit the .config/yazi.toml config

Would you be willing to contribute this feature?

Describe the solution you'd like

To be able to pass a yazi config as an argument like yazi --config "path_to_config"

Additional context

This feature would allow me to run yazi in two modes in this setup: https://github.com/luccahuguet/zellij-files

one as a small sidebar, and the other as a full blown pane

sxyazi commented 3 months ago

Does YAZI_CONFIG_HOME work for you? https://yazi-rs.github.io/docs/configuration/overview#custom-directory

mikavilpas commented 3 months ago

Someone just found out that yazi.nvim can display images if ueberzugpp is configured here.

I'm thinking this should be the default in yazi.nvim since neovim doesn't support the other protocols in its embedded terminal - so I would like to override the user's configuration for this part only ("use ueberzugpp"). I don't want to change anything else in their config.

Do you think some kind of partial config overriding could be supported? Or is there a way to do this already?

sxyazi commented 3 months ago

so I would like to override the user's configuration for this part only ("use ueberzugpp")

You don't need to override it as Yazi will automatically detect the user's environment - if it's Neovim and ueberzugpp is available (on X11/Wayland, since ueberzugpp only supports those and not macOS or Windows), it will enable it automatically.

daUnknownCoder commented 3 months ago

hey @sxyazi, i tried many terminals but ueberzug++ defaults in all of them, idk why bcz it is not something i configured...

cant we automagically scale and align the ueberzug++ generated image for:

sxyazi commented 3 months ago

Hey @daUnknownCoder, thanks for your report, but this isn't the right place. If you have an issue regarding ueberzug, please create a new issue and fill out the form so I can capture all the necessary information and respond efficiently.

daUnknownCoder commented 3 months ago

Hey @daUnknownCoder, thanks for your report, but this isn't the right place. If you have an issue regarding ueberzug, please create a new issue and fill out the form so I can capture all the necessary information and respond efficiently.

It's related to the neovim yazi image thing - which requires editing the yazi.toml automatically through my init.lua

github-actions[bot] commented 3 months ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

luccahuguet commented 2 months ago

Does YAZI_CONFIG_HOME work for you? https://yazi-rs.github.io/docs/configuration/overview#custom-directory

I am checking with the zellij folk, thank you for the idea

luccahuguet commented 2 months ago

nevertheless, do you plan on implementing such behavior in the future?

yazi --config "path_to_config"

luccahuguet commented 2 months ago

I did try passing the env as an argument, but it's not working for now

maybe it could work using my shell as a workaround but Yazelix is intended to be easy to configure, so I'd rather avoid the extra dependency

sxyazi commented 2 months ago

do you plan on implementing such behavior in the future

No, I want to avoid it because Yazi has multiple configuration files not just one. This means that a similar set of parameters needs to be added for each configuration file, which seems redundant and incomplete to me. Also plugins/flavors might need a new approach or might not be supported at all. So I just want to simply support YAZI_CONFIG_HOME, which just sets a new configuration path and this would apply to flavors/plugins as well.

but it's not working for now

How do you use it?

luccahuguet commented 2 months ago

No, I want to avoid it because Yazi has multiple configuration files not just one. This means that a similar set of parameters needs to be added for each configuration file, which seems redundant and incomplete to me. Also plugins/flavors might need a new approach or might not be supported at all. So I just want to simply support YAZI_CONFIG_HOME, which just sets a new configuration path and this would apply to flavors/plugins as well.

I see... what about yazi --layout "1 4 3"?

How do you use it?

I tried a few different solutions, but zellij's maintainer explained that layouts are only supposed to rearrange panes, not create them, and that I could just open it in a new tab (which is not quite what I want, but I get it)

the solutions (they didn't work, so I wouldnt waste my time on it if I were you):

swap_tiled_layout name="yazi_full" {
    ui {
        pane  {
            // command "with-env { YAZI_CONFIG_HOME : '/home/lucca/.config/yazi/yazi_full.toml' } { nu }"
            // command "YAZI_CONFIG_HOME=/home/lucca/.config/yazi/yazi_full.toml"
            // args "yazi"
            command "env"
            args "YAZI_CONFIG_HOME=/home/lucca/.config/yazi/yazi_full.toml" "yazi"
            size "100%"
        }
    }
}

I was optimistic about this command "env" solution because it does not use a shell, but it didnt work

sxyazi commented 2 months ago

I see... what about yazi --layout "1 4 3"?

Still, I don't think this is an ideal solution but even worse, it means we need to add separate parameters for every option in all configuration files.

args "YAZI_CONFIG_HOME=/home/lucca/.config/yazi/yazi_full.toml" "yazi"

YAZI_CONFIG_HOME is a directory, not a file, not quite sure how zellij works, but you might want YAZI_CONFIG_HOME=~/.config/another_yazi/.

I'm going to close this issue as not in the plan and YAZI_CONFIG_HOME is already supported.

luccahuguet commented 2 months ago

Still, I don't think this is an ideal solution but even worse, it means we need to add separate parameters for every option in all configuration files.

hmm, I see

YAZI_CONFIG_HOME is a directory, not a file, not quite sure how zellij works, but you might want YAZI_CONFIG_HOME=~/.config/another_yazi/.

I should've seen that, thanks

luccahuguet commented 2 months ago

@sxyazi PS: I got it working!!

sxyazi commented 2 months ago

Hell yeah, nice!

Do you mind sharing your working configuration? I'm a bit curious about how it works :)

luccahuguet commented 2 months ago

Hell yeah, nice!

Do you mind sharing your working configuration? I'm a bit curious about how it works :)

Hehe

Actually, the repos are updated, you can just check them out

but basically, I got the default config on the place its expected to be, and the sidebar config in a folder, inside the default config folder

the ugly part is that for each "closed" pane, like the sidebar or full yazi pane, they're actually open with a width of 1%, lol

            pane {
                command "yazi"
                size "1%"
            }
            pane {
                command "env"
                args "YAZI_CONFIG_HOME=~/.config/yazi/sidebar" "yazi"
                size "20%"
            }

but I'll release v3 today, so you'll be hearing from me

github-actions[bot] commented 1 month ago

I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.