AutoYADM commit: 2025-05-16 17:14:15
This commit is contained in:
parent
51ccc1e607
commit
b9cc8e936f
9 changed files with 78 additions and 171 deletions
|
@ -9,15 +9,6 @@ hook global ModuleLoaded wayland %{
|
|||
set-option global termcmd 'footclient sh -c'
|
||||
}
|
||||
|
||||
# open tutor (needs curl)
|
||||
define-command trampoline -docstring "open a tutorial" %{
|
||||
evaluate-commands %sh{
|
||||
tramp_file=$(mktemp -t "kakoune-trampoline.XXXXXXXX")
|
||||
echo "edit -fifo $tramp_file *TRAMPOLINE*"
|
||||
curl -s https://raw.githubusercontent.com/mawww/kakoune/master/contrib/TRAMPOLINE -o "$tramp_file"
|
||||
}
|
||||
}
|
||||
|
||||
# This gets overridden by editorconfig but we set sane default anyways
|
||||
set-option global tabstop 4
|
||||
set-option global indentwidth 4
|
||||
|
@ -35,73 +26,13 @@ add-highlighter global/regex-escaped regex \\[\[\]\(\)\{\}fnrtv0\\dwshDWSH] 0:rg
|
|||
add-highlighter global/ number-lines -hlcursor -relative -separator " "
|
||||
add-highlighter global/ show-whitespaces -lf "" -tab "" -only-trailing
|
||||
add-highlighter global/ show-matching
|
||||
# add-highlighter global/wrap wrap -word -indent
|
||||
|
||||
declare-user-mode ui
|
||||
map -docstring "UI" global user u ": enter-user-mode ui<ret>"
|
||||
|
||||
define-command ui-wrap-enable -docstring "enable wrap" %{
|
||||
add-highlighter window/wrap wrap -word -indent
|
||||
echo -markup "{Information}wrap enabled"
|
||||
}
|
||||
|
||||
define-command ui-wrap-disable -docstring "disable wrap" %{
|
||||
remove-highlighter window/wrap
|
||||
echo -markup "{Information}wrap disabled"
|
||||
}
|
||||
|
||||
define-command -override ui-wrap-toggle -docstring "toggle wrap" %{
|
||||
try %{ ui-wrap-enable } catch %{ ui-wrap-disable }
|
||||
}
|
||||
map -docstring "toggle soft wrap" global ui w ": ui-wrap-toggle<ret>"
|
||||
|
||||
declare-option str base_scrolloff %opt{scrolloff}
|
||||
|
||||
define-command ui-scrolloff-toggle -docstring "toggle scrolloff" %{
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
map -docstring 'toggle screen centering' global ui z ": ui-scrolloff-toggle<ret>"
|
||||
|
||||
declare-option bool autowrap false
|
||||
|
||||
define-command autowrap-toggle -docstring "toggle autowrap" %{
|
||||
evaluate-commands %sh{
|
||||
if [ "$kak_opt_autowrap" = "true" ]; then
|
||||
echo "autowrap-disable"
|
||||
echo "set-option window autowrap false"
|
||||
else
|
||||
echo "autowrap-enable"
|
||||
echo "set-option window autowrap true"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
# map -docstring "toggle autowrap" global ui a ": autowrap-toggle<ret>"
|
||||
|
||||
hook global WinCreate .* %{
|
||||
ui-wrap-enable
|
||||
ui-scrolloff-toggle
|
||||
}
|
||||
|
||||
map -docstring "yank the selection into the clipboard" global user y "<a-|> wl-copy<ret>"
|
||||
|
||||
map -docstring "paste the clipboard" global user p "<a-!> wl-paste -n<ret>"
|
||||
map -docstring "paste the clipboard before" global user P "! wl-paste -n<ret>"
|
||||
map -docstring "replace with the clipboard" global user R '"_d! wl-paste -n<ret>'
|
||||
|
||||
map -docstring "quit" global user q ": q<ret>"
|
||||
map -docstring "quit" global normal <c-q> ": q<ret>"
|
||||
map -docstring "quit" global user Q ": q!<ret>"
|
||||
|
@ -130,24 +61,6 @@ map global normal <tab> _
|
|||
|
||||
map -docstring "comment line" global normal "#" ": comment-line<ret>"
|
||||
map -docstring "comment block" global normal "<a-#>" ": comment-block<ret>"
|
||||
declare-user-mode git
|
||||
map -docstring "git" global user g ": enter-user-mode git<ret>"
|
||||
map -docstring "lazygit kak cwd" global git g ": terminal lazygit<ret>"
|
||||
|
||||
define-command lazygit-buffer-dir %{
|
||||
evaluate-commands %sh{
|
||||
ROOT="$(env -C "$(dirname $kak_buffile)" git rev-parse --show-toplevel)"
|
||||
printf "terminal lazygit -p %s" "$ROOT"
|
||||
}
|
||||
}
|
||||
map -docstring "lazygit buffer directory" global git G ": lazygit-buffer-dir<ret>"
|
||||
|
||||
define-command git-blame %{
|
||||
info %sh{
|
||||
git -C $(dirname $(realpath $kak_buffile)) blame -L $kak_cursor_line,$kak_cursor_line $(realpath $kak_buffile)
|
||||
}
|
||||
}
|
||||
map -docstring "blame" global git b ": git-blame<ret>"
|
||||
|
||||
map -docstring "format" global normal = ": format-buffer<ret>"
|
||||
map -docstring "format" global normal <a-=> ": format-selections<ret>"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue