radio: files: kak: Update config

impermanence
Luis Guilherme Coelho 2024-09-02 18:34:45 -03:00
parent 553ca1eb3e
commit bbb8d1a8f7
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
2 changed files with 146 additions and 139 deletions

View File

@ -1,24 +1,23 @@
#________ Options ___________
# Keep status bar in the default place
#________ colorscheme _______
source "%val{config}/colorscheme.kak"
#________ options ___________
# keep status bar in the default place
set-option -add global ui_options terminal_status_on_top=false
# Set an invisible padding char
# set an invisible padding char
set-option -add global ui_options terminal_padding_char=
# Always keep two lines and two columns displayed around the cursor
# always keep two lines and two columns displayed around the cursor
set-option global scrolloff 2,2
# Assistant
# assistant
set-option -add global ui_options terminal_assistant=cat
hook global ModuleLoaded wayland %{
set-option global termcmd "%sh{echo $TERMINAL}"
} # Set termcmd
# __________ Commands __________
# __________ commands __________
define-command -override lf-open \
-docstring 'pick a file with lf' %{
wayland-terminal /bin/sh -c %{
terminal /bin/sh -c %{
# Local variables
kak_buffile=$1 kak_session=$2 kak_client=$3
@ -45,11 +44,6 @@ define-command -override lf-open \
} -- %val{buffile} %val{session} %val{client}
}
define-command -override cron \
-docstring 'edit cron services' %{
execute-keys ': e ~/.config/cron/'
}
define-command -override todo \
-docstring 'edit todo list' %{
edit '~/areas/meta/todo'
@ -134,18 +128,6 @@ define-command -override remind \
execute-keys ': e /home/radio/.local/share/reminders/'
}
define-command -params 1 -override tex-project \
-docstring 'edit or create a new tex-project' %{
evaluate-commands 'cd ~/Projects/latex/'
nop %sh{ mkdir -p "$1" }
evaluate-commands 'cd "%arg{1}"'
nop %sh{
[ -s $1.tex ] || cat ../example/example.tex \
| sed "s/example/$1/" > "$1.tex";
}
edit "%arg{1}.tex"
execute-keys '16gA<esc>'
}
define-command -override open-buffer-picker \
-docstring 'open-buffer-picker: Opens buffer picker.' %{
prompt buffer: -buffer-completion %{ buffer %val{text} }
@ -177,130 +159,154 @@ define-command diff-buffers -override -params 2 \
set-register | 'diff -u $file1 $file2; rm $file1 $file2'
execute-keys !<ret>gg
"
}}
}
}
complete-command diff-buffers buffer
# __________ Hidden commands __________
define-command -override -hidden edit-from-file %{
# __________ hidden commands __________
define-command -override -hidden edit-from-here %{
execute-keys ":edit %sh{dirname $kak_buffile}/"
}
} # edit a file, searching from current file's directory
define-command -override -hidden spawn-terminal-from-file %{
define-command -override -hidden spawn-terminal-here %{
set-register b "%sh{pwd}"
change-directory "%sh{dirname $kak_buffile}"
evaluate-commands "wayland-terminal bin/sh -c"
evaluate-commands "terminal %sh{echo $SHELL}"
change-directory "%reg{b}"
} # Spawn a terminal in the current buffer's file directory
# __________ Mappings __________
map global normal <c-j> ': buffer-previous<ret>'
map global normal Y ': yank-helper<ret>u' \
-docstring 'yank non-selections'
# __________ mappings __________
map global normal D '"ad%d"a<a-P>' \
-docstring 'yank and delete non-selections'
## buffer navigation
try %{ declare-user-mode buffer }
map global normal <esc> ': enter-user-mode buffer<ret>' \
-docstring 'enter buffer user mode'
map global normal <a-D> '"ad%<a-d>"a<a-P>' \
-docstring 'delete non-selections (not yanking)'
map global buffer h ': buffer-previous<ret>' \
-docstring 'move to the previous buffer in the list'
map global user <ret> ': spawn-terminal-from-file<ret>' \
-docstring "open a new terminal within the current file's directory"
map global buffer l ': buffer-next<ret>' \
-docstring 'move to the next buffer in the list'
map global user c ': comment-line<ret>' \
-docstring 'comment-line'
map global buffer q ': delete-buffer<ret>' \
-docstring 'delete current buffer'
map global user <a-c> ': comment-block<ret>' \
-docstring 'comment-block'
map global buffer Q ': delete-buffer!<ret>' \
-docstring 'delete current buffer (force)'
map global user D '| date +"%d %b %Y %a" -f -<ret>' \
-docstring 'parse date to 01 Feb 2001 Tue format'
map global goto b '<a-;>: pick-buffers<ret>' \
-docstring 'buffer'
map global user d ': lf-open<ret>' \
-docstring 'pick a file with lf'
## git operations
try %{ declare-user-mode git }
map global user g ': enter-user-mode git<ret>' \
-docstring 'enter git user mode'
map global user e ":edit-from-file<ret>" \
-docstring "edit a file, searching from current file's directory"
map global git l ': git log<ret>' \
-docstring 'log'
map global user l ': enter-user-mode lsp<ret>' \
-docstring 'enter lsp user mode'
map global git c ': git commit<ret>' \
-docstring 'commit'
map global git d ': git diff<ret>' \
-docstring 'diff'
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'
## open selection operations
try %{ declare-user-mode open-sel }
map global user o ': enter-user-mode open-sel<ret>' \
-docstring 'enter open-sel user mode'
map global user r ': remind<ret>' \
-docstring 'edit reminders'
map global open-sel b '$ $BROWSER $kak_reg_dot & disown<ret>' \
-docstring "on %sh{echo $BROWSER}"
map global user s ': enter-user-mode surround<ret>' \
-docstring 'enter surround user mode'
map global open-sel i '$ imv $kak_reg_dot & disown<ret>' \
-docstring 'on imv'
map global user u ': echo -markup "{Information}U+%sh{printf ''%04x'' ""$kak_cursor_char_value""}"<ret>' \
-docstring 'show the value of the selected unicode char'
map global user q ': delete-buffer<ret>' \
-docstring 'delete current buffer'
map global user Q ': delete-buffer!<ret>' \
-docstring 'delete current buffer'
map global open-sel b '$ icecat $kak_reg_dot & disown<ret>' \
-docstring 'on browser'
map global open-sel s '$ sioyek $kak_reg_dot & disown<ret>' \
-docstring 'on sioyek'
map global open-sel m '$ mpv $kak_reg_dot & disown<ret>' \
-docstring 'on mpv'
map global goto b '<a-;>: open-buffer-picker<ret>' \
-docstring 'buffer'
map global normal = ': prompt math: %{exec "a %val{text}<lt>esc>|qalc -t +u8 -f -<lt>ret>"}<ret>' \
-docstring 'Replace selection by the result of some operation over it'
## surrounding operations
map global object <ret> 'c\n,\n<ret>'\
-docstring 'newlines'
map global object <space> 'c<space>,<space><ret>'\
-docstring 'whitespaces'
-docstring 'spaces'
try %{ declare-user-mode git }
map global git l ': git log<ret>' -docstring 'log'
map global git c ': git commit<ret>' -docstring 'commit'
map global git d ': git diff<ret>' -docstring 'diff'
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'
### operations relative to current file's directory
map global user <ret> ': spawn-terminal-here<ret>' \
-docstring "open a new terminal within the current file's directory"
# __________ Hooks __________
map global user e ": edit-from-here<ret>" \
-docstring "edit a file, searching from current file's directory"
### comments
map global user c ': comment-line<ret>' \
-docstring 'comment-line'
map global user C ': comment-block<ret>' \
-docstring 'comment-block'
map global user d ': lf-open<ret>' \
-docstring 'pick a file with lf'
### entering user modes
map global user s ': enter-user-mode surround<ret>' \
-docstring 'enter surround user mode'
map global user l ': enter-user-mode lsp<ret>' \
-docstring 'enter lsp user mode'
### remind
map global user r ': remind<ret>' \
-docstring 'edit reminders'
# __________ hooks __________
hook -group config global BufCreate 'kakrc' %{
set-option buffer filetype kak
} # Set kakrc's filetype to kak
} # set kakrc's filetype to kak
hook global BufCreate '\*scratch\*' %{
execute-keys '%<a-d>'
} # Remove the *scratch* message
add-highlighter buffer/ wrap -indent -word -marker '↩'
add-highlighter buffer/ show-whitespaces -indent '' -tab '→'
} # remove the *scratch* message, and set highlighters
hook global BufCreate .* %{
add-highlighter buffer/ number-lines -relative -hlcursor
} # Set relative line numbers and visual line break
} # set relative line numbers and visual line break
hook global BufWritePost ".*/.config/kak/kakrc" %{
source "%val{buffile}"
} # Source kakrc on save
} # source kakrc on save
hook global BufWritePost "%val{config}/autoload/colorscheme.kak" %{
source "%val{config}/autoload/colorscheme.kak"
hook global BufWritePost "%val{config}/colorscheme.kak" %{
source "%val{config}/colorscheme.kak"
evaluate-commands palette-gutter
} # Automatically source colorscheme.kak on save
} # automatically source colorscheme.kak on save
hook global BufOpenFile "%val{config}/autoload/colorscheme.kak" %{
hook global BufOpenFile "%val{config}/colorscheme.kak" %{
evaluate-commands palette-gutter
} # Display faces in the colorscheme file
} # display faces in the colorscheme file
hook global BufOpenFile .* %{
add-highlighter buffer/ wrap -word -marker '↩'
add-highlighter buffer/ show-whitespaces -indent '' -tab '→'
} # Set highlighters for file buffers
} # set highlighters for file buffers
hook global BufCreate '\*scratch\*' %{
add-highlighter buffer/ wrap -indent -word -marker '↩'
add-highlighter buffer/ show-whitespaces -indent '' -tab '→'
} # Set highlighters for scratch buffers
hook global BufOpenFile .*\.typ %{
set-option buffer filetype typst
}
hook global InsertCompletionShow .* %{
map window insert <tab> <c-n>
@ -309,7 +315,7 @@ hook global InsertCompletionShow .* %{
hook global InsertCompletionHide .* %{
map window insert <tab> <c-n>
map window insert <s-tab> <c-p>
} # Use tab for completion movement
} # use tab for completion movement
try %{ declare-option str line_comment_token '' }
hook -group config global BufSetOption filetype=kak %{
@ -319,7 +325,6 @@ hook -group config global BufSetOption filetype=kak %{
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
@ -359,16 +364,16 @@ hook global WinSetOption filetype=kak %{
}
}
# __________ Plugins __________
# __________ plugins __________
source "%val{config}/plugins/plug.kak/rc/plug.kak"
plug "andreyorst/plug.kak" noload # Manually installed plugin manager
plug "andreyorst/plug.kak" noload # manually installed plugin manager
# CONFIGURE THIS
plug "occivink/kakoune-phantom-selection" # Work on multiple selections, one at a time
# configure this
plug "occivink/kakoune-phantom-selection" # work on multiple selections, one at a time
plug "alexherbo2/surround.kak" # Easily surround selections with parentesis or quotes
plug "maximbaz/surround.kak" # easily surround selections with parentesis or quotes
plug "https://gitlab.com/Screwtapello/kakoune-texinfo" # Read info pages inside kakoune
plug "https://gitlab.com/Screwtapello/kakoune-texinfo" # read info pages inside kakoune
plug "https://gitlab.com/Screwtapello/kakoune-state-save" config %{
hook global KakBegin .* %{
@ -382,57 +387,59 @@ plug "https://gitlab.com/Screwtapello/kakoune-state-save" config %{
evaluate-commands 'state-save-reg-save pipe'
evaluate-commands 'state-save-reg-save slash'
}
} # Save and restore state between sessions
} # save and restore state between sessions
plug 'delapouite/kakoune-buffers' # Ease navigation between opened buffers.
# plug "https://codeberg.org/anemofilia/relapath.kak" demand relapath %{
# alias global cd relapath-change-directory
# alias global e relapath-edit
# alias global e! relapath-edit-bang
#
# alias global change-directory relapath-change-directory
# alias global edit relapath-edit
# alias global edit! relapath-edit-bang
# alias global rename-buffer relapath-rename-buffer
#
# relapath-modelinefmt-replace global
# } # no dereference symlinks
plug "NNBnh/coderun.kak" # Run files from within kakoune
plug 'delapouite/kakoune-buffers' # ease navigation between opened buffers.
plug "enricozb/wiki.kak" # Preview and interact with markdown
plug "https://gitlab.com/Screwtapello/kakoune-texinfo.git" # texinfo
plug "https://gitlab.com/Screwtapello/kakoune-texinfo.git" # TexInfo
plug "TeddyDD/kakoune-lf" # lf integration
plug "jpcornwell/kakoune-sokoban" # Sokoban because yes
plug "jpcornwell/kakoune-sokoban" # sokoban because yes
plug "lePerdu/kakboard" config %{
hook global WinCreate .* %{ kakboard-enable }
} # Sync clipboards
plug "gspia/csv.kak" config %{
set-option global csv_sep ';'
set-option global csv_colors "blue rgb:f1f1f1 blue rgb:f1f1f1 blue rgb:f1f1f1 blue"
} # Colorful csv files
} # sync clipboards
plug "JJK96/kakoune-rainbow"
set-option global rainbow_opening "[{[(]"
set-option global rainbow_opening "[[(]"
declare-option str-list rainbow_faces "rgb:a790d3" "rgb:6cdae0" "rgb:ff7f50" \
"rgb:ffea8c" "rgb:83dcaf" "rgb:eba4d4" \
"rgb:8b5be7"
#Add coloring to matching parenthesis
# add coloring to matching parenthesis
plug "alexherbo2/auto-pairs.kak" config %{
set-option global auto_pairs ( ) { } [ ] '"' '"' "'" "'" ` ` “ ” « »
set-option global auto_pairs ( ) { } [ ] '"' '"' "'" "'" ` `
hook -group config global BufSetOption filetype=latex %{
set-option buffer auto_pairs ( ) [ ] { } '"' '"' $ $
}
hook -group config global BufSetOption filetype=scheme %{
set-option buffer auto_pairs { } '"' '"' ` ` “ ” « »
set-option buffer auto_pairs ( ) [ ] { } '"' '"'
}
hook -group config global BufSetOption filetype=typst %{
set-option buffer auto_pairs ( ) [ ] { } '"' '"' $ $ * *
}
evaluate-commands enable-auto-pairs
} # Auto-pairing of characters
plug "eraserhd/parinfer-rust" config %{
hook global WinSetOption filetype=(clojure|lisp|scheme|racket) %{
parinfer-enable-window -smart
}
}
} # auto-pairing of characters
plug "Delapouite/kakoune-palette" config %{
hook global BufOpenFile .*colorscheme.kak %{
evaluate-commands palette-gutter
}
} # Preview face colors in kakoune
} # preview face colors in kakoune
# __________ LSP __________
# __________ lsp __________
eval %sh{kak-lsp --kakoune -s $kak_session}
hook global BufSetOption filetype=(c|cpp|css|haskell|html|json|scheme|sh|latex|zig) %{
add-highlighter buffer/ column 80 StatusLine
@ -442,7 +449,7 @@ hook global BufSetOption filetype=(c|cpp|css|haskell|html|json|scheme|sh|latex|z
lsp-enable-window
}
# Latex
# latex
set-option -add global lsp_server_configuration texlab.build.onSave=true
set-option -add global lsp_server_configuration texlab.build.forwardSearchAfter=true
set-option -add global lsp_server_configuration texlab.build.args=["-pdf","-new-viewer-","-pdflatex\=pdflatex","-silent","-shell-escape","%f"]