summaryrefslogtreecommitdiff
path: root/rc/filetype/lua.kak
AgeCommit message (Collapse)Author
2025-02-05rc/filetype/lua.kak: fix some highlighter issuesthacuber2a03
2023-09-30Add highlighting of Lua variables, labels, and self keywordCaleb Heuer
2022-07-05Move user mappings to <space> and keep/remove selection to ,Maxime Coste
2022-07-05Make `x` just select the full linesMaxime Coste
`x` is often criticized as hard to predict due to its slightly complex behaviour of selecting next line if the current one is fully selected. Change `x` to use the previous `<a-x>` behaviour, and change `<a-x>` to trim to fully selected lines as `<a-X>` did. Adapt existing indentation script to the new behaviour
2021-09-26lua.kak: Add some test cases, and also fix a bugHugo Musso Gualandi
2021-09-11lua.kak: more accurate "end" insertionHugo Musso Gualandi
- Also insert "end" after "do", "else" and "elseif" - Do not insert "end" after strings or comments containing keywords - Only insert "end" if the block is empty An example of the last item is if we want to add a new line to the start of an unclosed block that already contains statements. @ is the cursor. -- before if a then@ x = 1 y = 2 -- after if a then @ end x = 1 y = 2 In this case, inserting the "end" before the statements is probably not what the programmer wants. It might make more sense to insert the "end" after the statements, but that is potentially confusing due to spooky action at a distance. I think the least confusing thing to do in this situation is to not insert the "end".
2021-09-11lua.kak: improve the indentation logicHugo Musso Gualandi
This commit makes several improvements to the Lua indentation logic. - Don't indent if the keyword is inside a string or comment - Indent inside "do end" - Indent inside "repeat until" - Indent after a line ending with "{" or "(" - More accurate un-indentation for the "end" keyword For the last point, previously we tried to match the indentation of the starting keyword of the block. However, sometimes this guessed wrong and produced the wrong indentation, as the following example shows. The new logic is to indent the "end" by one less level than the contents of the block. while true do if false then end end -- This was incorrectly matched with the "if"
2021-09-11lua.kak: use %[] instead of %{}Hugo Musso Gualandi
We will want to use unbalanced "{" and "}" in some of the rules. To support that, let's use "%[]" instead.
2021-09-11lua.kak: remove some extra spacesHugo Musso Gualandi
2021-08-04Remove a duplicate highligher rule for _G/_ENVHugo Musso Gualandi
2021-08-04Recognize and/or/not in a separate ruleHugo Musso Gualandi
This is the usual style
2021-08-04lua.kak: highlight and/or/not as operatorsHugo Musso Gualandi
2021-08-04lua.kak: highlight Lua 5.4 variable attributesHugo Musso Gualandi
2021-08-04lua.kak: Treat "local" as a normal keywordHugo Musso Gualandi
2021-08-04lua.kak: the builtin is called _ENV, not _EHugo Musso Gualandi
The Lua highlighting was highlighing `_E` instead of `_ENV`
2021-08-04lua.kak: keyword should have higher priority than function callHugo Musso Gualandi
Currently, the "return" in `return {}` is highlighted as a function call, instead of being highlighted as a keyword
2021-07-30Merge remote-tracking branch 'hugomg/rockspec-highlighting'Maxime Coste
2021-07-26Recognize ".rockspec" file extension as a Lua fileHugo Musso Gualandi
rockspec files are used by [Luarocks](https://luarocks.org/), the most prominent package manager for Lua. Despite the different file extension, these files are actually Lua files and should be syntax highlighted as such. For what it is worth, Neovim also does the same thing that I am doing in this commit. They recognize both ".lua" and ".rockspec" as being Lua files (and no other extensions, as far as I know).
2021-07-13Lua: insert comment prefix *after* the indentHugo Musso Gualandi
This fixes a bug in how the Lua scripts handle new comment lines. Currently if we have a comment that is indented, when we add a new line it inserts the `--` prefix before the automatic indentation. ``` --ABC -- XYZ ``` After the fix, it correctly inserts the comment prefix after the indentation: ``` --ABC --XYZ ``` The solution I used is inspired by the ruby.kak script.
2021-04-17rc: make insertion hooks more consistentJohannes Altmanninger
2021-03-23Improves Lua auto indent and end insertioncipharius
Current solution makes it difficult to use common Lua practices of having one-liner if statements and using anonymous functions. New solution prevents auto-indentation and end insertion, if the previous line contains an "end" keyword. It does not attempt to match each structure with corresponding end, since using multiple end keywords in single line is a very rare occurance in Lua.
2020-10-03lua.kak: Correct -trim-indent hook and fix indentSeerLite
2020-08-24Avoid accidentally using environment variables in sh scopesJohannes Altmanninger
On the instances with altfile this was already the case, but this makes it more obvious. Closes #3673
2020-03-20rc lua: Improve indent hooks behavior, add '...' highlightingMikhail Pogretskiy
2019-11-15rc lua: Improve syntax highlightingMikhail Pogretskiy
2019-10-22src: Create a <semicolon> named keyFrank LENORMAND
This commit allows using the <semicolon> expansion in commands, instead of `\;`. It makes commands look more elegant, and prevents new-comers from falling into the trap of using <a-;> without escaping the semicolon.
2019-10-08[rc] Use 'fail' when the alternative file cannot be foundOlivier Perret
This makes it possible to implement a fallback strategy using 'try .. catch', for cases where the alternative file is not stored in a subdirectory
2019-04-09Fixed many of the filetype support modules to not use `BufSetOption` to loadJustin Frank
2019-04-08Modified base files to use modulesJustin Frank
2019-03-21Add categories in rc/Alex Leferry 2
Closes #2783