Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: allow multiple user config files #4926

Open
mikejsavage opened this issue Nov 20, 2024 · 3 comments
Open

FR: allow multiple user config files #4926

mikejsavage opened this issue Nov 20, 2024 · 3 comments

Comments

@mikejsavage
Copy link

mikejsavage commented Nov 20, 2024

Hi,

I develop on several computers and would like to be able to have machine specific jj configs.

I will preface this by saying it's not very important and you can already do it with machine specific shell aliases and --config-toml.

Generally software lets you do this by having a shared main config, which includes a local config (which might not exist) with machine specific stuff in, e.g. for git in WSL I have:

> cat ~/.gitconfig
...
[include]
    path = .gitconfig.local
> cat ~/.gitconfig.local
[core]
        fileMode = false

Less commonly, some software (fish shell) loads everything from a config dir in alphabetical order, so you can do 0-base.fish/1-local.fish to achieve the same thing.

For a concrete example of why this would be helpful for jj, I have [ui] paginate = "never" on Windows because jj launches the pager when everything would fit on one screen and my WSL pager renders escape chars as ESC, making jj quite unusable

@shanesveller
Copy link

I make use of Git's includeIf to set things like user.email or commit templates based on whether a project is personal/OSS/professional, and I miss that opportunity as well as basic includes as mentioned here.

@yuja
Copy link
Collaborator

yuja commented Nov 20, 2024

We'll add some includeif-like feature, but the implementation isn't started yet.
#616

@martinvonz
Copy link
Owner

We also have a TODO about maybe reading all config files in ~/.config/jj/ (I think we would simply delete the config_dir.push("config.toml"); line):

jj/cli/src/config.rs

Lines 416 to 422 in a6c18e8

// TODO: Should we drop the final `/config.toml` and read all files in the
// directory?
let platform_config_path = ConfigPath::new(self.config_dir.map(|mut config_dir| {
config_dir.push("jj");
config_dir.push("config.toml");
config_dir
}));

As a workaround, you can actually already set $JJ_CONFIG to a directory path and we'll read all files from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants