source %sh{
echo ${kak_config}/languagecmd.kak # borrowed from https://git.sr.ht/~nasmevka
}
-hook global WinSetOption filetype=js %{
- set window formatcmd 'npx prettier --stdin-filepath $kak_buffile<ret><space>;'
-}
-hook global WinSetOption filetype=css %{
- set-option window lintcmd "npx stylelint --formatter unix --stdin-filename='%val{buffile}'"
+
+# Enable some code formaters
+# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+hook global BufSetOption filetype=(js|javascript) %{
+ set-option buffer formatcmd "prettier --stdin-filepath=%val{buffile}"
}
hook global WinSetOption filetype=scss %{
set window formatcmd 'npx prettier --parser scss --stdin-filepath $kak_buffile<ret><space>;'
hook global WinSetOption filetype=html %{
set window formatcmd 'npx prettier --parser html --stdin-filepath $kak_buffile<ret><space>;'
}
-hook global WinSetOption filetype=(json|jsonc) %{
- set-option window lintcmd %{ run() { cat -- "$1" | jq 2>&1 | awk -v filename="$1" '/ at line [0-9]+, column [0-9]+$/ { line=$(NF - 2); column=$NF; sub(/ at line [0-9]+, column [0-9]+$/, ""); printf "%s:%d:%d: error: %s", filename, line, column, $0; }'; } && run }
-}
hook global WinSetOption filetype=md %{
set window formatcmd 'npx prettier --parser md --stdin-filepath $kak_buffile<ret><space>;'
}
hook global WinSetOption filetype=sh %{
# needs shfmt: $ go install mvdan.cc/sh/v3/cmd/shfmt@latest
set-option buffer formatcmd "shfmt -i 4 -ci -sr -"
- set-option window lintcmd "shellcheck -fgcc -Cnever"
}
hook global WinSetOption filetype=yaml %{
set window formatcmd 'npx prettier --parser yaml --stdin-filepath $kak_buffile<ret><space>;'
+}
+
+# Enable some code linters
+# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+hook global WinSetOption filetype=c %{
+ set-option window lintcmd "cppcheck --language=c --enable=warning,style,information --template='{file}:{line}:{column}: {severity}: {message}' --suppress='*:*.h' 2>&1"
+}
+hook global WinSetOption filetype=css %{
+ set-option window lintcmd "npx stylelint --formatter unix --stdin-filename='%val{buffile}'"
+}
+hook global WinSetOption filetype=(json|jsonc) %{
+ set-option window lintcmd %{ run() { cat -- "$1" | jq 2>&1 | awk -v filename="$1" '/ at line [0-9]+, column [0-9]+$/ { line=$(NF - 2); column=$NF; sub(/ at line [0-9]+, column [0-9]+$/, ""); printf "%s:%d:%d: error: %s", filename, line, column, $0; }'; } && run }
+}
+hook global WinSetOption filetype=sh %{
+ # needs shfmt: $ go install mvdan.cc/sh/v3/cmd/shfmt@latest
+ set-option window lintcmd "shellcheck -fgcc -Cnever"
+}
+hook global WinSetOption filetype=yaml %{
set-option window lintcmd %{
run() {
# change [message-type] to message-type:
# Look and Feel
# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
# dabruin colorscheme config
-# declare-option str dabruin_background 'rgb:191724' # rose-pine-background-hard
-declare-option str dabruin_background 'rgb:221f34' # rose-pine-background-medium
+declare-option str dabruin_background 'rgb:191724' # rose-pine-background-hard
+# declare-option str dabruin_background 'rgb:221f34' # rose-pine-background-medium
# declare-option str dabruin_background 'rgb:26233a' # rose-pine-background-soft
declare-option str dabruin_accent 'rgb:f6c177' # rose-pine-yellow
# declare-option str dabruin_accent 'rgb:a7c080' # green
# ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
# Shades of green/yellow for insert mode.
hook global ModeChange (push|pop):.*:insert %{
- set-face window StatusLine black,rgb:a1163d
+ set-face window StatusLine black,rgb:eb6f92
}
# Undo colour changes when we leave insert mode.
add_newline = false
format = """\
+[░▒▓](fg:bright-black)${custom.kakbuflist}[▓▒░](fg:bright-black bg:black)\
+[░▒▓](fg:blue bg:black)\
${custom.kaklsp_progress}\
${custom.kakcursor}\
${custom.kakposition}\
-${custom.kakmode}\
-${custom.kakcontext}\
-${custom.kakfiletype}\
-${custom.kakbuflist}\
+[](fg:blue bg:green)\
${directory}\
${custom.kakfile}\
${custom.kaklsp_err}\
${custom.kaklsp_warn}\
${custom.kaklsp_hint}\
${custom.kaklsp_code_actions}\
-${package}\
+[](fg:green bg:black)\
${git_branch}\
-${git_commit}\
${git_state}\
${git_status}\
+[](fg:#26233a bg:cyan)\
${custom.kaksession}\
+[](fg:cyan bg:purple)\
+${custom.kakfiletype}\
+[](fg:purple bg:default)\
+${custom.kakmode}\
+${custom.kakcontext}\
${custom.kaktime}
"""
disabled = true
[git_branch]
-format = '[ $branch]($style)'
-style = 'fg:bright-blue italic'
-truncation_length = 10
-truncation_symbol = '…'
-only_attached = false
-always_show_remote = true
-disabled = false
+symbol = ""
+style = "bg:#26233a"
+format = '[[ $symbol $branch ](fg:purple bg:#26233a)]($style)'
-[git_commit]
-format = '[\($hash$tag\)]($style)'
-style = 'fg:blue dimmed'
-commit_hash_length = 6
-only_detached = false
-tag_symbol = ' 笠'
-tag_disabled = false
-disabled = false
+[git_status]
+style = "bg:#26233a"
+format = '[[($all_status$ahead_behind )](fg:purple bg:#26233a)]($style)'
+ahead = '⇡${count}'
+diverged = '⇕⇡${ahead_count}⇣${behind_count}'
+behind = '⇣${count}'
[git_state]
format = '\( [$state($progress_current/$progress_total)]($style)\)'
-style = 'fg:blue dimmed'
+style = "bg:#26233a fg:white dimmed"
rebase = 'REBASING'
merge = 'MERGING'
revert = 'REVERTING'
am_or_rebase = 'AM/REBASE'
disabled = false
-[git_status]
-format = '[\[$all_status$ahead_behind\]]($style)[]($style)'
-style = 'fg:cyan dimmed bold'
-stashed = '\$'
-ahead = '⇡${count}'
-behind = '⇣${count}'
-diverged = '⇕⇡${ahead_count}⇣${behind_count}'
-conflicted = '='
-deleted = '✘'
-renamed = '»'
-modified = '!'
-staged = '+'
-untracked = '?'
-disabled = false
-
[directory]
-format = '[]($style)[$read_only]($read_only_style)[$path]($style)'
+format = '[ $read_only]($style)[$path]($style)'
truncation_length = 8
truncate_to_repo = true
fish_style_pwd_dir_length = 0
use_logical_path = true
-style = 'bg:blue fg:black'
-read_only_style = 'bg:blue fg:200'
+style = 'bg:green fg:white'
+read_only_style = 'bg:green fg:red'
read_only = '[]'
truncation_symbol = '…'
disabled = false
"~/scm" = " "
"~" = " "
-[package]
-format = '[ $version]($style)[ ]($style)'
-style = 'cyan'
-display_private = true
-disabled = false
-
-[battery]
-format = "[ $symbol$percentage]($style) "
-charging_symbol = ' '
-discharging_symbol = ' '
-disabled = false
-
-[[battery.display]]
-threshold = 10
-style = "red"
-charging_symbol = ' '
-discharging_symbol = ' '
-
-[[battery.display]]
-threshold = 20
-style = "red"
-charging_symbol = ' '
-discharging_symbol = ' '
-
-[[battery.display]]
-threshold = 30
-style = "yellow"
-charging_symbol = ' '
-discharging_symbol = ' '
-
-[[battery.display]]
-threshold = 40
-style = "yellow"
-charging_symbol = ' '
-discharging_symbol = ' '
-
-[[battery.display]]
-threshold = 50
-style = "blue"
-charging_symbol = ' '
-discharging_symbol = ' '
-
-[[battery.display]]
-threshold = 60
-style = "blue"
-charging_symbol = ' '
-discharging_symbol = ' '
-
-[[battery.display]]
-threshold = 70
-style = "blue"
-charging_symbol = ' '
-discharging_symbol = ' '
-
-[[battery.display]]
-threshold = 80
-style = "green"
-charging_symbol = ' '
-discharging_symbol = ' '
-
-[[battery.display]]
-threshold = 90
-style = "green"
-charging_symbol = ' '
-discharging_symbol = ' '
-
-[[battery.display]]
-threshold = 100
-style = "green"
-charging_symbol = ' '
-discharging_symbol = ' '
-
-[memory_usage]
-format = "[ ${ram}]($style)"
-style = "fg:bright-cyan"
-threshold = -1
-disabled = true
-
[custom.kakfile]
description = 'The current Kakoune buffername'
-format = '[/$output ]($style)[]($style inverted)'
-style = 'bold bg:blue fg:black'
+format = '[/$output ]($style)'
+style = 'bg:green fg:white'
command = 'echo -n ${kak_buffile##*/}'
when = 'true'
shell = ['sh']
[custom.kaksession]
description = 'The current Kakoune session'
-format = '[]($style)[ %val{client}:%val{session} ]($style)[]($style inverted)'
-style = 'bg:yellow fg:black'
+format = '[ %val{client}:%val{session} ]($style)'
+style = 'bg:cyan fg:black'
when = ''
shell = ['true']
disabled = false
[custom.kakcursor]
description = 'The current Kakoune cursor position'
format = '[%val{cursor_line}:%val{cursor_char_column}]($style)'
-style = 'fg:white'
+style = 'fg:black bg:blue'
when = ''
shell = ['true']
disabled = false
+[custom.kakposition]
+description = 'Relative position of the cursor inside the buffer'
+format = '[ $output ]($style)'
+style = 'bold fg:black bg:blue'
+command = 'echo -n $(($kak_cursor_line * 100 / $kak_buf_line_count))%'
+when = '[ -n "$kak_cursor_line" ]'
+shell = ['sh']
+disabled = false
+
[custom.kakmode]
description = 'The current Kakoune mode'
format = ' {{mode_info}}'
[custom.kakcontext]
description = 'The current Kakoune context'
-format = ' {{context_info}} '
+format = '{{context_info}} '
when = ''
shell = ['true']
disabled = false
[custom.kakfiletype]
description = 'The current buffer filetype'
-format = '[%opt{filetype}]($style) '
-style = 'fg:13'
+format = '[ %opt{filetype} ]($style)'
+style = 'fg:black bg:purple'
when = ''
shell = ['true']
disabled = false
-[custom.kakposition]
-description = 'Relative position of the cursor inside the buffer'
-format = '[ $output]($style) '
-style = 'bright-white'
-command = 'echo -n $(($kak_cursor_line * 100 / $kak_buf_line_count))%'
-when = '[ -n "$kak_cursor_line" ]'
-shell = ['sh']
-disabled = false
-
[custom.kaktime]
description = "Alternate time segment using kakoune evaluation"
format = "[]($style)[ %sh{date +%H:%M} ]($style)"
style = "fg:black bg:bright-green"
when = ''
shell = ['true']
-disabled = false
+disabled = true
[custom.kaklsp_err]
description = "Show errors number from kak-lsp if any"
[custom.kakbuflist]
description = "Open buffers"
-format = '[]($style inverted)[$output]($style)[]($style inverted)'
-style = 'bg:8 fg:0'
+format = '[$output]($style)'
+style = 'bg:bright-black fg:white'
when = 'true'
shell = ['sh']
command = 'kks get -s ${kak_session##*/} %val{buflist} | grep -vE "(\*scratch\*|\*debug\*|${kak_buffile##*/})" | rev | cut -d"/" -f1 | rev | paste -s -d "|" '