This commit is contained in:
Michael Chalupiak
2025-11-14 00:11:07 -05:00
parent 367244a53d
commit 16169fbab4
8 changed files with 522 additions and 197 deletions

View File

@@ -1,69 +0,0 @@
# Detection
# ‾‾‾‾‾‾‾‾‾
hook global BufCreate .*[.](typ) %{
set-option buffer filetype typst
}
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group typst-highlight global WinSetOption filetype=typst %{
require-module typst
add-highlighter window/typst ref typst
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/typst }
hook window InsertChar \n -group typst typst-on-new-line
}
provide-module typst %§
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/typst group
# Comments
add-highlighter shared/typst/ regex ^//(?:[^\n/][^\n]*|)$ 0:comment
# Strings
add-highlighter shared/typst/ regex '"[^"]*"' 0:string
# Headings
add-highlighter shared/typst/ regex ^=+\h+[^\n]+$ 0:header
# Code blocks
# Raw with optional syntax highlighting
add-highlighter shared/typst/ regex '^```[^(```)]*```' 0:mono
# Multiline monospace
add-highlighter shared/typst/ regex '^`[^(`)]*`' 0:mono
# Monospace text
add-highlighter shared/typst/ regex \B(`[^\n]+?`)\B 0:mono
add-highlighter shared/typst/ regex \B(```[^\n]+?```)\B 0:mono
# Bold text
add-highlighter shared/typst/ regex \s\*[^\*]+\*\B 0:+b
# Italic text
add-highlighter shared/typst/ regex \b_.*?_\b 0:+i
# Code expressions: functions, variables
add-highlighter shared/typst/ regex (^|\h)#(\w|\.|-)+ 0:meta
# Bold terms in term lists
add-highlighter shared/typst/ regex ^/\h[^:]*: 0:+b
§
# Commands
# ‾‾‾‾‾‾‾‾
define-command -hidden typst-on-new-line %<
evaluate-commands -draft -itersel %<
# Preserve previous line indent
try %{ execute-keys -draft <semicolon> K <a-&> }
# Cleanup trailing whitespaces from previous line
try %{ execute-keys -draft k x s \h+$ <ret> d }
>
>

View File

