mirror of
https://github.com/occivink/kakoune-sudo-write
synced 2025-04-02 22:40:36 +02:00
Don't rely on delete-buffer taking us to the previous buffer
This doesn't work in a draft context.
This commit is contained in:
parent
f43b341bd3
commit
f9bbf4606b
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
define-command -hidden sudo-write-impl %{
|
define-command -hidden sudo-write-impl %{
|
||||||
eval -save-regs f %{
|
eval -save-regs f %{
|
||||||
|
# TOOD this could take the content of the buffer from stdin instead
|
||||||
reg f %sh{ mktemp --tmpdir XXXXX }
|
reg f %sh{ mktemp --tmpdir XXXXX }
|
||||||
write %reg{f}
|
write %reg{f}
|
||||||
eval %sh{
|
eval %sh{
|
||||||
@ -18,18 +19,21 @@ define-command -hidden sudo-write-impl %{
|
|||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden -params 1 sudo-cache-password %{
|
define-command -hidden -params 1 sudo-cache-password %{
|
||||||
eval -save-regs '"' -no-hooks -draft %{
|
eval -no-hooks -save-regs '"c' %{
|
||||||
edit -scratch *sudo_write_pass*
|
eval -draft %{
|
||||||
|
edit -scratch *sudo-write-pass*
|
||||||
reg '"' %arg{1}
|
reg '"' %arg{1}
|
||||||
exec "<a-p>|sudo -S echo ok<ret>"
|
exec "<a-p>|sudo -S echo ok<ret>"
|
||||||
try %{
|
try %{
|
||||||
exec <a-k>ok<ret>
|
exec '%H<a-k>ok<ret>'
|
||||||
delete-buffer
|
reg c nop
|
||||||
} catch %{
|
} catch %{
|
||||||
delete-buffer
|
reg c fail
|
||||||
fail
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete-buffer *sudo-write-pass*
|
||||||
|
eval %reg{c}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden sudo-prompt-password %{
|
define-command -hidden sudo-prompt-password %{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user