summaryrefslogtreecommitdiff
path: root/rc/filetype/hare.kak
AgeCommit message (Collapse)Author
2023-12-13Avoid semantically significant comments in kak filesChris Webb
Kakoune's balanced strings require that delimiter characters nested inside them are also paired, so for example in %{ }, each nested { must occur before a corresponding } to balance it out. In general this will automatically be the case for code in common scripting languages, but sometimes regular expressions used for syntax highlighting do end up containing an unbalanced bracket of one type or another. This problem is easily solved because there is a free choice of balanced delimiter characters. However, it can also be worked around by adding a comment which itself contains an unbalanced delimiter character, to 'balance out' the unpaired one in the regular expression. These unbalanced comments are not ideal as the semantic role they perform is easy for a casual reader to overlook. A good example is catch %{ # indent after lines with an unclosed { or ( try %< execute-keys -draft [c[({],[)}] <ret> <a-k> \A[({][^\n]*\n[^\n]*\n?\z <ret> j<a- gt> > # indent after a switch's case/default statements try %[ execute-keys -draft kx <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ] # deindent closing brace(s) when after cursor try %[ execute-keys -draft x <a-k> ^\h*[})] <ret> gh / [})] <ret> m <a-S> 1<a-&> ] } in rc/filetype/go/kak. Here, it is not instantly obvious that the comment containing an unmatched { is required for correctness. If you change the comment, delete it or rearrange the contents of the catch block, go.kak will fail to load, and if you cut-and-paste this code as the basis for a new filetype, it is a loaded gun pointing at your feet. Luckily, a careful audit of the standard kakoune library turned up only three such instances, in go.kak, hare.kak and markdown.kak. The examples in go.kak and hare.kak are easily made robust by replacing a %{ } with %< > or %[ ] respectively. The example in markdown.kak is least-intrusively fixed by rewriting the affected regular expression slightly so it has balanced { and } anyway.
2023-06-04hare.kak: change back the commandDmitry Matveyev
Previously was changed in https://github.com/mawww/kakoune/pull/4785 Probably some race condition that right now works with a big letter P?
2023-03-13Merge branch 'fix/hare-comment-insert' of http://github.com/stacyharper/kakouneMaxime Coste
2023-01-02Add @packed to hare highlighterStacy Harper
ref: https://todo.sr.ht/~sircmpwn/hare/783
2022-11-20Fix hare new line insert indentation after commentsStacy Harper
At the moment, inserting a new line while being in a comment result in a "//<indentation>" instead of "<indentation>//". To fix this, we just paste the comment and indent after the newline initial indentation.
2022-11-19Fix hare new line insert indentation after commentsStacy Harper
At the moment, inserting a new line while being in a comment result in a "//<indentation>" instead of "<indentation>//". To fix this, we just re-order both InsertChar hooks.
2022-10-10Fix slicing operator not being highlightedCaleb Heuer
2022-10-09Fix function highlighting with numbersCaleb Heuer
2022-10-07Improve Hare syntax highlightingCaleb Heuer
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
2022-06-11hare.kak: highlight module imports as "module"Cormac Stephenson
2022-06-09hare.kak: remove TODO listCormac Stephenson
2022-06-09fix case statement regexJon Eskin
2022-06-09remove redundant whitespace trimJon Eskin
2022-06-09Add hare comments and indentationJon Eskin
2022-06-09rc: add hare language moduleCormac Stephenson