Skip to content

How to force settings plugin save outside of settings itself? #1623

Answered by takase1121
SmileYzn asked this question in Q&A
Discussion options

You must be logged in to vote

For the sake of completeness, there are many ways to write to a file on config change:

1. write to a file when plugin loads

core.add_thread(function()
  ...
end)

This function will execute once the editor is set up, but will not be run again when user edits the init file.

2. Make the user write to the config

You can make the user call a function in the user init to write your config files. This is how its done some editors like Neovim, but some might not prefer this approach.

3. Use settings GUI callback

For installs with the settings GUI, you can specify on_apply callback to run something when a setting is changed via the GUI. This of course will not apply to settings changed outside of …

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by takase1121
Comment options

You must be logged in to vote
5 replies
@Guldoman
Comment options

@SmileYzn
Comment options

@SmileYzn
Comment options

@Guldoman
Comment options

@SmileYzn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1622 on September 22, 2023 04:51.