Setting Atom user config values when my package is installed


Hey all,

I’m creating a new package and I want to know if there’s a way to set config values when somebody first installs the package (like setting default values upon install). Is there some kind of post-install hook I can tap into?



I’m pretty sure what you’re looking for is the configDefaults property on the package:

The best part is that these aren’t just the defaults on initial install, there is support in Atom’s configuration system to show the default value if the user hasn’t added their own configuration and if they delete their own configuration it goes back to the default.


@leedohm So if I want this to only run on first start (aka just installed) where do I need to put this in my package? Should it be in my main file? Also, how do I ensure the config key namespace is preserved? Something like this might work:

        config_val_1: 'some_value'
        config_val_2: 'some_value2'

Something like that?


It’s data … so technically it doesn’t “run”. These are just the defaults for your package. And yes, the way you have it is correct, to my understanding.


If you want them to apply only on the first run, which is what I understand you were asking, I suppose you ought to overwrite them with new values whenever the user changes them?