diff options
author | John Ankarström <john@ankarstrom.se> | 2018-10-14 19:05:29 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2023-03-15 14:19:57 +0100 |
commit | 3a9dee34f3f42a3e0177174b9b62d64570533980 (patch) | |
tree | d807ccc0554a6f69b53d707802cad3c5b306b299 /README.md | |
parent | 60f8fa3494d1981ede502f4caf8b471d25de759d (diff) | |
download | vis-filetype-settings-3a9dee34f3f42a3e0177174b9b62d64570533980.tar.gz |
added support for all event except INIT, START, QUIT
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 49 |
1 files changed, 46 insertions, 3 deletions
@@ -1,4 +1,4 @@ -## vis-filetype-settings +## vis-filetype-settings (move-events branch) This plugin provides a declarative interface for setting vis options depending on filetype. @@ -25,8 +25,51 @@ settings = { } ``` -Be sure not to run commands that open another window with the same -filetype, leading to an infinite loop. +### More events + +By default, all settings are run on the WIN_OPEN event, but if you +want, you can specify your own event. + +For more information about these events, check out the [documentation +for the Lua API][doc]. Below is a description of which events are +supported by this plugin. + +[doc]: http://martanne.github.io/vis/doc/index.html#events + +#### File events + +- FILE_OPEN +- FILE_CLOSE +- FILE_SAVE_POST +- FILE_SAVE_PRE + +```lua +settings = { + go = {"set et off", "set tw 8", FILE_SAVE_PRE = "gofmt"} +} +``` + +This will execute the vis command `gofmt` when Go files are saved. + +**WARNING: The command will run in the current window, regardless +of whether it contains a Go file**. + +### Window events + +- WIN_CLOSE +- WIN_HIGHLIGHT +- WIN_OPEN +- WIN_STATUS + +WIN_OPEN is the default event. + +### Other events + +- INPUT + +**WARNING: If you run a vis command on INPUT, vis will automatically +return to normal mode.** There is currently no workaround, as far +as I am aware. ### Installation |