https://github.com/lutobler/vis-modelines
Vis plugin that tries to read standard Vim modelines with an LPEG parser
https://github.com/lutobler/vis-modelines
plugin text-editor vis
Last synced: 12 months ago
JSON representation
Vis plugin that tries to read standard Vim modelines with an LPEG parser
- Host: GitHub
- URL: https://github.com/lutobler/vis-modelines
- Owner: lutobler
- License: mit
- Created: 2017-09-11T16:37:01.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-28T12:56:52.000Z (over 5 years ago)
- Last Synced: 2024-08-07T18:40:04.413Z (almost 2 years ago)
- Topics: plugin, text-editor, vis
- Language: Lua
- Size: 14.6 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## vis-modelines
Vim's modelines are very useful for setting per-file settings in Vim.
For example, the filetype can't always be reliably inferred from the filename, i.e. for templates with generic file extensions or script files that omit the file extension altogether.
This Vis plugin tries to read standard Vim modelines and set the following (Vis) settings:
`autoindent`, `expandtab`, `numbers`, `tabwidth`, `syntax`.
Vim (by default) looks for modelines in the first 5 and last 5 lines of the file. This will emulate this behaviour, but omit the setting to change this threshold, as no sane person would change it (it would break everybody else's Vim).
This parser assumes you will only use *one* modeline per file, to avoid having to resolve conflicts. It will use the first modeline it finds from the top.
### Installation
Clone the repo to your vis plugins directory (`~/.config/vis/plugins`) and add
this to your `visrc.lua`:
```
require("plugins/vis-modelines")
```
The settings from the modeline will be applied *after* Vis is initialized, with the `vis.events.START` event callback.
### Notes
The unit tests require the [busted](https://github.com/Olivine-Labs/busted) Lua unit testing framework.
### TODO
- [x] Write unit tests