From 631f77f852822387c1e10753dd93f57992b9bae8 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 28 May 2013 23:32:51 -0400 Subject: [PATCH] For when you forget sudo --- .functions | 9 +++++++-- .zshrc | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.functions b/.functions index 5d465ce..e4f5381 100644 --- a/.functions +++ b/.functions @@ -7,7 +7,12 @@ function g { } compdef g=git -function port-forward { - ssh $1 -R $2":localhost:"$2 -g; +insert-sudo() { + zle beginning-of-line + zle -U "sudo " +} + +function port-forward { + ssh $1 -R $2":localhost:"$2 -g } diff --git a/.zshrc b/.zshrc index 23a72ce..736a4aa 100644 --- a/.zshrc +++ b/.zshrc @@ -72,6 +72,10 @@ PATH=$PATH:$HOME/bin # Customize to your needs... +# Bind insert_sudo function +zle -N insert-sudo +bindkey "^z" insert-sudo + # make 256colors work maybe if [ $TERM="xterm" ]; then export TERM=xterm-256color