Tweak aliases and bash profile.

This commit is contained in:
Artem Sapegin 2012-10-15 15:00:57 +04:00
parent bdb80771c6
commit 1949caff33
3 changed files with 18 additions and 16 deletions

View File

@ -4,7 +4,7 @@ alias ...="cd ../.."
alias ....="cd ../../.." alias ....="cd ../../.."
alias .....="cd ../../../.." alias .....="cd ../../../.."
alias ~="cd ~" alias ~="cd ~"
alias -- -="cd -" alias -- -="cd -" # The alias is `-`, not `--`
# Shortcuts # Shortcuts
alias dr="cd ~/Dropbox" alias dr="cd ~/Dropbox"
@ -66,12 +66,18 @@ done
# Convert line endings to UNIX # Convert line endings to UNIX
alias dos2unix="perl -pi -e 's/\r\n?/\n/g' " alias dos2unix="perl -pi -e 's/\r\n?/\n/g' "
# Password generator
password() { openssl rand -base64 ${1:-8} | c; }
# Git root
alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`'
# NPM # NPM
alias npm-patch='npm version patch -m "%s"' alias npm-patch='npm version patch -m "%s"'
alias npm-release='npm version minor -m "%s"' alias npm-release='npm version minor -m "%s"'
# Grunt # Grunt
alias gw="grunt watch --debug" alias gw="grunt deploy --debug && grunt watch --debug"
ginit() { grunt init:$@; } ginit() { grunt init:$@; }
# Magic Project Opener # Magic Project Opener
@ -80,6 +86,5 @@ function repo { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1
function wptheme { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1 -w wptheme $2)"; } function wptheme { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1 -w wptheme $2)"; }
# Load external aliases # Load external aliases
source ~/dotfiles/includes/root.sh
source ~/dotfiles/includes/functions.sh source ~/dotfiles/includes/functions.sh

View File

@ -35,12 +35,18 @@ export PATH="$HOME/bin:/usr/local/bin:$PATH"
# Add brew coreutils to $PATH # Add brew coreutils to $PATH
command -v brew >/dev/null 2>&1 && export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH" command -v brew >/dev/null 2>&1 && export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
# Load ~/.extra, ~/.bash_prompt and ~/.bash_aliases
# ~/.extra can be used for settings you dont want to commit
for file in ~/.{extra,bash_prompt,bash_aliases}; do
[ -r "$file" ] && source "$file"
done
unset file
# If possible, add tab completion for many commands # If possible, add tab completion for many commands
[ -f /etc/bash_completion ] && source /etc/bash_completion [ -f /etc/bash_completion ] && source /etc/bash_completion
# Aliases and prompt # Bash completion (installed via Homebrew; source after `brew` is added to PATH)
[ -f ~/.bash_aliases ] && source ~/.bash_aliases command -v brew >/dev/null 2>&1 && [ -r "$(brew --prefix)/etc/bash_completion" ] && source "$(brew --prefix)/etc/bash_completion"
[ -f ~/.bash_prompt ] && source ~/.bash_prompt
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards # Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh [ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh

View File

@ -1,9 +0,0 @@
# Copyright 2009 Daniel Jackoway
# released under the MIT License
# see COPYING for the full text
function gitr {
while [ ! -d .git -a ! -f '.this_is_root' -a `pwd` != "/" ]
do
cd "..";
done
}