@@ -0,0 +1,191 @@
# Carbonfox theme for Kakoune
#
# Taken and adapted from
# <https://github.com/EdenEast/nightfox.nvim/blob/main/lua/nightfox/palette/carbonfox.lua>
# Color palette
declare-option str black_base "rgb:282828"
declare-option str black_dim "rgb:222222"
declare-option str black_bright "rgb:484848"
declare-option str red_base "rgb:ee5396"
declare-option str red_dim "rgb:ca4780"
declare-option str red_bright "rgb:f16da6"
declare-option str green_base "rgb:25be6a"
declare-option str green_dim "rgb:1fa25a"
declare-option str green_bright "rgb:46c880"
declare-option str yellow_base "rgb:08bdba"
declare-option str yellow_dim "rgb:07a19e"
declare-option str yellow_bright "rgb:2dc7c4"
declare-option str blue_base "rgb:78a9ff"
declare-option str blue_dim "rgb:6690d9"
declare-option str blue_bright "rgb:8cb6ff"
declare-option str magenta_base "rgb:be95ff"
declare-option str magenta_dim "rgb:a27fd9"
declare-option str magenta_bright "rgb:c8a5ff"
declare-option str cyan_base "rgb:33b1ff"
declare-option str cyan_dim "rgb:2b96d9"
declare-option str cyan_bright "rgb:52bdff"
declare-option str white_base "rgb:dfdfe0"
declare-option str white_dim "rgb:bebebe"
declare-option str white_bright "rgb:e4e4e5"
declare-option str orange_base "rgb:3ddbd9"
declare-option str orange_dim "rgb:34bab8"
declare-option str orange_bright "rgb:5ae0df"
declare-option str pink_base "rgb:ff7eb6"
declare-option str pink_dim "rgb:d96b9b"
declare-option str pink_bright "rgb:ff91c1"
declare-option str bg0 "rgb:0c0c0c"
declare-option str bg1 "rgb:161616"
declare-option str bg2 "rgb:252525"
declare-option str bg3 "rgb:353535"
declare-option str bg4 "rgb:535353"
declare-option str fg0 "rgb:f9fbff"
declare-option str fg1 "rgb:f2f4f8"
declare-option str fg2 "rgb:b6b8bb"
declare-option str fg3 "rgb:7b7c7e"
declare-option str comment "rgb:6e6f70"
declare-option str sel1 "rgb:525253"
declare-option str sel0 "rgb:2a2a2a"
# Markup
set-face global title "%opt{yellow_base}"
set-face global header "%opt{red_bright}"
set-face global bold "%opt{fg1}+b"
set-face global italic "%opt{fg1}+i"
# Builtins
set-face global Default "%opt{fg1},%opt{bg1}"
set-face global PrimarySelection "%opt{fg2},%opt{sel0}"
set-face global SecondarySelection "%opt{fg3},%opt{sel1}"
set-face global PrimaryCursor "%opt{bg1},%opt{fg1}"
set-face global SecondaryCursor "%opt{bg1},%opt{fg2}"
set-face global PrimaryCursorEol "%opt{fg2},%opt{blue_bright}"
set-face global SecondaryCursorEol "%opt{fg3},%opt{blue_dim}"
set-face global LineNumbers "%opt{fg3},%opt{bg1}"
set-face global LineNumberCursor "%opt{fg2},%opt{bg1}"
set-face global LineNumbersWrapped "%opt{fg3},%opt{bg1}+i"
set-face global MenuForeground "%opt{fg1},%opt{sel1}"
set-face global MenuBackground "%opt{fg1},%opt{sel0}"
set-face global MenuInfo "%opt{fg1},%opt{bg0}"
set-face global Information "%opt{fg1},%opt{bg0}"
set-face global Error "%opt{red_base},%opt{bg0}"
set-face global StatusLine "%opt{fg2},%opt{bg0}"
set-face global StatusLineMode "%opt{green_bright},%opt{bg0}"
set-face global StatusLineInfo "%opt{blue_bright},%opt{bg0}"
set-face global StatusLineValue "%opt{orange_base},%opt{bg0}"
set-face global StatusCursor "%opt{bg0},%opt{fg2}"
set-face global Prompt "%opt{blue_bright},%opt{bg0}"
set-face global MatchingChar "%opt{fg1},%opt{sel1}"
set-face global Whitespace "%opt{fg3},%opt{bg1}"
set-face global WrapMarker Whitespace
set-face global BufferPadding "%opt{blue_dim},%opt{bg1}"
# Code
set-face global value "%opt{orange_bright}"
set-face global type "%opt{yellow_base}"
set-face global variable "%opt{white_base}"
set-face global module "%opt{blue_base}"
set-face global function "%opt{blue_bright}"
set-face global string "%opt{green_base}"
set-face global keyword "%opt{magenta_base}"
set-face global operator "%opt{fg2}"
set-face global attribute "%opt{blue_base}"
set-face global comment "%opt{comment}"
set-face global documentation comment
set-face global meta "%opt{pink_bright}"
set-face global builtin "%opt{red_base}"
# Tree-sitter (<https://github.com/hadronized/kak-tree-sitter>)
set-face global ts_attribute "%opt{yellow_base}"
set-face global ts_comment "%opt{comment}"
set-face global ts_comment_unused "%opt{comment}"
set-face global ts_conceal "%opt{magenta_dim}"
set-face global ts_constant "%opt{orange_bright}"
set-face global ts_constant_builtin_boolean "%opt{orange_bright}"
set-face global ts_constant_character "%opt{green_base}"
set-face global ts_constant_macro "%opt{orange_bright}"
set-face global ts_constructor "%opt{cyan_base}"
set-face global ts_diff_plus "%opt{green_base}"
set-face global ts_diff_minus "%opt{red_base}"
set-face global ts_diff_delta "%opt{yellow_base}"
set-face global ts_diff_delta_moved "%opt{blue_base}"
set-face global ts_error "%opt{red_base}"
set-face global ts_function "%opt{blue_bright}"
set-face global ts_function_builtin "%opt{pink_base}"
set-face global ts_function_macro "%opt{pink_bright}"
set-face global ts_function_method_private "%opt{blue_dim}"
set-face global ts_hint "%opt{orange_base}"
set-face global ts_info "%opt{blue_base}"
set-face global ts_keyword "%opt{magenta_base}"
set-face global ts_keyword_conditional "%opt{magenta_bright}"
set-face global ts_keyword_control_conditional "%opt{magenta_bright}"
set-face global ts_keyword_control_directive "%opt{pink_bright}"
set-face global ts_keyword_control_import "%opt{orange_bright}"
set-face global ts_keyword_directive "%opt{pink_bright}"
set-face global ts_keyword_storage "%opt{blue_base}"
set-face global ts_keyword_storage_modifier "%opt{magenta_base}"
set-face global ts_keyword_storage_modifier_mut "%opt{blue_bright}"
set-face global ts_keyword_storage_modifier_ref "%opt{blue_bright}"
set-face global ts_label "%opt{pink_base}+i"
set-face global ts_markup_bold "%opt{red_base}+b"
set-face global ts_markup_heading "%opt{blue_base}"
set-face global ts_markup_heading_1 "%opt{blue_base}"
set-face global ts_markup_heading_2 "%opt{blue_base}"
set-face global ts_markup_heading_3 "%opt{blue_base}"
set-face global ts_markup_heading_4 "%opt{blue_base}"
set-face global ts_markup_heading_5 "%opt{blue_base}"
set-face global ts_markup_heading_6 "%opt{blue_base}"
set-face global ts_markup_heading_marker "%opt{orange_base}+b"
set-face global ts_markup_italic "%opt{pink_base}+i"
set-face global ts_markup_list_checked "%opt{green_base}"
set-face global ts_markup_list_numbered "%opt{fg2}"
set-face global ts_markup_list_unchecked "%opt{cyan_base}"
set-face global ts_markup_list_unnumbered "%opt{fg2}"
set-face global ts_markup_link_label "%opt{blue_base}"
set-face global ts_markup_link_url "%opt{cyan_base}+u"
set-face global ts_markup_link_uri "%opt{cyan_base}+u"
set-face global ts_markup_link_text "%opt{blue_base}"
set-face global ts_markup_quote "%opt{fg2},%opt{bg2}"
set-face global ts_markup_raw "%opt{green_base}"
set-face global ts_markup_strikethrough "%opt{fg1}+s"
set-face global ts_namespace "%opt{cyan_base}"
set-face global ts_operator "%opt{fg2}"
set-face global ts_property "%opt{blue_base}"
set-face global ts_punctuation "%opt{fg2}"
set-face global ts_punctuation_special "%opt{blue_bright}"
set-face global ts_special "%opt{blue_base}"
set-face global ts_spell "%opt{fg1},%opt{bg1},%opt{red_base}+c"
set-face global ts_string "%opt{green_base}"
set-face global ts_string_regex "%opt{yellow_bright}"
set-face global ts_string_regexp "%opt{yellow_bright}"
set-face global ts_string_escape "%opt{cyan_base}"
set-face global ts_string_special "%opt{green_base}"
set-face global ts_string_special_path "%opt{green_base}"
set-face global ts_string_special_symbol "%opt{green_base}"
set-face global ts_string_symbol "%opt{green_base}"
set-face global ts_tag "%opt{blue_base}"
set-face global ts_tag_error "%opt{red_base}"
set-face global ts_text "%opt{white_base}"
set-face global ts_text_title "%opt{orange_base}"
set-face global ts_type "%opt{yellow_base}"
set-face global ts_type_enum_variant "%opt{yellow_base}"
set-face global ts_type_enum_variant_builtin "%opt{orange_bright}"
set-face global ts_variable "%opt{white_base}"
set-face global ts_variable_builtin "%opt{red_base}"
set-face global ts_variable_other_member "%opt{cyan_base}"
set-face global ts_variable_other_member_private "%opt{cyan_dim}"
set-face global ts_variable_parameter "%opt{blue_base}"
set-face global ts_warning "%opt{magenta_base}"

