chore: update kakrc for better integration with my guix setup

pull/1/head
anemofilia 2023-09-24 22:13:23 -03:00
parent 8f1a036c72
commit d06288ad8e
No known key found for this signature in database
GPG Key ID: 5A8F3D62C87A2B33
1 changed files with 32 additions and 92 deletions

View File

@ -12,8 +12,8 @@ set-option global scrolloff 2,2
set-option -add global ui_options terminal_assistant=cat
hook global ModuleLoaded x11 %{
set-option global termcmd 'st -e dash -c '
} # Set st as default terminal
set-option global termcmd "%sh{echo $TERM} -c dash -e"
} # Set termcmd
# __________ Commands __________
define-command -override lf-open \
@ -57,29 +57,19 @@ define-command -override colorscheme-config \
define-command -override config \
-docstring 'edit kakoune main configuration file' %{
edit "%val{config}/kakrc"
edit "~/area/code/scm/radix/files/kak/kakrc"
}
define-command -override rss \
-docstring 'edit rss feeds file' %{
edit '~/.config/newsraft/feeds'
edit '~/area/code/scm/radix/files/newsraft/feeds'
}
define-command -override latin \
-docstring 'edit latin-portuguese dictionary' %{
edit '~/Projects/markdown/latim-portugues.md'
}
define-command -override remind \
-docstring 'Edit reminders' %{
execute-keys ': e /home/radio/.local/share/reminders/'
}
define-command -override parse-latin \
-docstring 'Parse latin text, replacing ^ for short and ~ for long' %{
execute-keys '|sed y/ãẽĩõũ/āēīōū/<ret>'
execute-keys '|sed y/âêîôû/ăěĭŏŭ/<ret>'
}
define-command -params 1 -override tex-project \
-docstring 'edit or create a new tex-project' %{
evaluate-commands 'cd ~/Projects/latex/'
@ -105,7 +95,7 @@ define-command -override toggle-readonly \
define-command -override qalc \
-params .. %{echo %sh{qalc ${@}}} \
-docstring 'compute equation with Qalculate!'
-docstring 'compute equation with Qalculate!'
complete-command qalc shell-script-candidates %{
{ echo $(qalc --list-functions | head -n -3)
echo $(qalc --list-variables | head -n -3) } | tr ' ' '\n' | sort | uniq
@ -135,7 +125,7 @@ define-command -override -hidden edit-from-file %{
define-command -override -hidden spawn-terminal-from-file %{
set-register b "%sh{pwd}"
change-directory "%sh{dirname $kak_buffile}"
evaluate-commands 'terminal dash'
evaluate-commands "terminal %sh{echo $SHELL} -c"
change-directory "%reg{b}"
} # Spawn a terminal in the current buffer's file directory
@ -161,7 +151,7 @@ map global user <a-c> ': comment-block<ret>' \
map global user D '| date +"%d %b %Y %a" -f -<ret>' \
-docstring 'parse date to 01 Feb 2001 Tue format'
map global user d ': lf-open<ret>' \
-docstring 'pick a file with lf'
@ -186,7 +176,7 @@ map global user u ': echo -markup "{Information}U+%sh{printf ''%04x'' ""$kak_cur
map global user q ': delete-buffer<ret>' \
-docstring 'delete current buffer'
map global user Q ': delete-buffer!<ret>' \
-docstring 'delete current buffer'
@ -213,28 +203,6 @@ map global git s ': git status<ret>' -docstring 'status'
map global git h ': git show-diff<ret>' -docstring 'show diff'
map global git H ': git-hide-diff<ret>' -docstring 'hide diff'
# try %{ declare-user-mode gdb }
# map global gdb <ret> ': gdb-session-new-defaults<ret>' -docstring 'new session'
# map global gdb <backspace> ': gdb-session-stop<ret>' -docstring 'stop session'
# map global gdb r ': gdb-run<ret>' -docstring 'run'
# map global gdb R ': gdb-cmd start<ret>' -docstring 'start'
# map global gdb k ': gdb-cmd kill<ret>' -docstring 'kill'
# map global gdb s ': gdb-step<ret>' -docstring 'step'
# map global gdb n ': gdb-next<ret>' -docstring 'next line'
# map global gdb f ': gdb-finish<ret>' -docstring 'finish'
# map global gdb c ': gdb-continue<ret>' -docstring 'continue' # swap with C?
# map global gdb C ': gdb-continue-or-run<ret>' -docstring 'continue/run'
# map global gdb j ': gdb-jump-to-location<ret>' -docstring 'jump to IP'
# map global gdb J ': gdb-toggle-autojump<ret>' -docstring 'toggle autojump'
# map global gdb b ': gdb-toggle-breakpoint<ret>' -docstring 'toggle breakpoint'
# map global gdb p ': gdb-print<ret>' -docstring 'print selection expression'
# map global gdb t ': gdb-backtrace<ret>' -docstring 'backtrace'
# map global gdb <up> ': gdb-backtrace-up<ret>' -docstring 'backtrace ↑'
# map global gdb <down> ': gdb-backtrace-down<ret>' -docstring 'backtrace ↓'
# map global gdb : ':gdb-cmd ' -docstring 'custom command' # ?
# map global gdb <space> ': gdb-to-cursor<ret>' -docstring 'to cursor'
# map global gdb m ': gdb-cmd kill; make<ret>' -docstring 'kill and make' # ?
# __________ Hooks __________
hook -group config global BufCreate 'kakrc' %{
set-option buffer filetype kak
@ -270,12 +238,12 @@ hook global BufOpenFile "%val{config}/autoload/colorscheme.kak" %{
} # Display faces in the colorscheme file
hook global BufOpenFile .* %{
add-highlighter buffer/ wrap -indent -word -marker '↩'
add-highlighter buffer/ wrap -indent -word -marker '↩'
add-highlighter buffer/ show-whitespaces -tab '→'
} # Set highlighters for file buffers
hook global BufCreate '\*scratch\*' %{
add-highlighter buffer/ wrap -indent -word -marker '↩'
add-highlighter buffer/ wrap -indent -word -marker '↩'
add-highlighter buffer/ show-whitespaces -tab '→'
} # Set highlighters for scratch buffers
@ -314,6 +282,13 @@ hook -group config global BufSetOption filetype=clojure %{
evaluate-commands 'rainbow-enable'
} # Clojure comment tokens
hook -group config global BufSetOption filetype=scheme %{
set-option buffer indentwidth 2
set-option window formatcmd 'guix style --whole-file'
set-option buffer line_comment_t ';;'
set-option buffer block_comment_tokens '#|' '|#'
} # Scheme comment tokens
hook -group config global BufSetOption filetype=(c|cpp) %{
set-option window formatcmd 'clazy'
set-option buffer line_comment_token '//'
@ -341,39 +316,23 @@ hook -group config global BufSetOption filetype=zig %{
set-option buffer line_comment_token '//'
} # Zig comment tokens
#hook global BufWritePre "/home/radio/Projects/Markdown/latim-portugues.md" %{
# execute-keys '"aZ' # Save registers
# execute-keys '%s`[a-zA-ZâêîôûãẽĩõũÂÊÎÔÛÃẼĨÕŨ]+`<ret>' # Select latin text
# evaluate-commands 'parse-latin' # Mark properly longs and shorts
# execute-keys '"az' # Restore registers
# evaluate-commands 'echo'
#} # Use proper signaling for longs and shorts in latin
hook global BufOpenFile "/home/radio/Projects/markdown/latim-portugues.md" %{
hook buffer InsertKey '<ret>' %{
execute-keys '<esc>"bZ' # Save registers
execute-keys 'kx' # Select entered line
execute-keys 's`[a-zA-Z ,âêîôûãẽĩõũÂÊÎÔÛÃẼĨÕŨ]+`<ret>' # Select latin text
evaluate-commands 'parse-latin' # Mark properly longs and shorts
execute-keys '|par<ret>' # Format line properly
execute-keys '"bzi' # Restore registers and return to insert mode
evaluate-commands 'echo'
}
}
hook global WinSetOption filetype=kak %{
hook global NormalIdle .* %{
evaluate-commands -save-regs 'a' %{ try %{
execute-keys -draft <a-i>w"ay
evaluate-commands %sh{ (
color="${kak_reg_a}"
inverted_color=$(echo "${color}" | perl -pe 'tr/0123456789abcdefABCDEF/fedcba9876543210543210/')
printf "%s\n" "evaluate-commands -client $kak_client %{ try %{
echo -markup %{{rgb:${inverted_color},rgb:${color}+b} #${color} }
}}" | kak -p $kak_session
) >/dev/null 2>&1 </dev/null & }
}}
}}
evaluate-commands -save-regs 'a' %{
try %{
execute-keys -draft <a-i>w"ay
evaluate-commands %sh{ (
color="${kak_reg_a}"
inverted_color=$(echo "${color}" | perl -pe 'tr/0123456789abcdefABCDEF/fedcba9876543210543210/')
printf "%s\n" "evaluate-commands -client $kak_client %{ try %{
echo -markup %{{rgb:${inverted_color},rgb:${color}+b} #${color} }
}}" | kak -p $kak_session
) >/dev/null 2>&1 </dev/null &
}
}
}
}
}
# __________ Plugins __________
source "%val{config}/plugins/plug.kak/rc/plug.kak"
@ -452,25 +411,6 @@ plug "kak-lsp/kak-lsp" do %{
cp -n kak-lsp.toml ~/.config/kak-lsp/
} # Language server protocol
#plug 'delapouite/kakoune-text-objects' %{
# map global selectors 's' ': if-cursor s s<ret>'
# -docstring 'auto-percent s'
# map global selectors 'p' ': if-cursor S S<ret>'
# -docstring 'auto-percent S'
# map global selectors '<ret>' ': if-cursor <lt>a-s> <lt>a-s> no-hooks<ret>'
# -docstring 'auto-percent <a-s>'
# map global selectors 'm' ': if-cursor <lt>a-S> <lt>a-S> no-hooks<ret>'
# -docstring 'auto-percent <a-S>'
# map global selectors 'f' ': if-cursor <lt>a-s><lt>a-k> <lt>a-k><ret>'
# -docstring 'auto-percent <a-k>'
# map global selectors 'r' ': if-cursor <lt>a-s><lt>a-K> <lt>a-K><ret>'
# -docstring 'auto-percent <a-K>'
# map global selectors 'v' ': select-view<ret>'
# -docstring 'select view'
# map global normal s ': enter-user-mode selectors<ret>'
# -docstring 'selectors'
#} # Add text objects to kakoune
# __________ LSP __________
hook global BufSetOption filetype=(c|clojure|cpp|crystal|css|haskell|html|js|json|lua|python|scheme|sh|sql|latex|zig) %{
add-highlighter buffer/ column 80 StatusLine