diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index 50559b78..9510a679 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -6,15 +6,14 @@ hook global BufCreate .*[.](rust|rs) %{ set-option buffer filetype rust + require-module rust } # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ hook global WinSetOption filetype=rust %[ - require-module rust - - hook window ModeChange insert:.* -group rust-trim-indent rust-trim-indent + hook window InsertEnd .* -group rust-trim-indent rust-trim-indent hook window InsertChar \n -group rust-indent rust-indent-on-new-line hook window InsertChar \{ -group rust-indent rust-indent-on-opening-curly-brace hook window InsertChar [)}] -group rust-indent rust-indent-on-closing @@ -29,9 +28,9 @@ hook -group rust-highlight global WinSetOption filetype=rust %{ # Configuration # ‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook global WinSetOption filetype=rust %[ +hook global WinSetOption filetype=rust %{ set window formatcmd 'rustfmt' -] +} provide-module rust %§ @@ -41,26 +40,28 @@ provide-module rust %§ add-highlighter shared/rust regions add-highlighter shared/rust/code default-region group -add-highlighter shared/rust/string region %{(?]+?>)?\( 1:function +add-highlighter shared/rust/code/variable_declaration regex (?:let\h+(?:mut\h+)?)(_?\w+) 1:variable +add-highlighter shared/rust/code/macro regex \b[A-z0-9_]+! 0:meta # Commands # ‾‾‾‾‾‾‾‾