diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-09-23 18:00:51 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-09-23 18:00:51 +1000 |
| commit | dbfed1306f3a7a93cd0b65dca5476ca41dd9419d (patch) | |
| tree | bb0059c3773a0fe74f01f2d04307185c5626674e /rc/base | |
| parent | bb1cb0dbf188992e7ae812b6defe35274195ffdb (diff) | |
git.kak: Refactor commit message highlighting
Use regions to avoid highlighting the commit message as a diff.
The new method will fail if one line of the commit message matches
'^diff --git' but that is fairly unlikely.
Fixes #2371
Diffstat (limited to 'rc/base')
| -rw-r--r-- | rc/base/git.kak | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/rc/base/git.kak b/rc/base/git.kak index 3ae831e8..1e5b4297 100644 --- a/rc/base/git.kak +++ b/rc/base/git.kak @@ -7,10 +7,11 @@ hook global BufCreate .*(\.gitconfig|git/config) %{ } hook -group git-commit-highlight global WinSetOption filetype=git-commit %{ - add-highlighter window/git-commit-highlight group - add-highlighter window/git-commit-highlight/ regex "^\h*#[^\n]*\n" 0:cyan,default - add-highlighter window/git-commit-highlight/ regex "\b(?:(modified)|(deleted)|(new file)|(renamed|copied)):([^\n]*)\n" 1:yellow 2:red 3:green 4:blue 5:magenta - add-highlighter window/git-commit-highlight/ ref diff # highlight potential diffs from the -v option + add-highlighter window/git-commit-highlight regions + add-highlighter window/git-commit-highlight/diff region '^diff --git' '^(?=diff --git)' ref diff # highlight potential diffs from the -v option + add-highlighter window/git-commit-highlight/comments region '^\h*#' '$' group + add-highlighter window/git-commit-highlight/comments/ fill cyan,default + add-highlighter window/git-commit-highlight/comments/ regex "\b(?:(modified)|(deleted)|(new file)|(renamed|copied)):([^\n]*)$" 1:yellow 2:red 3:green 4:blue 5:magenta } hook -group git-commit-highlight global WinSetOption filetype=(?!git-commit).* %{ remove-highlighter window/git-commit-highlight } |
