From 076e1d13f76ae08b75d9fbae26a8d13ceb8fa560 Mon Sep 17 00:00:00 2001 From: alvinlollo <143326475+alvinlollo@users.noreply.github.com> Date: Tue, 11 Nov 2025 19:00:21 +1100 Subject: [PATCH] Implement sudo last command execution with Control + U Add functionality to execute the last command with sudo using Control + U. --- configs/.zshrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/configs/.zshrc b/configs/.zshrc index 7d14c11..c71887c 100644 --- a/configs/.zshrc +++ b/configs/.zshrc @@ -109,6 +109,18 @@ update () { } +# Sudo last command with control + u + +zle -N sudo-last-command-execute +sudo-last-command-execute() { + + zle -U $'sudo !!\n' + +} + +# Bind the widget to Control+U +bindkey '^U' sudo-last-command-execute + # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder.