Last active
June 4, 2017 19:55
-
-
Save scriptingosx/2e84f8027d58bb64318fb93eda65f054 to your computer and use it in GitHub Desktop.
Sample bash_profile file for the article: http://wp.me/p69KII-64
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ENVIRONMENT VARIABLES | |
# add my ~/bin dir to path | |
PATH=${PATH}:~/bin | |
export PATH | |
# simple prompt | |
# default macOS prompt is: \h:\W \u\$ | |
export PS1="\W \$ " | |
# enable Terminal color | |
export CLICOLOR=1 | |
# set EDITOR to bbedit | |
if [[ -e "/usr/local/bin/bbedit" ]]; then | |
export EDITOR="bbedit -w --resume" | |
fi | |
# ALIASES | |
alias ll='ls -l' | |
alias lll='ls -alhTOe@' | |
alias ls='ls -l' | |
# save me from myself | |
alias rm="rm -i" | |
alias mv="mv -i" | |
alias cp="cp -i" | |
alias ..="cd .." | |
alias ...="cd ../.." | |
alias cd..="cd .." | |
# Ring the terminal bell, and badge Terminal's icon | |
alias badge="tput bel" | |
# insert an empty space in the Dock | |
alias dockspace="defaults write com.apple.dock persistent-apps -array-add '{\"tile-type\"=\"spacer-tile\";}'; killall Dock;" | |
alias reveal='open -R' | |
alias xcode='open -a Xcode' | |
alias pacifist='open -a Pacifist' | |
# FUNCTIONS | |
# man commands | |
# http://scriptingosx.com/2017/04/on-viewing-man-pages/ | |
function preman() { | |
man -t $@ | open -f -a "Preview" | |
} | |
function xmanpage() { | |
open x-man-page://$@ | |
} | |
function bbman () { | |
MANWIDTH=80 MANPAGER='col -bx' man $@ | bbedit --clean --view-top -t "man $@" | |
} | |
# prints the path of the front Finder window. Desktop if no window open | |
# http://scriptingosx.com/2017/02/terminal-finder-interaction/ | |
function pwdf () { | |
osascript <<EOS | |
tell application "Finder" | |
if (count of Finder windows) is 0 then | |
set dir to (desktop as alias) | |
else | |
set dir to ((target of Finder window 1) as alias) | |
end if | |
return POSIX path of dir | |
end tell | |
EOS | |
} | |
# changes directory to frontmost | |
alias cdf='pwdf; cd "$(pwdf)"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment