Commit Graph

915 Commits

Author SHA1 Message Date
Johannes Altmanninger
86d940c225 rc tools git: command for easy recursive blaming
Our ":git blame" annotates each line with the most recent commit.
However often a line has been modified by several commits.

Introduce ":git blame-jump" which shows the commit that added the
line at cursor. Crucially, it works also in Git diff buffers, so it
can be used recursively to find the full history of a line.

To do the recursive blame from a diff, I need to navigate to the
old (deleted) version of a line. Since old and new line are usually
neighbors. Speed up the common scenario of finding the old version
by making ":git blame-jump" jump to the new version. This means the
initial diff view might not include the commit message etc. Compensate
this by showing the commit's date+author+subject in the status line.

Here are some test cases.
- run blame-jump after "git blame"
- create an uncommitted or unsaved line, run "git blame" and
  "blame-jump" on the uncommitted line
- run blame-jump without running "git blame"
- run blame-jump in "git show"
- run blame-jump in "git diff HEAD"
- run blame-jump in "git diff --cached"
- run blame-jump in "git diff" (YMMV if there are cached changes,
  could fix that)

Naming: there are some similar commands in the wild [1];
they are usually called "show-blamed" or similar, but they
don't jump to the corresponding line.  Also our list of git
commands is getting a bit messy (especially the undocumented
show-diff/hide-diff/next-hunk/prev-hunk; subject first naming seems
better).

[1]: f6e78ec4c0/kakrc (L423)

Future work: to go back to the previously-blamed commit we need to
have had the foresight to use "rename-buffer". Perhaps we want to
add some kind of buffer stack (like Magit does for example).
2024-02-05 21:42:02 +11:00
Johannes Altmanninger
36efbf4cbf rc filetype diff: extract diff parsing from diff-jump
Most diff consumers we've written only care about the "final" state
after parsing through a diff. Let's extract the diff parsing part,
for reuse in several new commands.

In future we should try to use this (or better, a diff-parsing library)
for patch-range.pl. We'd add a callback argument that is invoked once
perl hunk (or line). Unfortunately I haven't found that library for
Perl yet.
2024-02-05 21:42:02 +11:00
Johannes Altmanninger
2c944f6415 rc patch.kak: fix quoting
I learned that

    $ foo="'1

    2'"
    $ echo $foo
    '1 2'

Quote some variables to avoid this double unescaping.
2024-01-26 10:05:55 +11:00
Maxime Coste
b0119b0696 Merge remote-tracking branch 'razetime/master' 2024-01-17 21:01:45 +11:00
Maxime Coste
11aede3493 Merge remote-tracking branch 'c7skasku/ocaml-comment-insert' 2024-01-17 21:01:04 +11:00
Maxime Coste
455cd73a93 Merge remote-tracking branch 'geppettodivacin/protobuf-newline-fix' 2024-01-17 21:00:26 +11:00
Maxime Coste
218f7ba0e0 Merge remote-tracking branch 'greenfork/update-pony' 2024-01-17 20:55:46 +11:00
Eric Dilmore
8ff2860851 Fix command name in protobuf newline hook 2024-01-16 14:58:31 -06:00
Cormac Stephenson
3beeda7bcc ocaml.kak: give a name to the hook which inserts comment characters
This lets set-option window disabled_hooks .*-insert work as expected.
2024-01-15 03:15:42 +00:00
Dmitry Matveyev
2a5a1ab611 Update Pony language support
The last update is from 2017, it's pretty outdated. Current
support was combined from existing languages such as Ruby and
Zig and tweaked to fit the Pony language.
2024-01-11 23:46:14 +03:00
razetime
e9a71d22f3 add prolog highlighter 2024-01-11 10:47:41 +08:00
Maxime Coste
9716875ba9 Merge remote-tracking branch 'arachsys/scheme-infnan' 2024-01-05 15:27:25 +11:00
Maxime Coste
12246674f1 Merge remote-tracking branch 'arachsys/groovy-quoting' 2024-01-05 15:26:44 +11:00
Igor Ramazanov
1edebb8505
Update scala.kak to support SBT, ScalaCLI and Ammonite files
* https://www.scala-sbt.org/1.x/docs/Directories.html#sbt+build+definition+files
* https://scala-cli.virtuslab.org/docs/getting_started#scripting
* https://ammonite.io/#ScriptFiles
2023-12-30 19:29:32 +00:00
Chris Webb
d9614c77e1 Fix quoting in rc/filetype/groovy.kak
Escape " with \ inside a double-quoted string to avoid a load error.
2023-12-13 17:22:54 +00:00
Chris Webb
51dab20aef Fix escaping in the scheme.kak highlighter awk script
The awk-generated highlighters in scheme.kak need '\\.' to obtain '\.'
in the generated kakscript output. Fix the inf/nan rule (which should
generate '(?:inf|nan)\.0') to read '(?:inf|nan)\\.0' in the awk.
2023-12-13 17:12:59 +00:00
Maxime Coste
250ead2b7a Merge remote-tracking branch 'arachsys/c-family-pp' 2023-12-12 21:21:40 +11:00
Chris Webb
86979841b7 Improve c-family highlighting of preprocessor directives
The current handling of preprocessor directives in filetype/c-family.kak
leads to a wall of solid colour for more complicated #if or #define
directives, although #include is already nicely highlighted.

Instead of highlighting an entire directive with the meta face, highlight
just the #define, #if or #elif keyword as meta, treating the rest of the
directive as normal c-family expressions. This significantly improves
the readability of complex macro definitions.

For directives other than #define, #if and #elif, we treat the rest of
the directive as an opaque string in normal face rather than trying to
highlight it, covering cases like #error, #pragma, etc. where the rest
of the line is an error message string or other non-expression content.

This does the right thing for #ifdef and #ifndef too, as we don't highlight
identifiers in c-family text so their arguments should be normal face
anyway.
2023-12-10 13:50:29 +00:00
Chris Webb
8a14fbc15b Highlight inline patches and signatures in mail.kak
We already pull in the diff module in mail.kak to enable the nice
:diff-jump behaviour on inline patches. Also enable the shared/diff/
highlighter underneath our shared/mail/ highlighter for inline diffs,
listing it first so mail patterns take precedence over diff patterns.

De-emphasise signatures including the standard '^-- \n' separator in the
same way as quoted text in a reply.

Fixes: https://github.com/mawww/kakoune/issues/4998
2023-12-10 11:42:32 +00:00
Maxime Coste
84ecd41da1 Merge remote-tracking branch 'herrhotzenplotz/feat/hg-highlight-keywords' 2023-12-02 11:05:27 +11:00
Maxime Coste
c93c57a46f Merge remote-tracking branch 'krobelus/fuzzy-menu' 2023-12-02 10:56:29 +11:00
Michał Kruszewski
7910aff11d troff: Highlight .pdfhref and links 2023-11-25 19:45:20 +01:00
Johannes Altmanninger
1f11529837 rc tools menu: replace menu builtin with a prompt-based implementation
prompt has fuzzy filtering which is more discoverable than the menu
mode's regex filtering (because that one needs / to trigger it).
There are no important differences left, so replace the menu builtin
with a prompt-based command.

prompt does not support markup in the completion menu, so drop that
feature for now.
2023-11-20 20:47:22 +01:00
Nico Sonack
befad73a30 filetype/mercurial: Improve highlighting of Mercurial commit messages
This highlights important commit metadata when editing mercurial
commit messages such as the user, the branch, bookmark etc. with
reasonable colours.
2023-11-16 11:33:07 +01:00
Nico Sonack
f19546a2bb filetype/mercurial: Fix file name regex
The regex for detecting Mercurial's file types was too strict and
didn't catch commit messages.

Relax it to make it detect the commit files properly.
2023-11-16 11:30:07 +01:00
Maxime Coste
7a130c89ce Merge remote-tracking branch 'jdugan6240/odin-support' 2023-11-05 13:48:57 +11:00
Maxime Coste
154a393c7b Merge remote-tracking branch 'arrufat/zig-syntax' 2023-11-02 18:29:35 +11:00
Maxime Coste
41e57f62dc Merge branch 'juliacolors' of http://github.com/chriselrod/kakoune 2023-11-02 18:28:53 +11:00
Maxime Coste
e882c23501 Merge remote-tracking branch 'greenfork/improve-janet-syntax' 2023-11-02 18:21:59 +11:00
Adrià Arrufat
0015a29c19 rc/filetype/zig: remove align builtin and add f80 type
In commit ca36d0d228
the align function was added as a builtin accidentally.

Also, f80 type was added in Zig 0.10.0: https://ziglang.org/download/0.10.0/release-notes.html#f80
2023-11-02 12:13:41 +09:00
chriselrod
7bc1504725
@macro! 2023-11-01 17:23:03 -04:00
chriselrod
bf4f780cfa
Many more Julia operators 2023-10-31 23:13:33 -04:00
chriselrod
e48d81d20b
Add more highlighters for Julia 2023-10-31 22:49:19 -04:00
Dmitry Matveyev
4332b0dc71 janet: syntax improvements and trailing whitespace cleaning 2023-10-31 11:15:38 +04:00
murray
b20747d44e Gren highlighting
Gren is an elm fork and it's syntax is currently still
similar enough to use the same highlighter.
2023-10-29 20:51:42 +00:00
Maxime Coste
b020922e6f Fix some corner cases in c-family indentation 2023-10-25 12:51:16 +11:00
Maxime Coste
d50048d0b4 Highlight a few extra mail headers 2023-10-24 10:47:20 +11:00
Caleb Heuer
5ec40c63b2 Add highlighting of Lua variables, labels, and self keyword 2023-09-30 11:57:30 -06:00
James Dugan
24ab9d4343 Added odinlang support 2023-09-24 17:03:07 -06:00
Maxime Coste
f21145c249 Merge remote-tracking branch 'QiBaobin/filetype-grovvy' 2023-09-08 05:28:56 +10:00
Bob Qi
8f6ef9512f add groovy filetype 2023-09-07 09:52:00 +08:00
Caleb Heuer
142925fc90 This is numerics, not identifiers 2023-09-06 12:24:06 -06:00
Caleb Heuer
c338efe078 Support generics in function highlighting 2023-09-06 12:03:49 -06:00
Caleb Heuer
6148a16a0e Add spread operator 2023-09-06 12:03:49 -06:00
Caleb Heuer
88bb854f36 Improve Go highlighting 2023-09-06 12:03:49 -06:00
Michał Kruszewski
521549fb69 troff: Highlight .PSPIC and .PDFPIC macros 2023-07-30 09:47:10 +02:00
Maxime Coste
90acec991f Merge remote-tracking branch 'omasanori/ocaml-lex-and-yacc' 2023-07-29 15:33:48 +10:00
Maxime Coste
991b233468 Merge remote-tracking branch 'arrufat/zig-builtin-functions' 2023-07-29 15:33:15 +10:00
Masanori Ogino
8fb0a99f05 Detect .mll and .mly files as OCaml sources 2023-07-26 17:15:06 +09:00
Adrià Arrufat
fdb33e7302 zig: add c_char type 2023-07-26 12:37:35 +09:00