Commit 820ccc84 authored by Andrey Listopadov's avatar Andrey Listopadov 🕶️
Browse files

redo highlighters for C and Rust

parent 3a265b97
Loading
Loading
Loading
Loading
+55 −53
Original line number Diff line number Diff line
@@ -15,14 +15,15 @@
hook global WinSetOption filetype=(c|cpp) %{
    set-option window formatcmd 'clang-format'

    try %{
        remove-highlighter window/operators
        add-highlighter    buffer/operators regex (\+|-|\*|&|=|\\|\?|%|\|-|!|\||->|\.|,|<|>|:|\^|/|~|\[|\]) 0:operator

    }
    try %{
        remove-highlighter window/delimiters
        add-highlighter    buffer/delimiters regex (\(|\)||\{|\}|\;|'|`) 0:delimiter
    }

evaluate-commands %sh{
    try %{ evaluate-commands %sh{
        # Types and common highlightings. Same for C and C++
        for filetype in c cpp; do
            printf "%s\n" "add-highlighter shared/$filetype/code/field   regex ((?<!\.\.)(?<=\.)|(?<=->))[a-zA-Z](\w+)?\b(?![>\"\(]) 0:meta
@@ -54,13 +55,13 @@ evaluate-commands %sh{
        printf "%s\n" "add-highlighter shared/cpp/code/functions regex (\w*?)\b($(join '${cpp_keywords}' '|'))?(\h+)?(?=\() 1:function"
        # Namespace highlighting
        printf "%s\n" "add-highlighter shared/cpp/code/namespace  regex [a-zA-Z](\w+)?(\h+)?(?=::) 0:module"
    }}
}

# Rust
# ‾‾‾‾
hook global WinSetOption filetype=rust %{
    set window formatcmd 'rustfmt'
}

    evaluate-commands %sh{
        # Common highlightings for Rust
@@ -79,6 +80,7 @@ evaluate-commands %sh{
        # Highlight functions ignoring Rust specific keywords
        printf "%s\n" "add-highlighter shared/rust/code/functions regex (\w*?)\b($(join '${rust_keywords}' '|'))?\h*(?=\() 1:function"
    }
}

# Makefile
# ‾‾‾‾‾‾‾‾
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ plug "andreyorst/kakoune-snippet-collection"
plug "delapouite/kakoune-text-objects"
plug "occivink/kakoune-vertical-selection"
plug "occivink/kakoune-sudo-write"
plug "occivink/kakoune-find"

plug "andreyorst/base16-gruvbox.kak" theme %{
    colorscheme base16-gruvbox-dark-soft