diff options
| -rwxr-xr-x | .config/kak/autoload/connect/commands/:fifo | 2 | ||||
| -rw-r--r-- | .config/kak/kakrc | 31 | ||||
| -rw-r--r-- | .config/kak/snippets.python.kak | 11 | ||||
| -rw-r--r-- | .pdbrc | 7 |
4 files changed, 41 insertions, 10 deletions
diff --git a/.config/kak/autoload/connect/commands/:fifo b/.config/kak/autoload/connect/commands/:fifo index ea2ede0..4c31940 100755 --- a/.config/kak/autoload/connect/commands/:fifo +++ b/.config/kak/autoload/connect/commands/:fifo @@ -3,7 +3,7 @@ # Edit fifo buffer in a client mkfifo buffer.fifo trap 'rm buffer.fifo' EXIT -:send edit! -fifo "$PWD/buffer.fifo" '*fifo*' +:send evaluate-commands -try-client tools %{edit! -fifo "$PWD/buffer.fifo" '*fifo*'} # Send to fifo buffer the output of the given command, # or read from stdin if available. diff --git a/.config/kak/kakrc b/.config/kak/kakrc index e4157ba..ee1b76e 100644 --- a/.config/kak/kakrc +++ b/.config/kak/kakrc @@ -43,17 +43,19 @@ hook -once global KakBegin .* %{ } # Added bracketed paste support. - define-command -override dtach-send-text -params 0..1 -docstring %{ + define-command -override dtach-send-bracketed-text -params 0..1 -docstring %{ dtach-send-text [text]: Send text to the REPL. If no text is passed, then the selection is used } %{ nop %sh{ - printf "\033[200~%s\033[201~\n" "${@:-$kak_selection}" | dtach -p "$kak_opt_dtach_repl_id" + { printf '\033[200~'; printf '%s' "${@:-$kak_selection}"; printf '\033[201~'; } | dtach -p "$kak_opt_dtach_repl_id" + { printf '\n'; } | dtach -p "$kak_opt_dtach_repl_id" } } alias global repl-new dtach-repl - alias global repl-send-text dtach-send-text + alias global repl-send-text dtach-send-bracketed-text + alias global / dtach-send-bracketed-text } # Ide / connect @@ -107,7 +109,7 @@ define-command -override relative-cd %{ } } map global user c "<esc>:relative-cd<ret>" -map global user f "<esc>:> yazi<ret>" +map global user f "<esc>:evaluate-commands -try-client main %{ > yazi }<ret>" define-command find -params 1 %{ edit %arg{1} } complete-command -menu find shell-script-candidates %{ fd --type=f --hidden --exclude='.git**' } @@ -151,22 +153,33 @@ hook global WinSetOption filetype=latex %{ } } -hook -group kakrc-python-flat-lint global WinSetOption filetype=python %{ +hook -group kakrc-python-lint global WinSetOption filetype=python %{ set-option buffer lintcmd %{parallel "mypy --show-column-numbers {}" :::} } define-command -override python-package-lint-file -params 1..2 %{ + remove-hooks global kakrc-python-lint + set-option buffer lintcmd "parallel 'mypy --show-column-numbers %arg{1} | grep %reg{percent}; :' :::" evaluate-commands %sh{ - printf '%s\n' "set-option buffer lintcmd %{parallel 'mypy --show-column-numbers ${1:?} | grep ${2:-$kak_reg_percent}; :' :::}" +cat <<HOOK + hook -group kakrc-python-lint global WinSetOption filetype=python %{ + set-option buffer lintcmd "parallel 'mypy --show-column-numbers $1 | grep $kak_reg_percent; :' :::" + } +HOOK } } -# hook -group kakrc-python-package-lint global WinSetOption filetype=python %{ -# set-option buffer lintcmd %{parallel "mypy --show-column-numbers {}" :::} -# } hook global WinSetOption filetype=python %{ + map buffer user r %|<esc>:repl-send-text "b %val{buffile}:%val{cursor_line} ;; continue ;; clear -1 ;; f self.kind()"<ret>| + set-option buffer formatcmd 'ruff format -' hook buffer -group format BufWritePost .* format-but-write + map buffer user r %|<esc>:repl-send-text "b %val{cursor_line} ;; continue ;; clear -1"<ret>| + try %{ source ~/.config/kak/snippets.python.kak } + hook global BufWritePost snippets.python.kak %{ + echo "snippets written" + try %{ source ~/.config/kak/snippets.python.kak } + } } hook global WinSetOption filetype=terraform %{ diff --git a/.config/kak/snippets.python.kak b/.config/kak/snippets.python.kak new file mode 100644 index 0000000..5db5ecc --- /dev/null +++ b/.config/kak/snippets.python.kak @@ -0,0 +1,11 @@ +echo "sourced snippets" + +set buffer snippets_auto_expand 'true' +map buffer normal <a-f> ": phantom-selection-iterate-next<ret>" +map buffer normal <a-F> ": phantom-selection-iterate-prev<ret>" +map buffer insert <a-f> "<esc>: try phantom-selection-iterate-next<ret>i" +map buffer insert <a-F> "<esc>: try phantom-selection-iterate-prev<ret>i" + +set buffer snippets 'breakpoint' ';b' %{ + snippets-insert %@breakpoint()${}@ +} @@ -0,0 +1,7 @@ +alias edit import os; os.system(f"$EDITOR {$_frame.f_code.co_filename} +{$_frame.f_lineno}") +alias e edit +alias s step ;; edit +alias n next ;; edit +alias r return ;; edit +alias c continue ;; edit +alias f import subprocess as sub; import json; sub.run("jq | :f", shell=True, input=json.dumps(%1).encode()) |
