AutoYADM commit: 2025-05-26 01:28:38
This commit is contained in:
parent
8b77acf426
commit
ecb67ff683
2 changed files with 38 additions and 55 deletions
|
@ -32,37 +32,19 @@ define-command ui-scrolloff-enable %{
|
||||||
|
|
||||||
define-command ui-scrolloff-toggle -docstring "toggle scrolloff" %{
|
define-command ui-scrolloff-toggle -docstring "toggle scrolloff" %{
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
# CUR="$kak_opt_scrolloff"
|
|
||||||
# IFS=,
|
|
||||||
# read TARG HOR <<<$kak_opt_base_scrolloff
|
|
||||||
# IFS=,
|
|
||||||
# read VSCROLL _ <<<$kak_opt_scrolloff
|
|
||||||
# if [ "$VSCROLL" = 99 ]; then
|
|
||||||
# final="$TARG,$HOR"
|
|
||||||
# else
|
|
||||||
# final="99,$HOR"
|
|
||||||
# fi
|
|
||||||
# echo "set-option window scrolloff $final"
|
|
||||||
# Parse base_scrolloff
|
|
||||||
IFS=, set -- $kak_opt_base_scrolloff
|
IFS=, set -- $kak_opt_base_scrolloff
|
||||||
TARG=${1:-0}
|
TARG=${1:-0}
|
||||||
HOR=${2:-0}
|
HOR=${2:-0}
|
||||||
|
|
||||||
# Parse current scrolloff
|
# Parse current scrolloff
|
||||||
IFS=, set -- $kak_opt_scrolloff
|
IFS=, set -- $kak_opt_scrolloff
|
||||||
VSCROLL=${1:-0}
|
VSCROLL=${1:-0}
|
||||||
CURHOR=${2:-0}
|
|
||||||
|
|
||||||
# Build the new scrolloff value
|
# Build the new scrolloff value
|
||||||
if [ "$VSCROLL" = 99 ]; then
|
if [ "$VSCROLL" = 99 ]; then
|
||||||
final="$TARG,$HOR"
|
final="$TARG"
|
||||||
else
|
else
|
||||||
final="$VSCROLL,$CURHOR"
|
final="99,$HOR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "set-option window scrolloff $final"
|
echo "set-option window scrolloff $final"
|
||||||
notify-send "$final"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,9 @@ try %{
|
||||||
set-option global ashen_eol_cursor true
|
set-option global ashen_eol_cursor true
|
||||||
}
|
}
|
||||||
# disable clippy
|
# disable clippy
|
||||||
set-option global ui_options terminal_assistant=none
|
set-option -add global ui_options terminal_assistant=none
|
||||||
|
|
||||||
|
# only set to foot if we are on wayland
|
||||||
hook global ModuleLoaded wayland %{
|
hook global ModuleLoaded wayland %{
|
||||||
set-option global termcmd 'footclient sh -c'
|
set-option global termcmd 'footclient sh -c'
|
||||||
}
|
}
|
||||||
|
@ -27,8 +28,7 @@ hook global ModuleLoaded wayland %{
|
||||||
set-option global tabstop 4
|
set-option global tabstop 4
|
||||||
set-option global indentwidth 4
|
set-option global indentwidth 4
|
||||||
|
|
||||||
# set-option global base_scrolloff 3,3
|
# needed for tree-sitter to respect show-matching
|
||||||
|
|
||||||
define-command -override tree-sitter-user-after-highlighter %{
|
define-command -override tree-sitter-user-after-highlighter %{
|
||||||
add-highlighter -override buffer/show-matching show-matching
|
add-highlighter -override buffer/show-matching show-matching
|
||||||
}
|
}
|
||||||
|
@ -37,16 +37,23 @@ define-command -override tree-sitter-user-after-highlighter %{
|
||||||
add-highlighter global/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373
|
add-highlighter global/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373
|
||||||
# special highlighting for escaped goodies in regex
|
# special highlighting for escaped goodies in regex
|
||||||
add-highlighter global/regex-escaped regex \\[\[\]\(\)\{\}fnrtv0\\dwshDWSH] 0:rgb:e5e5e5
|
add-highlighter global/regex-escaped regex \\[\[\]\(\)\{\}fnrtv0\\dwshDWSH] 0:rgb:e5e5e5
|
||||||
# add-highlighter global/ show-matching
|
|
||||||
|
|
||||||
|
# default window settings
|
||||||
|
# wrap enabled
|
||||||
|
# scrolloff enabled
|
||||||
hook global WinCreate .* %{
|
hook global WinCreate .* %{
|
||||||
ui-wrap-enable
|
ui-wrap-enable
|
||||||
|
# TODO: fix ui-scrolloff-enable and use that instead
|
||||||
ui-scrolloff-toggle
|
ui-scrolloff-toggle
|
||||||
add-highlighter window/number-lines number-lines -hlcursor -relative -separator " "
|
add-highlighter window/number-lines number-lines -hlcursor -relative -separator " "
|
||||||
add-highlighter window/show-whitespaces show-whitespaces -only-trailing # -lf "" -tab "" -only-trailing
|
# only-trailing is nice QOL otherwise it gets hard to read the screen
|
||||||
|
# and it makes it easy to see trailing spaces
|
||||||
|
add-highlighter window/show-whitespaces show-whitespaces -only-trailing
|
||||||
add-highlighter window/show-matching show-matching
|
add-highlighter window/show-matching show-matching
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# convenience mappings
|
||||||
|
# quitting & saving
|
||||||
map -docstring "quit" global user q ": q<ret>"
|
map -docstring "quit" global user q ": q<ret>"
|
||||||
map -docstring "quit" global normal <c-q> ": q<ret>"
|
map -docstring "quit" global normal <c-q> ": q<ret>"
|
||||||
map -docstring "force quit" global user Q ": q!<ret>"
|
map -docstring "force quit" global user Q ": q!<ret>"
|
||||||
|
@ -55,28 +62,22 @@ map -docstring "kill session" global normal <a-q> ':kill<ret>'
|
||||||
map -docstring "force kill session" global normal <a-q> ':kill!<ret>'
|
map -docstring "force kill session" global normal <a-q> ':kill!<ret>'
|
||||||
map -docstring "save" global normal <c-v> ": write<ret>"
|
map -docstring "save" global normal <c-v> ": write<ret>"
|
||||||
map -docstring "save" global normal <a-v> ": write!<ret>"
|
map -docstring "save" global normal <a-v> ": write!<ret>"
|
||||||
# map -docstring "save" global normal <a-v> ": write-all<ret>"
|
|
||||||
# map -docstring "save" global normal <a-V> ": write-all!<ret>"
|
|
||||||
|
|
||||||
|
# buffer operations
|
||||||
map -docstring "close current buffer" global user x ": db<ret>"
|
map -docstring "close current buffer" global user x ": db<ret>"
|
||||||
map -docstring "goto previous buffer" global user m ": bp<ret>"
|
map -docstring "goto previous buffer" global user m ": bp<ret>"
|
||||||
map -docstring "goto next buffer" global user i ": bn<ret>"
|
map -docstring "goto next buffer" global user i ": bn<ret>"
|
||||||
map -docstring "goto previous buffer" global normal <c-m> ": bp<ret>"
|
map -docstring "goto previous buffer" global normal <c-m> ": bp<ret>"
|
||||||
map -docstring "goto next buffer" global normal <c-i> ": bn<ret>"
|
map -docstring "goto next buffer" global normal <c-i> ": bn<ret>"
|
||||||
|
|
||||||
# map global normal X "x<a-semicolon>"
|
# trim whitespace
|
||||||
|
|
||||||
# map global normal <c-u> ":exec <c-u>vv<ret>"
|
|
||||||
# map global normal <c-d> ":exec <c-d>vv<ret>"
|
|
||||||
|
|
||||||
map global normal <tab> _
|
map global normal <tab> _
|
||||||
|
|
||||||
# map global normal <a-X> <a-x>
|
# comments
|
||||||
# map global normal <a-x> '<a-i>p'
|
|
||||||
|
|
||||||
map -docstring "comment line" global normal "#" ": comment-line<ret>"
|
map -docstring "comment line" global normal "#" ": comment-line<ret>"
|
||||||
map -docstring "comment block" global normal "<a-#>" ": comment-block<ret>"
|
map -docstring "comment block" global normal "<a-#>" ": comment-block<ret>"
|
||||||
|
|
||||||
|
# formatting
|
||||||
map -docstring "format" global normal = ": format-buffer<ret>"
|
map -docstring "format" global normal = ": format-buffer<ret>"
|
||||||
map -docstring "format" global normal <a-=> ": format-selections<ret>"
|
map -docstring "format" global normal <a-=> ": format-selections<ret>"
|
||||||
|
|
||||||
|
@ -86,39 +87,36 @@ map -docstring 'case insensitive backward search' global user '<a-/>' <a-/>(?i)
|
||||||
map -docstring 'case insensitive extend search' global user '?' ?(?i)
|
map -docstring 'case insensitive extend search' global user '?' ?(?i)
|
||||||
map -docstring 'case insensitive backward extend-search' global user '<a-?>' <a-?>(?i)
|
map -docstring 'case insensitive backward extend-search' global user '<a-?>' <a-?>(?i)
|
||||||
|
|
||||||
# Arrow keys for menu selections
|
# TODO: how to bind these to goto mode while respecting g/G??
|
||||||
# map -docstring 'Select next menu' global prompt <down> <tab>
|
|
||||||
# map -docstring 'Select previous menu' global prompt <up> <s-tab>
|
|
||||||
# hook global InsertCompletionShow .* %{
|
|
||||||
# map window insert <down> <c-n>
|
|
||||||
# map window insert <up> <c-p>
|
|
||||||
# hook -once window InsertCompletionHide .* %{
|
|
||||||
# unmap window insert <down>
|
|
||||||
# unmap window insert <up>
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
map -docstring 'Select to file end' global user N "Gj<a-L>L"
|
map -docstring 'Select to file end' global user N "Gj<a-L>L"
|
||||||
map -docstring 'Extend to file end' global user n "gj<a-l>l"
|
map -docstring 'Extend to file end' global user n "gj<a-l>l"
|
||||||
|
|
||||||
define-command -docstring %{
|
# Zathura pdf preview only for Typst files
|
||||||
Spawns a Zathura pdf preview and Typst watcher for the currently open Typst file
|
|
||||||
} typst %{
|
hook global WinSetOption filetype=typst %{
|
||||||
nop %sh{
|
define-command -docstring %{
|
||||||
{
|
Spawns a Zathura pdf preview and Typst watcher for the currently open Typst file
|
||||||
"$kak_config/scripts/kak-typ-zathura.fish" -k -w "$kak_buffile" "$kak_client_pid"
|
} typst %{
|
||||||
} > /dev/null 2>&1 < /dev/null &
|
nop %sh{
|
||||||
}
|
{
|
||||||
|
"$kak_config/scripts/kak-typ-zathura.fish" -k -w "$kak_buffile" "$kak_client_pid"
|
||||||
|
} > /dev/null 2>&1 < /dev/null &
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -docstring "Create a scratch buffer" scratch %{
|
define-command -docstring "Create a scratch buffer" scratch %{
|
||||||
edit -scratch
|
edit -scratch
|
||||||
}
|
}
|
||||||
alias global s scratch
|
alias global s scratch
|
||||||
|
|
||||||
define-command -docstring "New terminal in cwd" cwd-terminal %{
|
define-command -docstring "New terminal in cwd" cwd-terminal %{
|
||||||
terminal fish
|
terminal fish
|
||||||
}
|
}
|
||||||
|
# make easy to open new shell
|
||||||
alias global t cwd-terminal
|
alias global t cwd-terminal
|
||||||
|
|
||||||
|
# manually requiring needed for some reason 😢
|
||||||
require-module peneira
|
require-module peneira
|
||||||
|
|
||||||
declare-user-mode peneira
|
declare-user-mode peneira
|
||||||
|
@ -137,8 +135,11 @@ define-command goto-debug %{
|
||||||
ui-scrolloff-disable
|
ui-scrolloff-disable
|
||||||
execute-keys 'gj'
|
execute-keys 'gj'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
map -docstring 'open debug buffer' global user D ':goto-debug<ret>'
|
map -docstring 'open debug buffer' global user D ':goto-debug<ret>'
|
||||||
|
|
||||||
|
# spellcheck using aspell for now (maybe better options?)
|
||||||
declare-user-mode spell
|
declare-user-mode spell
|
||||||
|
|
||||||
map -docstring 'show spell' global spell s ': spell<ret>'
|
map -docstring 'show spell' global spell s ': spell<ret>'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue