aboutsummaryrefslogtreecommitdiff
path: root/lua/vis.lua
AgeCommit message (Collapse)AuthorFilesLines
2025-12-14Use STYLE_WHITESPACE for spaces, newlines, and tabsLaurence de Bruxelles1-0/+1
Allow theming the replacement characters shown for showspaces, showtabs, and/or shownewlines.
2024-11-14lua: fix table member reference in set_syntaxFlorian Fischer1-1/+1
Reported-By: aimixsaka <aimixsaka@gmail.com>
2024-05-30Fail silently when syntax has no lexerMichiel van den Heuvel1-2/+3
This'll patch vis.lexers.load to return nil when the lexer could not be found. Previously it would've errored out, which the load in lexer.lua still will as this is used in lexers themselves. Another possibility is to only patch set_syntax in vis.lua and the WIN_HIGHLIGHT handler in vis-std.lua, but as most references to vis.lexers.load already handle a nil return, this seems better.
2024-04-29Emit an event (ui_draw) immediately before drawing the screenRudy Dellomas III1-0/+2
This allows better control over styling, as well as potential for entirely new UI elements implemented entirely using the Lua API.
2024-04-29lua: small filetype/style setting cleanupRandy Palamar1-12/+2
Filetype extension mapping already needs to match regular expressions so we might as well us it to simplify things. set_syntax doesn't need to handle pseudo scintilla style definitions. I couldn't even find any examples of table style definitions anywhere let alone references to other definitions as $(style.myvarname) (hint: variables in lua already handle this).
2024-03-27lua: update default themesRandy Palamar1-1/+1
This also involves modifying the style definitions so that they include sub tags as well. For example command.section in latex should be mapped to COMMAND_SECTION.
2024-03-27lua: cache loaded lexersFlorian Fischer1-0/+14
Caching lexers causes lexer tables to be constructed once and reused during each HIGHLIGHT event. Additionally it allows to modify the lexer used for syntax highlighting from Lua code. This is used for example for the syntax aware spellchecking performed by the vis-spellcheck plugin.
2024-03-27lua: update default plugins to work with scintillua 6.2Randy Palamar1-2/+2
vis{,-std}.lua: * replace removed _TOKENSTYLES with _TAGS * don't add default styles to the lexer. lexers no longer define their own styles filetype.lua: update path detection for scintillua 6.2
2023-08-24Implementation of the non-blocking process running Lua APIxomachine1-0/+2
Rationale A modern text editor usually includes tools for helping user to avoid mistakes in texts. Those tools include spell checkers and programming language integrations. Though vis explicitly states that the full featured IDE is not a goal, implementing some of the tools might be achieved using its Lua API. Unfortunatelly the API misses the ability to start a process and to perform a communication with it without completely blocking the editor UI, which is crucial for any tool that performs background tracking of the inserted text (e. g. language servers). Implementation details New feature introduces new API method: communicate. The method start a new process and returns a handle to communicate with the process instantly. The patch inserts stderr and stdout file descriptors of the process to the pselect call of the main loop used for reading user input to track the process state without blocking the main loop until the process is finished. Any changes in the process state cause the iteration of the main loop and are being exposed to the Lua API as new event: PROCESS_RESPONSE.
2023-05-24Fix luadoc to use ~= for statusAndrey Proskurin1-1/+1
2022-11-29fix miscellaneous spelling mistakesNick Hanley1-3/+3
2022-11-29Resync the lexers with Scintilluaqiu-x1-2/+23
- Resync the lexers with Scintillua - Update the lexer readme - Update `zenburn` theme to fix some highlighting issues - lexers: redirect print function to vis:info() - Fix support for custom style names - As per error message "lexer.delimited_range() is deprecated, use lexer.range()". - Remove remaining `lexer.delimited_range()` call - Set syntax to `nil` if the file type has no matching lexer - Updated Go lexer for Go 1.18. - lexers/dsv: convert to new lexer format (cherry picked from commit 9edbc3cd9ea1d7142b1305840432a3d2739e755a) - lexers/gemini: disable legacy gemini lexer This reverts commit 468f9ee1b027a7ce98b1a249fa1af5888feeb989. It is in legacy format and of questionable quality. Ideally it should be contributed upstream from where it will eventually trickle down to us. - lexers/git-rebase: convert to new lexer format (cherry picked from commit 4000a4cc9ac4a4c2869dfae772b977a82aee8d8c) - lexers/strace: convert to new lexer format (cherry picked from commit e420451320d97eb164f5629c1bcfab0b595be29d) - lexers/typescript: add new upstream lexer revision 28e2b60 (cherry picked from commit 7326e6deecdaa75fa94ae9ebdb653f9f907b33f2) - use `package.searchpath` instead of a local `searchpath` function - Restore `filetype: support filetype detection via hashbang` - Remove redundant comment - Restore gemini lexer
2020-12-27lua: fix luacheck warningsMarc André Tanner1-1/+1
These are either accidentally global or unused variables. In the file type pluging the mime type variable was wrongly scoped, meaning the text/plain settings applied to all otherwise unknown files.
2020-09-17Pass up terminal CSI as events to Lua.Ez Diy1-0/+2
2018-01-22lua: fix theme loading when lexer module is not availableMarc André Tanner1-1/+3
The color settings are currently stored in the `vis.lexers` table, make sure it is not nil even when loading the lexer module (or one of its dependencies e.g. lpeg) failed.
2017-06-10More theme improvementsPhilipp Emanuel Weidmann1-0/+1
2017-05-31vis-lua: fix file:match_at API documentationMarc André Tanner1-1/+1
2017-03-19vis-lua: allow operators to be defined as lua functionsMarc André Tanner1-0/+36
2017-03-19Move :set theme option implementation to luaMarc André Tanner1-2/+0
2017-03-19Move :set syntax option implementation to luaMarc André Tanner1-2/+45
It is no longer possible to change the used syntax by assigning to the `win.syntax = name` field, instead the function win:set_syntax(name)` should be called. The distinction between filetype and syntax lexer to use should probably be clarified/cleaned up at some point.
2017-02-23vis-lua: use shorter type namesMarc André Tanner1-1/+1
2017-02-22lua: add file:match_at method to match LPeg pattern around a positionMarc André Tanner1-0/+31
2017-02-22lua: expose vis:module_exist method, load lexer and lpeg module during startupMarc André Tanner1-2/+24
2016-12-14lua: improve error message when failing to load lpeg/lexer moduleMarc André Tanner1-8/+1
Differentiate between the case where the module is not found and the case where an error occured while loading it. This should make it easier to debug cases in which there is a Lua version mismatch between vis and lpeg.
2016-12-09vis-lua: add comment about possibly outdated Lua API documentationMarc André Tanner1-1/+1
2016-12-09vis-lua: expose input key event in insert and replace modesMarc André Tanner1-0/+2
2016-12-08vis-lua: move mode constants from vis.MODE_* to vis.modes.*Marc André Tanner1-5/+5
2016-12-08vis-lua: add optional help parameter to mapping functionsMarc André Tanner1-9/+11
2016-12-08vis-lua: expose init event and use it to set default themeMarc André Tanner1-0/+2
The init event is emitted immediately after `visrc.lua` has been sourced, but before any other events have occured, in particular the command line arguments have not yet been processed. Close #422
2016-12-08lua: add simple event multiplexing mechanismMarc André Tanner1-2/+100
The editor core calls into the functions registered in the `vis.events` table which then multiplex the events to all registered event handlers. The first handler which returns a non `nil` value terminates event propagation.
2016-12-07lua: move non-core code out of vis.luaMarc André Tanner1-591/+1
The following structure is adapted: * visrc.lua entry point for all Lua code * vis.lua only implements the Lua part of the core API * vis-std.lua registers standard event handlers (e.g. syntax highlighting, statusbar handling, theme changes etc). It is sourced from vis.lua. * plugins/* non essential editor functionality, needs to be explicitly enabled by loading it from visrc.lua
2016-12-07Move all lua related files to lua/ subfolderMarc André Tanner1-0/+664
Also remove the lexers sub directory from the Lua search path. As a result we attempt to open fewer files during startup: $ strace -e open -o log ./vis +q config.h && wc -l log In order to avoid having to modifiy all lexers which `require('lexer')` we instead place a symlink in the top level directory. $ ./configure --disable-lua $ rm -rf lua Should result in a source tree with most lua specifc functionality removed.