-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path.functions
More file actions
23 lines (20 loc) · 689 Bytes
/
.functions
File metadata and controls
23 lines (20 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
function mkd {
mkdir -p "$@" && cd "$_";
}
# "alert" for long running commands. Use like so:
# sleep 10; alert
function alert {
local last_cmd_status="$?"
notify-send -u "$([ $last_cmd_status = 0 ] && echo low || echo critical)" "$([ $last_cmd_status = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e 's/^\s*[0-9]\+\s*//')"
}
## copy history command
function ch() {
local line
shopt -u nocaseglob nocasematch
line="$(history | \
command grep '^\s*[0-9][0-9]*\s\s*' | \
eval "$(__fzfcmd) +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r $FZF_CTRL_R_OPTS" | \
command sed 's/^\s*[0-9][0-9]*\s\s*//')"
echo -n "$line" | xsel -b
}