-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_aliases_macos
50 lines (46 loc) · 1.83 KB
/
.bash_aliases_macos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# An "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='terminal-notifier -message "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
if command -v gls &>/dev/null; then
# EXPERIMENT: alias `ls` to GNU `ls`
alias ls='gls -F --group-directories-first --color=auto'
alias ll="ls -hl --time-style='+%F %T'"
else
# macOS's `ls` does not offer `--group-directories-first` or any
# alternative
alias ls='ls -F --color=auto'
# macOS's `ls` offers `-D` instead of `--time-style`
alias ll="ls -hl -D '%F %T'"
fi
# Like `ll`, but do not list group information
alias lo="ll -o"
# Like `ll`, but do not list group information and owner
alias lgo='lo -g'
# Like `ll`, but show hidden files and sort everything by time, newest first
alias lhat='ll -at'
alias ggrep='ggrep --color=auto'
alias ggrepc='ggrep --color=always'
alias ggrepn='ggrep --color=never'
# If [trash](https://hasseg.org/trash/) is installed, use `-F` option by default:
# > -F Ask Finder to move the files to the trash, instead of
# > using the system API.
#
# Otherwise, if using the system API, the "put back" feature (restoring files
# from trash) does *NOT* work.
if command -v trash &>/dev/null && trash | grep -Fq -- 'Ali Rantakari'; then
alias trash='trash -F'
fi
if command -v nowplaying-cli &>/dev/null; then
# `nowplaying-cli` prints the result in separate lines, so we `paste` it to
# the same line;
# YouTube often appends ` - Topic` to the artist's name, so we remove it;
#
# Example results:
# ```
# Monuments:Nefarious
# Monuments:False Providence (feat. Mick Gordon)
# Linkin Park:Don't Stay - Live In Texas
# HEALTH:MAX: PANAMA
# ```
alias np="nowplaying-cli get artist title | paste -d':' - - | sed 's@ - Topic@@'"
fi