Added bash command wrapping (expand git numbered args for common bash commands, such as cp, mv, rm, etc.). Also set kb shortcuts to true by default.
This commit is contained in:
@@ -76,8 +76,12 @@ git_show_alias="gsh"
|
|||||||
# Git Keyboard Shortcuts
|
# Git Keyboard Shortcuts
|
||||||
# ---------------------------------------------
|
# ---------------------------------------------
|
||||||
# Keyboard shortcuts are off by default. Set this to 'true' to enable them.
|
# Keyboard shortcuts are off by default. Set this to 'true' to enable them.
|
||||||
git_keyboard_shortcuts_enabled="false"
|
git_keyboard_shortcuts_enabled="true"
|
||||||
git_status_shortcuts_keys="\C- " # CTRL+SPACE
|
|
||||||
git_commit_all_keys="\C-x " # CTRL+x, SPACE
|
git_commit_all_keys="\C-x " # CTRL+x, SPACE
|
||||||
git_add_and_commit_keys="\C-xc" # CTRL+x, c
|
git_add_and_commit_keys="\C-xc" # CTRL+x, c
|
||||||
|
|
||||||
|
|
||||||
|
# Bash Command Wrapping
|
||||||
|
# ---------------------------------------------
|
||||||
|
# Expand numbered args for common bash commands
|
||||||
|
bash_command_wrapping_enabled="true"
|
||||||
|
|||||||
@@ -155,11 +155,10 @@ _bind(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# If keyboard shortcuts are enabled
|
# Keyboard shortcuts for commits
|
||||||
if [[ "$git_keyboard_shortcuts_enabled" = "true" ]]; then
|
if [[ "$git_keyboard_shortcuts_enabled" = "true" ]]; then
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
xterm*|rxvt*)
|
xterm*|rxvt*)
|
||||||
_bind "$git_status_shortcuts_keys" " git_status_shortcuts\n"
|
|
||||||
_bind "$git_commit_all_keys" " git_commit_all\n"
|
_bind "$git_commit_all_keys" " git_commit_all\n"
|
||||||
_bind "$git_add_and_commit_keys" "\e[1~ git_add_and_commit \n"
|
_bind "$git_add_and_commit_keys" "\e[1~ git_add_and_commit \n"
|
||||||
|
|
||||||
@@ -170,3 +169,10 @@ if [[ "$git_keyboard_shortcuts_enabled" = "true" ]]; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Bash command wrapping
|
||||||
|
# (Tested with RVM's cd() wrapper)
|
||||||
|
if [[ "$bash_command_wrapping_enabled" = "true" ]]; then
|
||||||
|
for cmd in vim cd rm cp mv ln; do
|
||||||
|
alias $cmd="exec_git_expand_args $cmd"
|
||||||
|
done
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user