AutoYADM commit: 2025-06-17 20:47:57
This commit is contained in:
parent
1f952af0ed
commit
80c399ee03
16 changed files with 476 additions and 131 deletions
|
@ -1,3 +1,4 @@
|
|||
provide-module bootstrap %~
|
||||
# this is for bootstrapping all external dependencies of my kakoune setup
|
||||
|
||||
# installs:
|
||||
|
@ -43,3 +44,4 @@ define-command -docstring %{
|
|||
install-pacman
|
||||
install-cargo
|
||||
}
|
||||
~
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
provide-module clipboard %~
|
||||
declare-option -docstring %{
|
||||
Command for copying to system clipboard.
|
||||
} str clipboard_copy_cmd 'wl-copy'
|
||||
|
@ -55,4 +56,4 @@ map -docstring "yank the split selections into the clipboard" global user Y ": c
|
|||
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>'
|
||||
|
||||
~
|
||||
|
|
|
@ -138,3 +138,4 @@ hook global BufCreate .*[.](jinja) %{
|
|||
set-option buffer filetype html
|
||||
}
|
||||
|
||||
|
||||
|
|
7
.config/kak/autoload/filetype/sh.kak
Normal file
7
.config/kak/autoload/filetype/sh.kak
Normal file
|
@ -0,0 +1,7 @@
|
|||
hook global WinSetOption tree_sitter_lang=sh %{
|
||||
set-option window tree_sitter_lang bash
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=(bash|sh) %{
|
||||
set-option window formatcmd 'shfmt -i 4 -ln=auto -ci -bn'
|
||||
}
|
|
@ -3,7 +3,7 @@ declare-option -docstring "shell command used for the 'format-selections' and 'f
|
|||
declare-option -docstring "whether the LSP should be preferred for formatting" bool lsp_fmt false
|
||||
|
||||
define-command format-buffer -docstring "Format the contents of the buffer" %{
|
||||
evaluate-commands %sh{
|
||||
evaluate-commands -draft %sh{
|
||||
if [ "$kak_opt_lsp_fmt" = "false" ]; then
|
||||
echo "format-buffer-pipe"
|
||||
else
|
||||
|
@ -13,7 +13,7 @@ define-command format-buffer -docstring "Format the contents of the buffer" %{
|
|||
}
|
||||
|
||||
define-command format-selections -docstring "Format the selections individually" %{
|
||||
evaluate-commands %sh{
|
||||
evaluate-commands -draft %sh{
|
||||
if [ "${kak_opt_lsp_fmt}" = "false" ]; then
|
||||
echo "format-selections-pipe"
|
||||
else
|
||||
|
|
|
@ -40,6 +40,20 @@ define-command -override -hidden lsp-do-send-sync %{
|
|||
}
|
||||
}
|
||||
|
||||
define-command -override lsp-progress-disable %{
|
||||
# override to do nothing b/c it's annoying lol
|
||||
define-command -hidden -override lsp-handle-progress -params 6 nop
|
||||
}
|
||||
define-command -override lsp-progress-enable %{
|
||||
# identical to kak-lsp default
|
||||
define-command -hidden -override lsp-handle-progress -params 6 %{
|
||||
set-option global lsp_modeline_progress %sh{
|
||||
if ! "$6"; then
|
||||
echo "$kak_opt_lsp_progress_indicator"
|
||||
fi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -137,6 +151,15 @@ define-command -hidden lsp-filetype-hooks-update %{
|
|||
# commands to execute for lsp window settings
|
||||
lsp-enable-window
|
||||
inlay-on
|
||||
|
||||
# hooks to disable inline diagnostics while typing
|
||||
hook -group dynamic-inline-diags window ModeChange (push|pop):.*insert %{
|
||||
try inline-diagnostics-off
|
||||
}
|
||||
hook -group dynamic-inline-diags window ModeChange (push|pop):insert:.* %{
|
||||
try inline-diagnostics-on
|
||||
}
|
||||
|
||||
# only map to UI mode if that module is available
|
||||
map -docstring 'toggle inlay hints' window ui h ': inlay-toggle<ret>'
|
||||
map -docstring 'toggle inlay diagnostics' window ui d ': inlay-diagnostics-toggle<ret>'
|
||||
|
@ -329,59 +352,12 @@ hook -group lsp-filetype-toml global BufSetOption filetype=toml %{
|
|||
}
|
||||
}
|
||||
|
||||
# # can be empty, global, or file
|
||||
# declare-option -hidden str harper_add ""
|
||||
# define-command -hidden harper-add -params 1 %{
|
||||
# set-option window harper_add %arg{1}
|
||||
# lsp-code-actions -auto-single
|
||||
# }
|
||||
|
||||
# # can override this to customize what's rendered in the menu
|
||||
# # Each code action is two args: its name, and the corresponding command
|
||||
# define-command -override -hidden lsp-perform-code-action -params 1.. -docstring "Called on :lsp-code-actions" %{
|
||||
# evaluate-commands %sh{
|
||||
# # harper specific filtering
|
||||
# if printf '%s' "$kak_opt_lsp_servers" | grep -q 'harper-ls'; then
|
||||
# if [ "$kak_opt_harper_add" = "global" ]; then
|
||||
# # filter and keep only
|
||||
# echo "echo -debug 'harper adding global'"
|
||||
# fi
|
||||
# fi
|
||||
# echo "echo -debug dumping $# code actions args:"
|
||||
# echo "echo -debug %arg{@}"
|
||||
|
||||
# }
|
||||
# lsp-menu %arg{@}
|
||||
# }
|
||||
|
||||
define-command lsp-inlay-hint-raw %{
|
||||
evaluate-commands %sh{
|
||||
tmp=$(mktemp -d)
|
||||
pipe="${tmp}/fifo"
|
||||
mkfifo "$pipe" || { echo "fail failed to create fifo"; exit 1; }
|
||||
trap "rm -f \"$pipe\"; rmdir \"$tmp\"" EXIT INT QUIT
|
||||
|
||||
reg_a="$kak_session
|
||||
$kak_client
|
||||
true
|
||||
false
|
||||
$kak_buffile
|
||||
$kak_timestamp
|
||||
$kak_opt_filetype
|
||||
$kak_opt_lsp_language_id
|
||||
$kak_opt_lsp_servers
|
||||
$kak_opt_lsp_semantic_tokens
|
||||
$kak_opt_lsp_config
|
||||
$kak_opt_lsp_server_initialization_options
|
||||
map-end
|
||||
textDocument/inlayHint
|
||||
$kak_buf_line_count"
|
||||
|
||||
printf "%s '%s' " "$reg_a" "$pipe" > "$kak_opt_lsp_fifo"
|
||||
|
||||
raw=$(cat "$pipe")
|
||||
raw_escaped=$(printf %s "$raw" | sed "s/'/''/g")
|
||||
printf "set-register z '%s'\n" "$raw_escaped"
|
||||
}
|
||||
remove-hooks global lsp-filetype-sh
|
||||
hook -group lsp-filetype-sh global BufSetOption filetype=sh %{
|
||||
set-option buffer lsp_servers %{
|
||||
[bash-language-server]
|
||||
root_globs = [".git", ".hg"]
|
||||
args = ["start"]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,27 @@
|
|||
declare-user-mode paragraph
|
||||
declare-option -hidden str paragraph_select '<a-a>pj[p'
|
||||
|
||||
map global normal <a-ret> '<a-a>pj[p'
|
||||
define-command format-paragraph %{
|
||||
execute-keys -draft <a-a>p_x:<space>format-selections<ret>
|
||||
}
|
||||
|
||||
define-command -override -params 0..1 reflow-paragraph %{
|
||||
evaluate-commands -draft -save-regs 'a' %{
|
||||
set-register a %sh{
|
||||
if [ "$#" = 0 ]; then
|
||||
printf '%s' '|fmt<ret>'
|
||||
else
|
||||
printf '%s' ':<space>format-selections<ret>'
|
||||
fi
|
||||
}
|
||||
echo -debug %reg{a}
|
||||
execute-keys -draft '<a-a>p_x:exec <c-r>a<ret>'
|
||||
}
|
||||
}
|
||||
|
||||
map global normal <a-ret> ': reflow-paragraph<ret>'
|
||||
map global normal <ret> '<a-a>pj[p<a-;>'
|
||||
map global normal <s-ret> ': reflow-paragraph formatcmd<ret>'
|
||||
map -docstring 'paragraph mode' global user <ret> "%opt{paragraph_select}: enter-user-mode -lock paragraph<ret>"
|
||||
map global paragraph I '>' -docstring 'move right'
|
||||
map global paragraph M '<' -docstring 'move left'
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
# echo "nop"
|
||||
# fi
|
||||
# }
|
||||
|
||||
provide-module plugins %—
|
||||
|
||||
# init bundle
|
||||
source "%val{config}/bundle/kak-bundle/rc/kak-bundle.kak"
|
||||
|
@ -113,3 +115,5 @@ bundle pykak https://github.com/tomKPZ/pykak
|
|||
# bundle kak-ansi https://github.com/eraserhd/kak-ansi
|
||||
|
||||
bundle-theme one.kak https://github.com/raiguard/one.kak
|
||||
|
||||
—
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
define-command -docstring %{
|
||||
sh [switches] <args>: Run the given shell command. Display its output in an info modal.
|
||||
shell-command [switches] <args>: Run the given shell command. Display
|
||||
its output in an info modal.
|
||||
Switches:
|
||||
-d echo stdout to *debug* buffer
|
||||
} -params 1.. sh %{
|
||||
-d echo stdout to *debug* buffer as well
|
||||
} -params 1.. shell-command %{
|
||||
evaluate-commands %sh{
|
||||
if [ "$1" = "-d" ]; then
|
||||
debug="true"
|
||||
|
@ -15,3 +16,5 @@ define-command -docstring %{
|
|||
fi
|
||||
}
|
||||
}
|
||||
alias global sh shell-command
|
||||
alias global ! shell-command
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
provide-module yazi %~
|
||||
declare-user-mode yazi
|
||||
map -docstring "Yazi" global user <space> ': enter-user-mode yazi<ret>'
|
||||
|
||||
|
@ -37,3 +38,4 @@ define-command open-yazi-new-client %{
|
|||
}
|
||||
}
|
||||
map -docstring "open with yazi in new client" global yazi n ': open-yazi-new-client<ret>'
|
||||
~
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue