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/'
@ -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
@ -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
@ -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