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

Config file #1119

Merged
merged 25 commits into from Jun 11, 2023
Merged

Config file #1119

merged 25 commits into from Jun 11, 2023

Conversation

LoipesMas
Copy link
Member

@LoipesMas LoipesMas commented Jan 3, 2022

What kind of change does this PR introduce?

Adds configuration file for some settings. It's described in more detail in website/docs/config-file.md file.

Did this PR introduce a breaking change?

No

@shaunsingh
Copy link
Collaborator

Personally I think such settings should be handled from within neovim (via vim.g.<option>), thats just what I think though. Would love to hear others' perspectives as well.

@clason
Copy link
Collaborator

clason commented Jan 9, 2022

I've made my thoughts known elsewhere, but briefly I am strongly in favor of a dedicated config file -- I don't see a reason for shoehorning configuration for one program (Neovide) into that of another program (Neovim). I know that was historically the done thing (coming from vanilla Vim, where the GUI was not a separate program), but I believe this no longer serves a purpose in the Neovim and Lua world, for basically two reasons:

  1. Neovim GUIs are increasingly diverse, and a centralized configuration from Neovim only makes sense if these settings can apply to multiple GUIs (like the old GuiFont directive, which however not even all GUIs support). I don't see this being the case much if at all.
  2. Neovim itself is moving away from dumping a bucket of options into the global scope and more towards a vim.foo.config({ ... }) style.

So why not do something that from the beginning is tailored towards Neovide? (Be it TOML, YAML, JSON, or a text file, as long as I can plop it in .config/neovide and keep it under version control.)

@fredizzimo
Copy link
Member

The situation is a bit tricky. Some options like multigrid, paths to nvim and so on, absolutely needs to be set before connecting to Neovim. Currently these are set by either command line options or environment variables. Well multigrid could theoretically be moved to, if we first starts nvim with a special script to read the setting, but the other ones can still not be moved there.

A settings file in addition to those would be ideal IMO, where the settings can be specified in both, but the command line always overrides the stored settings.

But when it comes to runtime stuff, that you can change at runtime, I think all of that should be inside vim. That allows you to bind keybindings and stuff. Even the current frameless command line option, should be there IMO, which would allow you to toggle frames on and off, on demand.

I think the regular g: style options are fine, since they are easy to use inside Neovide, they even support dictionaries for more complex things. But I think it's possible to pass custom scripts, so a lua based interface for those could also be provided.

For guifont and Neovide, I think that needs to be deperecated in favor of something more structured and extensible, to support all kinds of stuff like custom font weights, separate bold and non-bold fonts, stylistic sets and so on. It's hard to get that all into a single string, and it's non-standard anyway.

@clason
Copy link
Collaborator

clason commented Jan 9, 2022

For the sake of completeness: I was only considering one-time setup options and not runtime changes (which I don't see a lot of use for, to be honest); for the latter, I would similarly prefer exposing functionality via a Lua module (similarly to Uivonim) rather than global variables.

@LoipesMas
Copy link
Member Author

I agree with pretty much everything fredizzimo said. Some things are impossible (or at least hard) to change at runtime and don't make sense to change at runtime. Config file makes sense for those settings. Rather than specifying command line options or setting environment variables.
But other things should probably stay configured by nvim, for keybindings etc.
But then there are two config files (nvim config and neovide config).
Not sure what's the best solution for all that.
I think trying to parse nvim config before starting nvim (however it would be implemented) is the worst solution though.

@clason
Copy link
Collaborator

clason commented Jan 9, 2022

But then there are two config files (nvim config and neovide config).

Yes, that is exactly what I am suggesting. I don't consider this bad. (Just to make it clear: anything Neovim-specific should of course stay in init.vim and friends -- it makes no sense to "take over" or (worse) duplicate Neovim configuration!)

@shaunsingh
Copy link
Collaborator

Personally I think such settings should be handled from within neovim (via vim.g.), thats just what I think though. Would love to hear others' perspectives as well.

Note that this comment was supposed to be for any settings set after we connect to neovim. I didn't realize this PR was for settings connecting before that. In that case, I supporting putting options such as multigrid under a configuration file

@Kethku Kethku mentioned this pull request Jan 24, 2022
17 tasks
@Lite5h4dow
Copy link

im very in favor of this addition, ive stated in other issues that i agree with the idea of having a seperate config file for neovide.

@khjorth
Copy link
Contributor

khjorth commented Sep 16, 2022

This would be very useful for those of us who start nvim instances on remote systems and then connect to them with Neovide. Currently, we have to configure Neovide on each remote system, which is rather unusual for a locally running client.

@last-partizan
Copy link
Collaborator

@LoipesMas let's finish this. Need any help or feedback?

@LoipesMas
Copy link
Member Author

@last-partizan IMO it's ready to be tested by users. Any improvements can be made incrementally in the future.
I didn't want to merge it all by myself, so I was just waiting for some final approval.

src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
@last-partizan
Copy link
Collaborator

@fredizzimo take a look, maybe you spot some rough spots also.

src/settings/config.rs Show resolved Hide resolved
src/settings/config.rs Outdated Show resolved Hide resolved
src/settings/config.rs Outdated Show resolved Hide resolved
@Hubro
Copy link

Hubro commented Jun 5, 2023

This would be great for when you want to run Neovide as a client to a remote Neovim instance. Config such as GUI font and neovide_refresh_rate needs to be set on the client, not Neovim.

A dedicated config file would be perfect for this.

To that end, I would like to humbly request that neovide_refresh_rate and guifont be added to the config file, overriding whatever is set in Neovim 😄 That would be awesome.

@LoipesMas
Copy link
Member Author

To that end, I would like to humbly request that neovide_refresh_rate and guifont be added to the config file, overriding whatever is set in Neovim

@Hubro That would be nice. But those settings are handled a bit differently, so it's not that simple. I'd suggest creating a new issue for that (if there isn't one already open).

@Hubro
Copy link

Hubro commented Jun 7, 2023

To that end, I would like to humbly request that neovide_refresh_rate and guifont be added to the config file, overriding whatever is set in Neovim

@Hubro That would be nice. But those settings are handled a bit differently, so it's not that simple. I'd suggest creating a new issue for that (if there isn't one already open).

Dang 🤕

I opened a new issue: #1891

Updated documentation.

I think it's better to have single example, instead of list + example.

And it's better to have default values, so people can just copy it and change whatever they need.
@last-partizan last-partizan merged commit ed58c49 into neovide:main Jun 11, 2023
3 checks passed
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

Successfully merging this pull request may close these issues.

Command Line Options Configuration File
10 participants