Commit Graph

701 Commits

Author SHA1 Message Date
Johannes Altmanninger
0b29fcf32a rc diff: evaluate diff-highlight hook before loading module
A recent commit wrapped diff.kak into a module. The module includes the
hook that adds diff highlighting to filetype=diff buffers.  This means
that the hook is only loaded after opening the first diff buffer in a
Kakoune session, so it only actually fires for the second diff buffer.
Fix this by moving the hook out of the module.

Fixes #4525
2022-02-02 11:25:41 +11:00
kjduncan
d44d07bd80 rc:filetype:java refactored to shell block add-highligher with additional highlighter for module system, added static word list and the keywords var yield. 2022-01-29 10:25:16 +11:00
Maxime Coste
28ef698295 Merge remote-tracking branch 'sidkshatriya/php-syntax-heredoc' 2022-01-29 10:19:08 +11:00
Maxime Coste
49339749d1 Merge remote-tracking branch 'krobelus/mail-patch-goto-source' 2022-01-29 10:04:42 +11:00
Johannes Altmanninger
3843163e2e rc mail: enable jumping from inline diff to source file
This allows to jump from a mail buffer that contains an inline diff
to the source files (most accurate when the patch has been applied
locally).

This makes the diff module a mandatory dependency; we could relax that.
2022-01-25 14:15:01 +01:00
Johannes Altmanninger
90b070034d rc diff: skip email quotes in diff-jump
When reading and writing emails that contain patches (possibly
email-quoted), it can be convenient to the jump to the source file.
Allow this by making diff-jump (bound to <ret> in git-diff
buffers) ignore leading email quotes ("> "). A line that starts with
"> " should not occur in a unified diff, so this won't affect other
use cases.

Observe that diff-jump even works around interleaved replies; they
will not affect the computed line numbers because we ignore lines
that don't match ^(> )*[ +-].
2022-01-25 14:15:01 +01:00
Johannes Altmanninger
bf239ba77a rc diff: introduce diff-jump, replacing git-diff-goto-source
git-diff-goto-source is specific to diffs produced by Git.  This patch
generalizes the logic and moves it to a new diff-jump in diff.kak.

The main differences are:
- diff-jump handles plain file diffs (i.e. without the -r option). These
  have no "diff" line. This means that it needs to parse +++/--- instead.
- diff-jump can go to the old file, not just the new one.
- diff-jump allows to override the base directory and the number of
  directory components to strip.

git-diff-goto-source was implemented with several nested try/catch
blocks.  Implementing the extra features would have added more
nesting, redundancy or hidden options. To avoid that, I ported the
parsing logic to Perl (which git.kak already depends on). Maybe
it's possible to do the same in awk.

Potential concerns:
- We could move diff-jump to a new rc/tools/diff.kak but then it's not
  obvious where the "diff" module belongs to.
- Should diff "diff-jump -1" be spelled "diff-jump -p1"?

In future, the diff parser could be reused to implement a vimdiff-style
feature: given a diff and the "old" line number, we can compute the
corresponding "new" line number. Perhaps diff-jump should get a -client
argument.
2022-01-25 14:15:01 +01:00
Johannes Altmanninger
b84abd57de rc diff: make it a module
We want to move git-diff-goto-source from rc/tools/git.kak
to rc/filetype/diff.kak (or should we could create
rc/tools/diff.kak?). Either way, create the diff module so we can
formalize this dependency.

Currently this module only provides highlighters, so require it
wherever we reference them.

Keep the diff-select-{file,hunk} commands outside the module because
people might already use them in git buffers.
2022-01-25 14:11:06 +01:00
Sidharth Kshatriya
c994f4f992 Review: remove a comment 2022-01-24 19:05:35 +05:30
Michał Kruszewski
45539d5d9f VHDL filetype: Add boolean_vector to types.: 2022-01-16 10:28:13 +01:00
Sidharth Kshatriya
9b5040b3f2 .phpt (PHP Test) files should also receive PHP syntax highlighting 2022-01-13 23:24:26 +05:30
Sidharth Kshatriya
c7880932c4 Add support for PHP heredoc in syntax highlighting 2022-01-13 22:57:10 +05:30
Isaac Freund
007a137ac1
rc/filetype/zig: update for zig 0.9.0 release
- c_void has been renamed to anyopaque
- a few new builtins have been added.
2021-12-31 05:00:35 +00:00
Yerlan
a7676709cb
Change highlight of character literals
Better support themes where red can highlight strings and thus the difference between the first and subsequent characters can become invisible
2021-12-11 02:04:10 +01:00
Maxime Coste
36eebbce4f Merge remote-tracking branch 'sidkshatriya/erlang-syntax-highlighting-improvements' 2021-12-06 19:23:53 +11:00
Parasrah
7fc0f9d212
update sigil highlighter to be less error prone 2021-12-02 17:49:28 -07:00
Maxime Coste
0e2612f1ad Merge remote-tracking branch 'sidkshatriya/ocaml-switch-between-ml-and-mli' 2021-11-21 09:37:08 +11:00
Maxime Coste
e88852430b Merge remote-tracking branch 'sidkshatriya/markdown-highlight-erlang-and-elixir' 2021-11-21 09:33:17 +11:00
throwawayaccount12345-1
2a3509e560
sh filetype: do not highlight an empty array as a function
`x=` and `x+=` should not be highlighted as a function.
```
x=()
x+=()
```
2021-11-18 13:51:53 -03:00
Sidharth Kshatriya
b8981883ce markdown.kak: erlang, elixir and ocaml code should be highlighted in markdown 2021-11-17 20:38:12 +05:30
Sidharth Kshatriya
101425e289 OCaml: Add a command to shift between .ml and .mli files and vice versa
C has header and source files and you need to often switch between them.
Similarly OCaml has .ml (implementation) and .mli (interface files) and
one often needs to switch between them.

