]> Freerunner's - dotfiles.git/commitdiff
kak: restyle the statusbar and clean-up config
authorAndre Ramnitz <tux.rising@gmail.com>
Tue, 10 Sep 2024 19:57:48 +0000 (21:57 +0200)
committerAndre Ramnitz <tux.rising@gmail.com>
Sat, 14 Sep 2024 23:08:26 +0000 (01:08 +0200)
config/dot-config/kak/kakrc
config/dot-config/kak/starship.toml

index 22b4d523afa2dbaaf43e3649916d1a17b88aaa0c..79d32c6641827600476fd1be655a487bdfd8d97f 100644 (file)
@@ -87,11 +87,11 @@ bundle-noload dabruin.kak https://git.sr.ht/~nasmevka/dabruin.kak
 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>;'
@@ -102,19 +102,33 @@ hook global WinSetOption filetype=less %{
 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:
@@ -126,8 +140,8 @@ hook global WinSetOption filetype=yaml %{
 # 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
@@ -155,7 +169,7 @@ add-highlighter global/ number-lines -hlcursor -min-digits 3
 # ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 # 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.
index 43a1fbc969e45ecf98dfbaaa7d62574a8b74f01a..263fb2b7a60ea141fd29a5a519528f688b73c89e 100644 (file)
@@ -1,24 +1,28 @@
 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}
 """
 
@@ -30,26 +34,20 @@ time_format = "%H:%M"
 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'
@@ -59,29 +57,14 @@ am = 'AM'
 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
@@ -100,88 +83,10 @@ 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']
@@ -189,8 +94,8 @@ disabled = false
 
 [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
@@ -198,11 +103,20 @@ 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}}'
@@ -212,35 +126,26 @@ disabled = false
 
 [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"
@@ -284,8 +189,8 @@ disabled = false
 
 [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 "|" '