AutoYADM commit: 2025-06-21 15:21:32

This commit is contained in:
Daniel Fichtinger 2025-06-21 15:21:32 -04:00
parent 00c70d3feb
commit 2724557621
2 changed files with 17 additions and 4 deletions

View file

@ -7,6 +7,7 @@ define-command -docstring %{
rm "$old" rm "$old"
} }
} }
complete-command move-file file
alias global mv move-file alias global mv move-file
define-command -docstring %{ define-command -docstring %{
@ -23,8 +24,14 @@ define-command -docstring %{
} }
alias global rf rename-file alias global rf rename-file
define-command -params 0..2 remove-file %{ define-command -docstring %{
eval %sh{ remove-file [<switches>] [<name>]: remove the file from the filesystem
and close the buffer. Omit <name> 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 if [ "$1" = "-f" ]; then
force="true" force="true"
shift shift
@ -40,12 +47,15 @@ define-command -params 0..2 remove-file %{
if [ "$force" != "true" ]; then if [ "$force" != "true" ]; then
echo "fail 'Refusing to remove modified buffer without -f switch.'" echo "fail 'Refusing to remove modified buffer without -f switch.'"
else else
echo "delete-buffer! $targ_bname" >$kak_command_fifo echo "try %{ delete-buffer! $targ_bname }" >$kak_command_fifo
rm "$targ" rm "$targ"
fi fi
else else
echo "delete-buffer $targ_bname" >$kak_command_fifo echo "try %{ delete-buffer $targ_bname }" >$kak_command_fifo
rm "$targ" rm "$targ"
fi fi
} }
} }
alias global rm remove-file
complete-command remove-file file

View file

@ -43,3 +43,6 @@ alias global sh shell-command
alias global sh& shell-async-command alias global sh& shell-async-command
alias global ! shell-command alias global ! shell-command
alias global !& shell-async-command alias global !& shell-async-command
complete-command shell-command shell
complete-command shell-async-command shell