lite
lite copied to clipboard
Allow user config to be stored in home directory
As far as I can tell, right now if you want to make customizations you have to edit data/user/init.lua
inside your checkout of the lite repo. Most programs with similar config files allow you to store them as dotfiles in your home directory so you can keep it separate from the source for lite itself. Maybe something like ~/.config/lite/init.lua
if you're on a unix system.
I can submit a patch for this if you think it's a good idea.
It's something I'm also interested in and to be honest with you, I planned to ask the same question for an obvious reason: I compile lite
myself and every single time, I have to copy the whole project from location A to location B, with the exception of data
folder; then, I have to copy all sub-directories except user
folder, in order to retain my custom settings.
To answer your possible question about why I do such thing, is so I can keep lite
's repository in sync, without polluting it with my customizations.
It would be wise indeed to have either a $HOME/.lite/
folder or $HOME/.config/lite/
as you have already suggested.
Hi,
I understand the attraction of this mechanism for UNIX users, but under Windows it's a PITA.
I'm sure you have all seen the rise of "portable" Windows software ("just copy it into a single directory and it works!"). Some may point out it's a crutch for a poor OS, but it is very convenient for carrying software on a USB stick! Lite is fully "portable" for Windows OS at present.
Setting $HOME environment variables may be beyond the knowledge or assigned privileges of many windows users. By all means have an option to use $HOME/.lite/ but please retain the ability to use data/user/init.lua.
I also struggle to keep my customisations safe with each new release: I would prefer a distribution with no lua files in the data/user folder - so I don't overwrite my init.lua file!
Plugins are the recommended way of customising Lite and are a great resource in the absence of documentation. I would like the plugin autoloader to preferentially load plugins from data/user/plugins/, if the same file name exists in data/plugins/ and data/user/plugins/ - all unique plugins from both sources should be loaded. This would keep my personal and tweaked plugins safe when overwriting with a new release.
I guess a similar mechanism could be applied to the loading of colors: distribute with data/colors/ but preferentially load duplicates from data/user/colors/.
It should also be possible to do this preferential loading from $HOME/.lite/plugins and $HOME/.lite/colors for those who want.
Hacking files in core/ is by definition not really supported for persistent customisation, I guess this is the rôle of pull requests.
Hope I haven't made this sound too complicated, I love the KISS approach of Lite.
Kind Regards Gavin Holt
I think there is an extremely easy solution to this issue.
@rxi can you please remove data/user/init.lua
and replace it with a README.txt
with an explanation to the user how to create user settings?
I didn't mention anything about data/user/colors/
, because we don't care about the color theme files as we don't customize them at all.
In README.txt
it should contain the data from data/user/init.lua
as an example of how to customize lite behavior.
This way we won't have any override / overwrite with each fresh compilation of lite, due to the uniqueness of init.lua
in data/user/
.
In short, those who want to customize lite's behavior, all they have to do would be to copy the contents of data/user/README.txt
to data/user/init.lua
and that should be it.
Even if I compile lite
a million times, no data/user/init.lua
will get overwritten by any vanilla init.lua
file.
@Gavin-Holt Yeah there's no need for this to get in the way if you don't want to use it on Windows or something. Users who want to stick with the existing approach can keep editing data/user/init.lua
but at the bottom of the default init file there could be a little section which checks for the user file inside the home dir and does nothing if it's not present.
Setting $HOME environment variables may be beyond the knowledge or assigned privileges of many windows users.
Surely Windows has a way to identify where user-level config can live without setting environment variables?
I feel we all have some learning to do when it comes to using software like Lite is. We have all we need already, we don't need to make the author our bitch.
-- core/user/init.lua
require(os.getenv("HOME") .. ".lite")
And now you have your config in ~/.lite/init.lua
. All your requires in this file will work too, because the package.path
is setup to look into executable's dir.
A bit of wget
to update Lite with skipping user/lite.lua
and you're done.
I personally love this the most about Lite. Don't have to wait for anyone or ask for a permission to do a customization. Nor bother other people with features only we like. I want my caret be a giant puppy, I can do it!
How about using an environment variable or a startup cli option to configure the config dir, leaving the current working dir as a default?
You can use my plugin: https://github.com/rxi/lite-plugins/pull/98
Just put it in data/plugins
and remove data/user
But in order to transfer the old settings:
- Move the contents of
data/user
to~/.lite
or~/.config/lite
or${XDG_CONFIG_HOME}/lite
- Remove empty
data/user
- Rename
init.lua
touser.lua
- If you loaded modules from
data/user
somewhere, remove theuser.
prefix. Ex:require "user.colors.summer"
torequire "colors.summer"