From 2724557621405887c978c23e3ed85876def76f1d Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Sat, 21 Jun 2025 15:21:32 -0400 Subject: [PATCH] AutoYADM commit: 2025-06-21 15:21:32 --- .config/kak/autoload/rename.kak | 18 ++++++++++++++---- .config/kak/autoload/sh.kak | 3 +++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.config/kak/autoload/rename.kak b/.config/kak/autoload/rename.kak index 7e40c271..c07769ca 100644 --- a/.config/kak/autoload/rename.kak +++ b/.config/kak/autoload/rename.kak @@ -7,6 +7,7 @@ define-command -docstring %{ rm "$old" } } +complete-command move-file file alias global mv move-file define-command -docstring %{ @@ -23,8 +24,14 @@ define-command -docstring %{ } alias global rf rename-file -define-command -params 0..2 remove-file %{ - eval %sh{ +define-command -docstring %{ + remove-file [] []: remove the file from the filesystem + and close the buffer. Omit to remove the current file. + Switches: + -f remove even if buffer has unsaved changes + +} -params 0..2 remove-file %{ + evaluate-commands %sh{ if [ "$1" = "-f" ]; then force="true" shift @@ -40,12 +47,15 @@ define-command -params 0..2 remove-file %{ if [ "$force" != "true" ]; then echo "fail 'Refusing to remove modified buffer without -f switch.'" else - echo "delete-buffer! $targ_bname" >$kak_command_fifo + echo "try %{ delete-buffer! $targ_bname }" >$kak_command_fifo rm "$targ" fi else - echo "delete-buffer $targ_bname" >$kak_command_fifo + echo "try %{ delete-buffer $targ_bname }" >$kak_command_fifo rm "$targ" fi } } + +alias global rm remove-file +complete-command remove-file file diff --git a/.config/kak/autoload/sh.kak b/.config/kak/autoload/sh.kak index 34c03103..a5a73da6 100644 --- a/.config/kak/autoload/sh.kak +++ b/.config/kak/autoload/sh.kak @@ -43,3 +43,6 @@ alias global sh shell-command alias global sh& shell-async-command alias global ! shell-command alias global !& shell-async-command + +complete-command shell-command shell +complete-command shell-async-command shell