View File

@@ -0,0 +1,178 @@
# Carbonfox theme for Kakoune
#
# Taken and adapted from
# <https://github.com/EdenEast/nightfox.nvim/blob/main/lua/nightfox/palette/dawnfox.lua>
# Color palette
declare-option str pink_dim "rgb:c9709e"
declare-option str pink_base "rgb:d685af"
declare-option str pink_bright "rgb:de8db7"
declare-option str bg2 "rgb:ebe0df"
declare-option str fg1 "rgb:575279"
declare-option str bg3 "rgb:ebdfe4"
declare-option str orange_dim "rgb:ca6e69"
declare-option str orange_base "rgb:d7827e"
declare-option str orange_bright "rgb:de8c88"
declare-option str red_dim "rgb:a5576d"
declare-option str red_base "rgb:b4637a"
declare-option str red_bright "rgb:c26d85"
declare-option str green_dim "rgb:597668"
declare-option str green_base "rgb:618774"
declare-option str green_bright "rgb:629f81"
declare-option str cyan_dim "rgb:50848c"
declare-option str cyan_base "rgb:56949f"
declare-option str cyan_bright "rgb:5ca7b4"
declare-option str black_dim "rgb:504c6b"
declare-option str black_base "rgb:575279"
declare-option str black_bright "rgb:5f5695"
declare-option str yellow_dim "rgb:dd9024"
declare-option str yellow_base "rgb:ea9d34"
declare-option str yellow_bright "rgb:eea846"
declare-option str fg3 "rgb:a8a3b3"
declare-option str sel1 "rgb:b8cece"
declare-option str comment "rgb:9893a5"
declare-option str blue_dim "rgb:295e73"
declare-option str blue_base "rgb:286983"
declare-option str blue_bright "rgb:2d81a3"
declare-option str sel0 "rgb:d0d8d8"
declare-option str fg2 "rgb:625c87"
declare-option str bg1 "rgb:faf4ed"
declare-option str fg0 "rgb:4c4769"
declare-option str bg4 "rgb:bdbfc9"
declare-option str bg0 "rgb:ebe5df"
declare-option str white_dim "rgb:c8cfde"
declare-option str white_base "rgb:e5e9f0"
declare-option str white_bright "rgb:e6ebf3"
declare-option str magenta_dim "rgb:816b9a"
declare-option str magenta_base "rgb:907aa9"
declare-option str magenta_bright "rgb:9a80b9"
# Markup
set-face global title "%opt{yellow_base}"
set-face global header "%opt{red_dim}+b"
set-face global bold "%opt{fg1}+b"
set-face global italic "%opt{fg1}+i"
# Builtins
set-face global Default "%opt{fg1},%opt{bg1}"
set-face global PrimarySelection "%opt{fg2},%opt{sel0}"
set-face global SecondarySelection "%opt{fg3},%opt{sel1}"
set-face global PrimaryCursor "%opt{bg1},%opt{fg1}"
set-face global SecondaryCursor "%opt{bg1},%opt{fg2}"
set-face global PrimaryCursorEol "%opt{bg2},%opt{blue_bright}"
set-face global SecondaryCursorEol "%opt{bg3},%opt{blue_dim}"
set-face global LineNumbers "%opt{fg3},%opt{bg1}"
set-face global LineNumberCursor "%opt{fg2},%opt{bg1}"
set-face global LineNumbersWrapped "%opt{fg3},%opt{bg1}+i"
set-face global MenuForeground "%opt{fg1},%opt{sel1}"
set-face global MenuBackground "%opt{fg1},%opt{sel0}"
set-face global MenuInfo "%opt{fg1},%opt{bg0}"
set-face global Information "%opt{fg1},%opt{bg0}"
set-face global Error "%opt{red_base},%opt{bg0}"
set-face global StatusLine "%opt{fg2},%opt{bg0}"
set-face global StatusLineMode "%opt{green_bright},%opt{bg0}"
set-face global StatusLineInfo "%opt{blue_bright},%opt{bg0}"
set-face global StatusLineValue "%opt{orange_base},%opt{bg0}"
set-face global StatusCursor "%opt{bg0},%opt{fg2}"
set-face global Prompt "%opt{blue_bright},%opt{bg0}"
set-face global MatchingChar "%opt{fg1},%opt{sel1}"
set-face global Whitespace "%opt{fg3},%opt{bg1}"
set-face global WrapMarker Whitespace
set-face global BufferPadding "%opt{blue_dim},%opt{bg1}"
# Code
set-face global value "%opt{orange_dim}"
set-face global type "%opt{yellow_base}"
set-face global variable "%opt{black_base}"
set-face global module "%opt{blue_base}"
set-face global function "%opt{blue_dim}"
set-face global string "%opt{green_base}"
set-face global keyword "%opt{magenta_base}"
set-face global operator "%opt{fg2}"
set-face global attribute "%opt{blue_base}"
set-face global comment "%opt{comment}"
set-face global documentation comment
set-face global meta "%opt{pink_dim}"
set-face global builtin "%opt{red_base}"
# Tree-sitter (<https://github.com/hadronized/kak-tree-sitter>)
set-face global ts_attribute "%opt{yellow_base}"
set-face global ts_comment "%opt{comment}"
set-face global ts_comment_unused "%opt{comment}"
set-face global ts_conceal "%opt{magenta_dim}"
set-face global ts_constant "%opt{orange_dim}"
set-face global ts_constant_builtin_boolean "%opt{orange_dim}"
set-face global ts_constant_character "%opt{green_base}"
set-face global ts_constant_macro "%opt{orange_dim}"
set-face global ts_constructor "%opt{cyan_base}"
set-face global ts_diff_plus "%opt{green_base}"
set-face global ts_diff_minus "%opt{red_base}"
set-face global ts_diff_delta "%opt{yellow_base}"
set-face global ts_diff_delta_moved "%opt{blue_base}"
set-face global ts_error "%opt{red_base}"
set-face global ts_function "%opt{blue_dim}"
set-face global ts_function_builtin "%opt{pink_base}"
set-face global ts_function_macro "%opt{pink_dim}"
set-face global ts_function_method_private "%opt{blue_dim}"
set-face global ts_hint "%opt{green_base}"
set-face global ts_info "%opt{blue_base}"
set-face global ts_keyword "%opt{magenta_base}"
set-face global ts_keyword_conditional "%opt{magenta_dim}"
set-face global ts_keyword_control_conditional "%opt{magenta_dim}"
set-face global ts_keyword_control_directive "%opt{pink_dim}"
set-face global ts_keyword_control_import "%opt{orange_dim}"
set-face global ts_keyword_directive "%opt{pink_dim}"
set-face global ts_keyword_storage "%opt{blue_base}"
set-face global ts_keyword_storage_modifier "%opt{magenta_base}"
set-face global ts_keyword_storage_modifier_mut "%opt{blue_dim}"
set-face global ts_keyword_storage_modifier_ref "%opt{blue_dim}"
set-face global ts_label "%opt{pink_base}+i"
set-face global ts_markup_bold "%opt{red_base}+b"
set-face global ts_markup_heading "%opt{blue_base}"
set-face global ts_markup_heading_1 "%opt{blue_base}+b"
set-face global ts_markup_heading_2 "%opt{blue_base}+b"
set-face global ts_markup_heading_3 "%opt{blue_base}+b"
set-face global ts_markup_heading_4 "%opt{blue_base}+b"
set-face global ts_markup_heading_5 "%opt{blue_base}+b"
set-face global ts_markup_heading_6 "%opt{blue_base}+b"
set-face global ts_markup_heading_marker "%opt{orange_base}+b"
set-face global ts_markup_italic "%opt{pink_base}+i"
set-face global ts_markup_list_checked "%opt{green_base}"
set-face global ts_markup_list_numbered "%opt{fg2}"
set-face global ts_markup_list_unchecked "%opt{cyan_base}"
set-face global ts_markup_list_unnumbered "%opt{fg2}"
set-face global ts_markup_link_label "%opt{blue_base}"
set-face global ts_markup_link_url "%opt{cyan_base}+u"
set-face global ts_markup_link_uri "%opt{cyan_base}+u"
set-face global ts_markup_link_text "%opt{blue_base}"
set-face global ts_markup_quote "%opt{fg2},%opt{bg2}"
set-face global ts_markup_raw "%opt{green_base}"
set-face global ts_markup_strikethrough "%opt{fg1}+s"
set-face global ts_namespace "%opt{cyan_base}"
set-face global ts_operator "%opt{fg2}"
set-face global ts_property "%opt{blue_base}"
set-face global ts_punctuation "%opt{fg2}"
set-face global ts_punctuation_special "%opt{blue_dim}"
set-face global ts_special "%opt{blue_base}"
set-face global ts_spell "%opt{fg1},%opt{bg1},%opt{red_base}+c"
set-face global ts_string "%opt{green_base}"
set-face global ts_string_regex "%opt{yellow_dim}"
set-face global ts_string_regexp "%opt{yellow_dim}"
set-face global ts_string_escape "%opt{cyan_base}"
set-face global ts_string_special "%opt{green_base}"
set-face global ts_string_special_path "%opt{green_base}"
set-face global ts_string_special_symbol "%opt{green_base}"
set-face global ts_string_symbol "%opt{green_base}"
set-face global ts_tag "%opt{blue_base}"
set-face global ts_tag_error "%opt{red_base}"
set-face global ts_text "%opt{black_base}"
set-face global ts_text_title "%opt{orange_base}"
set-face global ts_type "%opt{yellow_base}"
set-face global ts_type_enum_variant "%opt{yellow_base}"
set-face global ts_type_enum_variant_builtin "%opt{orange_dim}"
set-face global ts_variable "%opt{black_base}"
set-face global ts_variable_builtin "%opt{red_base}"
set-face global ts_variable_other_member "%opt{cyan_base}"
set-face global ts_variable_other_member_private "%opt{cyan_dim}"
set-face global ts_variable_parameter "%opt{blue_base}"
set-face global ts_warning "%opt{yellow_base}"

View File

@@ -49,11 +49,11 @@ plug "https://git.sr.ht/~hadronized/kakoune-tree-sitter-themes" theme
set-option global luar_interpreter luajit
## Treesitter ##
# eval %sh{ kak-tree-sitter -dksvvv --with-highlighting --with-text-objects --init $kak_session }
eval %sh{ kak-tree-sitter -dksvvv --with-highlighting --with-text-objects --init $kak_session }
#eval %sh{ kak-tree-sitter -dks --with-text-objects --session $kak_session }
#eval %sh{ kak-tree-sitter -dks --with-highlighting --session $kak_session }
#eval %sh{ kak-tree-sitter -dksvvvv --init $kak_session }
#eval %sh{ kak-tree-sitter -dksvvv --init $kak_session }
#
# evaluate-commands %sh{
# echo "colorscheme base16-$BASE16_THEME"
# }
@@ -64,83 +64,87 @@ evaluate-commands %sh{kak-popup init}
## Highlighting ##
hook global WinCreate .* %{ add-highlighter window/number-lines number-lines -relative -hlcursor}
add-highlighter global/ show-matching
add-highlighter global/ column 80 MenuForeground
add-highlighter global/ show-whitespaces
add-highlighter global/ column 80 MenuBackground
add-highlighter global/ show-whitespaces -spc " " -nbsp ""
#add-highlighter global/ show-whitespaces -nbsp "" -lf "" -indent "|"
## Wrapping ##
add-highlighter global/ wrap -word -indent
## Formatting ##
define-command enable-autofmt -docstring 'enable autoformatting of buffer' %{
hook global -group autofmt BufSetOption filetype=(zig) %{
set-option buffer formatcmd 'zig fmt --stdin'
hook -group autofmt buffer BufOpenFile .* %{
format
}
hook -group autofmt buffer BufWritePre .* %{
format
}
}
hook global -group autofmt BufSetOption filetype=(html) %{
set-option buffer formatcmd 'prettier --tab-width 4 --parser html'
hook -group autofmt buffer BufOpenFile .* %{
format
}
hook -group autofmt buffer BufWritePre .* %{
format
}
}
hook global -group autofmt BufSetOption filetype=(css) %{
set-option buffer formatcmd 'prettier --tab-width 4 --parser css'
hook -group autofmt buffer BufOpenFile .* %{
format
}
hook -group autofmt buffer BufWritePre .* %{
format
}
}
hook global -group autofmt BufSetOption filetype=(javascript) %{
set-option buffer formatcmd 'prettier --tab-width 4 --parser typescript'
hook -group autofmt buffer BufOpenFile .* %{
format
}
hook -group autofmt buffer BufWritePre .* %{
format
}
}
hook global -group autofmt BufSetOption filetype=(go) %{
set-option buffer formatcmd 'gofmt'
hook -group autofmt buffer BufOpenFile .* %{
format
}
hook -group autofmt buffer BufWritePre .* %{
format
}
}
}
define-command disable-autofmt -docstring 'disable autoformatting of buffer' %{
remove-hooks global autofmt
}
enable-autofmt
# define-command enable-autofmt -docstring 'enable autoformatting of buffer' %{
#
#
# hook global -group autofmt BufSetOption filetype=(zig) %{
# set-option buffer formatcmd 'zig fmt --stdin'
#
# hook -group autofmt buffer BufOpenFile .* %{
# format
# }
#
# hook -group autofmt buffer BufWritePre .* %{
# format
# }
# }
#
# hook global -group autofmt BufSetOption filetype=(html) %{
# set-option buffer formatcmd 'prettier --tab-width 4 --parser html'
#
# hook -group autofmt buffer BufOpenFile .* %{
# format
# }
#
# hook -group autofmt buffer BufWritePre .* %{
# format
# }
# }
#
# hook global -group autofmt BufSetOption filetype=(css) %{
# set-option buffer formatcmd 'prettier --tab-width 4 --parser css'
#
# hook -group autofmt buffer BufOpenFile .* %{
# format
# }
#
# hook -group autofmt buffer BufWritePre .* %{
# format
# }
# }
# hook global -group autofmt BufSetOption filetype=(javascript) %{
# set-option buffer formatcmd 'prettier --tab-width 4 --parser typescript'
#
# hook -group autofmt buffer BufOpenFile .* %{
# format
# }
#
# hook -group autofmt buffer BufWritePre .* %{
# format
# }
# }
#
# hook global -group autofmt BufSetOption filetype=(go) %{
# set-option buffer formatcmd 'gofmt'
#
# hook -group autofmt buffer BufOpenFile .* %{
# format
# }
#
# hook -group autofmt buffer BufWritePre .* %{
# format
# }
# }
# }
#
# define-command disable-autofmt -docstring 'disable autoformatting of buffer' %{
# remove-hooks global autofmt
# }
#
# enable-autofmt
#
#
#
## Indentation ##
set global tabstop 4
set global indentwidth 4
@@ -151,6 +155,26 @@ hook global BufCreate .* %{
autoconfigtab
}
define-command set-spell -docstring 'Enable spellcheck' %{
# hook -group spellcheck global BufOpenFile .* %{
hook -group spellcheck buffer InsertChar .* %{
evaluate-commands %{
spell
}
}
hook -group spellcheck buffer InsertDelete .* %{
evaluate-commands %{
spell
}
}
# }
}
define-command set-nospell -docstring 'Disable spellcheck' %{
remove-hooks buffer spellcheck
}
define-command sleuth -docstring 'Heuristically set buffer options' %{
try %{
evaluate-commands -draft %{
@@ -201,29 +225,16 @@ define-command sleuth-disable -docstring 'Disable sleuth' %{
}
## LSP ##
# lsp-enable
# lsp-inlay-diagnostics-enable global
hook global WinSetOption filetype=(c|zig|python|ruby|lua|java|html|css|swift) %{
# set-option window lsp_auto_highlight_references true
set-option window lsp_hover_anchor true
lsp-auto-hover-enable
#lsp-auto-hover-insert-mode-enable
lsp-auto-signature-help-enable
lsp-inlay-hints-enable global
lsp-enable-window
}
lsp-enable
lsp-inlay-diagnostics-enable global
set-option global lsp_auto_highlight_references true
set-option global lsp_hover_anchor true
lsp-auto-signature-help-enable
lsp-inlay-hints-enable global
hook global WinSetOption filetype=(rust) %{
set-option window lsp_auto_highlight_references true
set-option window lsp_hover_anchor true
lsp-auto-hover-enable
#lsp-auto-hover-insert-mode-enable
lsp-auto-signature-help-enable
lsp-inlay-hints-enable global
lsp-enable-window
}
map global user k ':lsp-hover'
hook global WinSetOption filetype=(c|zig|rust|python|ruby|lua|java|html|css) %{
hook global WinSetOption filetype=(c|cpp|zig|rust|python|ruby|lua|java|html|css) %{
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
@@ -253,6 +264,19 @@ hook -group lsp-filetype-swift global BufSetOption filetype=swift %{
}
}
hook -group lsp-filetype-typst global BufSetOption filetype=typst %{
set-option buffer lsp_servers %{
[tinymist]
root_globs = [".git", ".hg"]
args = ["lsp"]
settings_section = "_"
[tinymist.settings._]
# See https://myriad-dreamin.github.io/tinymist/configurations.html
exportPdf = "onType"
# formatterMode = "typstyle"
# previewFeature = "disable"
}
}
set-option global lsp_config %{
}
@@ -493,4 +517,4 @@ map -docstring 'next spell check' global spell n ':spell-next<ret>'
map -docstring 'spell check replacements' global spell r ':spell-replace<ret>'
map -docstring 'quit kakoune' global user q ':q!<ret>'
colorscheme base16-rose-pine
colorscheme carbonfox