https://github.com/jocap/vis-filetype-settings
A plugin for the vis editor that lets the user set options depending on filetype.
https://github.com/jocap/vis-filetype-settings
vis vis-editor vis-plugin
Last synced: 11 months ago
JSON representation
A plugin for the vis editor that lets the user set options depending on filetype.
- Host: GitHub
- URL: https://github.com/jocap/vis-filetype-settings
- Owner: jocap
- License: mit
- Created: 2018-10-12T18:22:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-12T11:14:12.000Z (over 2 years ago)
- Last Synced: 2024-11-25T01:33:31.364Z (over 1 year ago)
- Topics: vis, vis-editor, vis-plugin
- Language: Lua
- Homepage:
- Size: 5.86 KB
- Stars: 10
- Watchers: 4
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## vis-filetype-settings
This plugin provides a declarative interface for setting vis
options depending on filetype.
It expects a global variable called `settings` to be defined:
```lua
settings = {
markdown = {"set expandtab on", "set tabwidth 4"}
}
```
In this variable, filetypes are mapped to sets of settings that are
to be executed when a window containing the specified filetype is
opened.
If you want to do more than setting simple options, you can specify a function instead:
```lua
settings = {
bash = function(win)
-- do things for shell scripts
end
}
```
Be sure not to run commands that open another window with the same
filetype, leading to an infinite loop.
### Installation
As a suggestion, copy `vis-filetype-settings.lua` into
`~/.config/vis/plugins/` and add the following to your `visrc.lua`:
```lua
require("plugins/vis-filetype-settings")
settings = {
filetype = settings
}
```