Skip to content

Vis plugin that tries to read standard Vim modelines with an LPEG parser

License

Notifications You must be signed in to change notification settings

lutobler/vis-modelines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 Lua unit testing framework.

TODO

  • Write unit tests

About

Vis plugin that tries to read standard Vim modelines with an LPEG parser

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published