This commit provides a simple functionality that allows you to accomplish this.
2021-11-10 12:22:08 +05:30
Sidharth Kshatriya
be8dd0eb3d Erlang syntax highlighting: Improved support for numeric literals, refs, ports and pids 2021-10-28 12:43:00 +05:30
Maxime Coste
946673850e Merge remote-tracking branch 'sidkshatriya/erlang-syntax-highlighting' 2021-10-28 09:09:46 +11:00
LXNN
ebcb47e096 Add new '_', 'case', and 'match' keywords to Python highlighter 2021-10-24 12:56:18 +01:00
Sidharth Kshatriya
a547e731f2 Add detection, intialization and basic syntax highlighting for Erlang 2021-10-24 11:47:55 +05:30
Taupiqueur
907cc576ea Fix AsciiDoc blocks
https://docs.asciidoctor.org/asciidoc/latest/blocks/delimited/
2021-10-17 00:19:53 +02:00
Maxime Coste
85a1f78ca9 Merge remote-tracking branch 'Ordoviz/patch-2' 2021-09-29 20:31:30 +10:00
Maxime Coste
133cb9053a Merge remote-tracking branch 'hugomg/better-lua-indentation' 2021-09-29 20:25:15 +10:00
Lennard Hofmann
55b2b8c88d rc markdown: Fix fenced code blocks
The closing ``` in the following example was not detected because the
indented code block highlighter was higher up in the hierarchy than the
fenced code block highlighter:

```
    indented
```

The codeblock highlighter used to be inline so that it has an effect
inside listblocks. This commits adds a listblock/codeblock highlighter
as a replacement.

Fixes #4351
2021-09-27 17:34:31 +02:00
Hugo Musso Gualandi
c26fb65ed1 lua.kak: Add some test cases, and also fix a bug 2021-09-26 11:19:58 -03:00
Maxime Coste
14e820544a Merge remote-tracking branch 'SeerLite/latex-remove-hooks' 2021-09-26 11:09:34 +10:00
Maxime Coste
24f6660bfc Merge remote-tracking branch 'alexherbo2/fix-crystal-escape-string' 2021-09-26 11:03:50 +10:00
kjduncan
3158c9c223 filetype:kotlin keywords to static word list, constants/generics regex improvement 2021-09-21 21:06:35 +10:00
SeerLite
a39516e0dd rc latex: Add missing scope arg to remove-hooks 2021-09-12 17:31:12 -03:00
Hugo Musso Gualandi
aa1a280309 lua.kak: more accurate "end" insertion
- 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-11 01:29:01 -03:00
Hugo Musso Gualandi
8755fc679e lua.kak: improve the indentation logic
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-11 01:27:41 -03:00
Hugo Musso Gualandi
ffc69544db lua.kak: use %[] instead of %{}
We will want to use unbalanced "{" and "}" in some of the rules.
To support that, let's use "%[]" instead.
2021-09-11 01:19:17 -03:00
Hugo Musso Gualandi
94b35a4071 lua.kak: remove some extra spaces 2021-09-11 01:18:49 -03:00
Taupiqueur
f37633277a Fix Crystal escape string 2021-09-04 23:50:12 +02:00
ioh
b739ca4ca6 Fix unterminated string in rc/filetype/php.kak 2021-09-02 14:54:47 -07:00
notquiteamonad
b9c02d48ab
Fix regex for nix paths 2021-08-23 11:06:14 +01:00
Maxime Coste
e63ab10424 Merge remote-tracking branch 'gustavo-hms/master' 2021-08-17 08:43:25 +10:00
Maxime Coste
3a6ab49d5c Merge remote-tracking branch 'kkga/gdscript.kak' 2021-08-17 09:41:10 +10:00
Maxime Coste
d4d5a2f32c Merge http://github.com/mujo-hash/kakoune 2021-08-17 08:29:24 +10:00
Johannes Altmanninger
faba50d528 rc fish: fix keyword highlighting false positive
"command" is a built-in, but these are not:

	$command
	some-command
	command-some
2021-08-09 22:45:52 +02:00
ioh
4932aad623 Add gentoo linux ebuild filetype detection. 2021-08-06 11:30:06 -07:00
Maxime Coste
580869fd49 Merge remote-tracking branch 'StatPal/master' into HEAD 2021-08-05 11:00:30 +10:00
Hugo Musso Gualandi
4f0f3eefd0 Remove a duplicate highligher rule for _G/_ENV 2021-08-04 13:24:16 -03:00
Hugo Musso Gualandi
dc88220e4a Recognize and/or/not in a separate rule
This is the usual style
2021-08-04 13:24:16 -03:00
Hugo Musso Gualandi
be09ff4680 lua.kak: highlight and/or/not as operators 2021-08-04 13:24:16 -03:00