From 79ec8d001073366de5ae59382e227bff711262c4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 8 Jul 2018 19:11:04 +1000 Subject: [PATCH] Rename highlighters that used an underscore to use a dash For example `show_matching` is now `show-matching`. --- doc/pages/changelog.asciidoc | 4 ++++ doc/pages/faces.asciidoc | 6 +++--- doc/pages/highlighters.asciidoc | 10 +++++----- rc/base/lint.kak | 2 +- rc/core/kakrc.kak | 2 +- rc/extra/clang.kak | 2 +- rc/extra/git-tools.kak | 4 ++-- src/highlighters.cc | 10 +++++----- test/highlight/column/multi-columns/rc | 2 +- test/regression/1275-replaced-range-split/cmd | 2 +- .../1435-misplaced-cursor-with-show_matching-hl/rc | 2 +- .../rc | 2 +- test/regression/2056-assert-on-small-window/rc | 2 +- 13 files changed, 27 insertions(+), 23 deletions(-) diff --git a/doc/pages/changelog.asciidoc b/doc/pages/changelog.asciidoc index 3808c684..44092e58 100644 --- a/doc/pages/changelog.asciidoc +++ b/doc/pages/changelog.asciidoc @@ -67,6 +67,10 @@ change to make Kakoune command model cleaner and more robust. See <> +* Highlighter type names have been unified, types that used `_` as + word separators, such as `show_whitespaces` are now using `-` + (`show-whitespace`). + * `a` on end of line is not treated specially anymore, it will start inserting on the next character, which will be the first character of the next line. diff --git a/doc/pages/faces.asciidoc b/doc/pages/faces.asciidoc index 004a8832..68b3a9a4 100644 --- a/doc/pages/faces.asciidoc +++ b/doc/pages/faces.asciidoc @@ -105,7 +105,7 @@ The following faces are used by builtin highlighters if enabled. (See <>. *LineNumbers*:: - face used by the `number_lines` highlighter + face used by the `number-lines` highlighter *LineNumberCursor*:: face used to highlight the line number of the main selection @@ -114,7 +114,7 @@ The following faces are used by builtin highlighters if enabled. face used to highlight the line number of wrapped lines *MatchingChar*:: - face used by the `show_matching` highlighter + face used by the `show-matching` highlighter *Whitespace*:: - face used by the `show_whitespaces` highlighter + face used by the `show-whitespaces` highlighter diff --git a/doc/pages/highlighters.asciidoc b/doc/pages/highlighters.asciidoc index d9c1a70b..acef968d 100644 --- a/doc/pages/highlighters.asciidoc +++ b/doc/pages/highlighters.asciidoc @@ -25,11 +25,11 @@ from the remaining parameters. == Convenient highlighters -*show_matching*:: +*show-matching*:: highlight matching char of the character under the selections' cursor using `MatchingChar` face -*show_whitespaces* [options]:: +*show-whitespaces* [options]:: display symbols on top of whitespaces to make them more explicit using the `Whitespace` face, with the following *options*: @@ -48,7 +48,7 @@ from the remaining parameters. *-tabpad* ::: a one character long separator that will be appended to tabulations to honor the *tabstop* option -*number_lines* [options]:: +*number-lines* [options]:: show line numbers using the `LineNumbers`, `LineNumberCursor` and `LineNumbersWrapped` faces, with the following *options*: @@ -115,7 +115,7 @@ git blame output or spelling typos. See <> for the format of `line-specs` and `range-specs`. -*flag_lines* :: +*flag-lines* :: add columns in front of the buffer, and display the flags specified in `line-specs` option, using . In this example two words will be added in the gutter: a blue Foo at @@ -124,7 +124,7 @@ and `range-specs`. ---------------------------------------------------------------------- declare-option line-specs my_flags set-option window my_flags "%val{timestamp}:1|Foo:3|{red,yellow+b}Bar" -add-highlighter window/ flag_lines blue my_flags +add-highlighter window/ flag-lines blue my_flags ---------------------------------------------------------------------- *ranges* :: diff --git a/rc/base/lint.kak b/rc/base/lint.kak index 71282dc8..19725ff3 100644 --- a/rc/base/lint.kak +++ b/rc/base/lint.kak @@ -87,7 +87,7 @@ define-command -hidden lint-show-counters %{ } define-command lint-enable -docstring "Activate automatic diagnostics of the code" %{ - add-highlighter window/lint flag_lines default lint_flags + add-highlighter window/lint flag-lines default lint_flags hook window -group lint-diagnostics NormalIdle .* %{ lint-show } hook window -group lint-diagnostics WinSetOption lint_flags=.* %{ info; lint-show } } diff --git a/rc/core/kakrc.kak b/rc/core/kakrc.kak index 37334711..cf2b64ea 100644 --- a/rc/core/kakrc.kak +++ b/rc/core/kakrc.kak @@ -35,7 +35,7 @@ evaluate-commands %sh{ change-directory rename-session colorscheme declare-user-mode enter-user-mode" attributes="global buffer window current normal insert menu prompt goto view user object - number_lines show_matching show_whitespaces fill regex dynregex group flag_lines + number-lines show-matching show-whitespaces fill regex dynregex group flag-lines ranges line column wrap ref regions region default-region replace-ranges" types="int bool str regex int-list str-list completions line-specs range-specs" values="default black red green yellow blue magenta cyan white yes no false true" diff --git a/rc/extra/clang.kak b/rc/extra/clang.kak index cd993f02..34891ec2 100644 --- a/rc/extra/clang.kak +++ b/rc/extra/clang.kak @@ -150,7 +150,7 @@ define-command -hidden clang-show-error-info %{ define-command clang-enable-diagnostics -docstring %{Activate automatic error reporting and diagnostics Information about the analysis are showned after the buffer has been parsed with the clang-parse function} \ %{ - add-highlighter window/clang_flags flag_lines default clang_flags + add-highlighter window/clang_flags flag-lines default clang_flags hook window -group clang-diagnostics NormalIdle .* %{ clang-show-error-info } hook window -group clang-diagnostics WinSetOption ^clang_errors=.* %{ info; clang-show-error-info } } diff --git a/rc/extra/git-tools.kak b/rc/extra/git-tools.kak index bad45b53..d7d662ca 100644 --- a/rc/extra/git-tools.kak +++ b/rc/extra/git-tools.kak @@ -63,7 +63,7 @@ Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide- run_git_blame() { ( printf %s "evaluate-commands -client '$kak_client' %{ - try %{ add-highlighter window/git-blame flag_lines GitBlame git_blame_flags } + try %{ add-highlighter window/git-blame flag-lines GitBlame git_blame_flags } set-option buffer=$kak_bufname git_blame_flags '$kak_timestamp' }" | kak -p ${kak_session} git blame "$@" --incremental ${kak_buffile} | awk ' @@ -185,7 +185,7 @@ Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide- }" ;; show-diff) - echo 'try %{ add-highlighter window/git-diff flag_lines GitDiffFlags git_diff_flags }' + echo 'try %{ add-highlighter window/git-diff flag-lines GitDiffFlags git_diff_flags }' update_diff ;; update-diff) update_diff ;; diff --git a/src/highlighters.cc b/src/highlighters.cc index a7d7fdfb..36a0213a 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -1061,7 +1061,7 @@ struct LineNumbersHighlighter : Highlighter } private: - static constexpr StringView ms_id = "line_numbers"; + static constexpr StringView ms_id = "line-numbers"; void do_highlight(HighlightContext context, DisplayBuffer& display_buffer, BufferRange) override { @@ -2136,16 +2136,16 @@ void register_highlighters() HighlighterRegistry& registry = HighlighterRegistry::instance(); registry.insert({ - "number_lines", + "number-lines", { LineNumbersHighlighter::create, "Display line numbers \n" "Parameters: -relative, -hlcursor, -separator \n" } }); registry.insert({ - "show_matching", + "show-matching", { create_matching_char_highlighter, "Apply the MatchingChar face to the char matching the one under the cursor" } }); registry.insert({ - "show_whitespaces", + "show-whitespaces", { show_whitespaces_factory, "Display whitespaces using symbols \n" "Parameters: -tab -tabpad -lf -spc -nbsp \n" } }); @@ -2171,7 +2171,7 @@ void register_highlighters() " is a flags(colorize|move|wrap) defaulting to colorize\n" "which specify what kind of highlighters can be put in the group" } }); registry.insert({ - "flag_lines", + "flag-lines", { FlagLinesHighlighter::create, "Parameters: