I'm a zsh user, but here's a couple of things I find pretty invaluable:-
bindkey '^Q' push-line
The 'push-line' widget allows you to quickly type another command and will restore the previous one once you've entered it. # re-run the previous command with sudo
rerun-with-sudo () {
LBUFFER="sudo !!"
zle accept-line
}
zle -N rerun-with-sudo
bindkey '^Xx' rerun-with-sudo
Re-run the previous command prefixed with sudo by typing ^X then x.And:-
# build git clone command from clipboard
git-clone-clipboard() {
REPO_URL="$($CLIPBOARD)"
REPO_BASE_NAME=${$(basename $REPO_URL)%.git}
LBUFFER="nocorrect git clone $REPO_URL $REPO_BASE_NAME"
}
zle -N git-clone-clipboard
bindkey "^Xg" git-clone-clipboard
^Xg prefixes a git url with "git clone" and fills out the command line.Couple similar things for wget, youtube-dl here: https://github.com/gaving/dotfiles/blob/master/.zsh/config