restructure kakrc

This commit is contained in:
xenia 2023-11-12 12:43:16 +01:00
parent 14d79d3134
commit 0ad0c26bf4

View File

@ -1,7 +1,3 @@
## Highlight whitespace at end of line
add-highlighter global/ regex '^.*[^ ]( +)$' 1:black,red
add-highlighter global/ number-lines -relative -hlcursor
hook global WinSetOption .* %{ hook global WinSetOption .* %{
remove-highlighter global/show-ws remove-highlighter global/show-ws
add-highlighter global/show-ws show-whitespaces -tabpad ' ' add-highlighter global/show-ws show-whitespaces -tabpad ' '
@ -19,11 +15,7 @@ hook global WinSetOption filetype=(verilog|nix|vhdl) %{
set buffer indentwidth 2 set buffer indentwidth 2
} }
hook global WinSetOption filetype=vhdl %{ set-option global ignored_files "^(\..*|.*\.(o|so|a)|__pycache__)$"
set buffer comment_block_begin '/*'
set buffer comment_block_end '/*'
set buffer comment_line '--'
}
## == keybinds == ## == keybinds ==
@ -48,26 +40,6 @@ map global normal '<c-v>' '!pbpaste<ret>'
map global user 'b' ':enter-user-mode buffers<ret>' -docstring 'buffer mode' map global user 'b' ':enter-user-mode buffers<ret>' -docstring 'buffer mode'
map global user 'B' ':enter-user-mode -lock buffers<ret>' -docstring 'buffer mode (lock)' map global user 'B' ':enter-user-mode -lock buffers<ret>' -docstring 'buffer mode (lock)'
# command to copy <filename>:<line> into the clipboard (useful for pasting into debugger)
define-command copy-location -docstring "Copies <filename>:<line> for the current cursor into the clipboard" %{
evaluate-commands %sh{
set -e
printf "%s" "$kak_bufname:$kak_cursor_line" | pbcopy
echo "echo 'Copied $kak_bufname:$kak_cursor_line into clipboard'"
}
}
define-command copy-location-path -docstring "Copies <full path>:<line> for the current cursor into the clipboard" %{
evaluate-commands %sh{
set -e
printf "%s" "$kak_buffile:$kak_cursor_line" | pbcopy
echo "echo 'Copied $kak_buffile:$kak_cursor_line into clipboard'"
}
}
map global user 'y' ':copy-location<ret>' -docstring "Copy location"
map global user 'Y' ':copy-location-path<ret>' -docstring "Copy location (full path)"
## == plugin configuration == ## == plugin configuration ==
# Custom function surround # Custom function surround
@ -86,16 +58,14 @@ define-command -hidden surround-Tag %{
execute-keys "xZ<a-:><a-;>gih<a-h>yz<gt>xZO<c-r>""<lt>%val{text}<gt><esc>zo<c-r>""<lt>%val{text}<gt><esc>z" execute-keys "xZ<a-:><a-;>gih<a-h>yz<gt>xZO<c-r>""<lt>%val{text}<gt><esc>zo<c-r>""<lt>%val{text}<gt><esc>z"
} }
} }
define-command -hidden surround-ins %{ define-command -hidden surround-space %{
prompt 'prefix: ' %{ execute-keys "i <esc>Ha <esc>"
execute-keys "<a-:><a-;>Z;ha%val{text}<esc><a-;>L<a-z>u"
}
} }
map global mirror 'f' ':surround-function<ret>' -docstring 'function' map global mirror 'f' ':surround-function<ret>' -docstring 'function'
map global mirror 't' ':surround-tag<ret>' -docstring 'function' map global mirror 't' ':surround-tag<ret>mjau' -docstring 'tag'
map global mirror 'T' ':surround-Tag<ret>' -docstring 'function' map global mirror 'T' ':surround-Tag<ret>' -docstring 'tag, break line'
map global mirror 'i' ':surround-ins<ret>' -docstring 'function' map global mirror ' ' ':surround-space<ret>' -docstring 'spaces'
map global normal ö ':enter-user-mode mirror<ret>' -docstring 'mirror mode' map global normal ö ':enter-user-mode mirror<ret>' -docstring 'mirror mode'
@ -112,14 +82,16 @@ map global lsp '"' ':lsp-clear-references<ret>' -docstring "Clear references"
face global Reference white,rgb:550055 face global Reference white,rgb:550055
face global ReferenceBind white,rgb:552200 face global ReferenceBind white,rgb:552200
map global insert '<c-s>' '<a-;>:enter-user-mode lsp<ret>s'
#TODO #TODO
# map global user '&' ':qhl-word<ret>' -docstring "Highlight current word" # map global user '&' ':qhl-word<ret>' -docstring "Highlight current word"
# map global user '"' ':unqhl<ret>' -docstring "Remove highlight" # map global user '"' ':unqhl<ret>' -docstring "Remove highlight"
## == Colors == ## == Colors ==
## Highlight whitespace at end of line
add-highlighter global/ regex '^.*[^ ]( +)$' 1:black,red
add-highlighter global/ number-lines -relative -hlcursor
define-command update-cursor-style %{ define-command update-cursor-style %{
evaluate-commands %sh{ evaluate-commands %sh{
if [ $(echo "$kak_selection" | wc -c) -eq 2 ] ; then if [ $(echo "$kak_selection" | wc -c) -eq 2 ] ; then
@ -163,11 +135,3 @@ hook global WinSetOption filetype=python %{
set-option window formatcmd 'black -q -' set-option window formatcmd 'black -q -'
} }
set-option global ignored_files "^(\..*|.*\.(o|so|a)|__pycache__)$"
## APL execute on =
define-command -hidden dyalog-execute %{
execute-keys -itersel 'i⎕←<esc>HH|dyalogscript /dev/fd/0<ret>'
}
map global normal '=' ':dyalog-execute<ret>'