-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: load local config #3207
feat: load local config #3207
Conversation
Thanks for the review and input @kirawi! I've fixed the requested changes (an embarrassing reminder that late night sessions may lead to weird things...) and fixed clippy lint errors locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should use eprintln
and inform the user on startup (file and error message) much like the current behaviour.
Probably also should update the docs. Will fix this tomorrow (no computer today).
✔️ This is now implemented.
This should be optional, as one may not want to use custom config coming with someone else's repo and, more important, this could harm the user's computer, for example by resetting a common key bind to some harmful shell command. |
That probably falls under something like #2697 (or is similar in spirit). It's notable that we already merge in [[language]]
name = "toml"
language-server = { command = "rm", args = ["-rf", "/"] } |
I've added this to [editor.security]
load-local-config = false
confirm-local-config = true (commented out, you will also see That's the default. If you toggle both, then Helix will load What do you think? |
Updated the docs and merged with master. Anything I can do to help this PR forward? (I understand the team is under a lot of load) |
I've fixed your suggestions @kirawi, do you have some more feedback or questions? :) |
NOTE: I merged in master to try and fix a bug that's been introduced somehow. Details below. Huge thank you @pickfire I can see that I maybe wrote this code a bit prematurely in terms of how well (let's be honest, bad) I knew Rust. However, the strange thing now (before the refactor too) is that I seem to lose ability to input text after the editor is loaded. It did not use to be that way. Reproduce: I did some cleanup in addition to yours. It is better now, at least. A bit unsure if the functions should be in config.rs or simply at the bottom of main.rs. |
9ab20dd
to
a53a008
Compare
Since three of four voices in this PR seems to agree, I'll change the default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for working on this.
Somehow I totally forgot this. Sorry. |
Hello fellows! This feature looks great. What needs to be done to be able to merge this? Thanks |
I did a refactor on config loading, #5636. |
That's awesome @gibbz00, thank you! |
I Hope I'm not too late, but I would like helix to also support The exact behavior can either be local replaces the non-local file or is merged with it, favoring the local one (I prefer the second option but both can be argued for) |
What exactly is the advantage of |
As helix becomes more used, I expect some repos will start having a config in their git, like many already do for VSCode, jetbrains IDEs or vim/neovim, in this case |
|
No, what I mean is, in the project repo, people will start committing As an example, search |
Oh I see, For scenarios like this I think it would be better to make use of the |
That seems like a very fast path to the disaster that is using |
Probably introduced when merging with helix-editor#3207. Refreshing config from failed state would not update to set theme from default theme. Reason being that theme was being loaded before config was being set. One would have to refresh the config twice to update the theme as well. This commit changes the refresh order such that the config is actually set before refreshing the theme.
Both vim and emacs disallow modelines from configuring settings that can result in executables being run by default / without user approval. |
This will enable having a
.helix/config.toml
in a project repo and have it override default and~/.config/helix/config.toml
settings.This behaviour is controlled with
config.toml
:The default keeps Helix working as it is.
If you only set
load-local-config = true
then you'll be promted to answeryes
before loading.This prompt can be removed by setting
confirm-local-config = false
.