summaryrefslogtreecommitdiff
path: root/zsh/aliases
blob: 1c71ceafc0a9033ceb05ef1583445a51bb4794dc (plain)
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
alias grep='grep --color=auto'
alias lal='ls -la'

alias src='cd ~/src/'
alias s='src && ls'
alias gosrc='cd ~/src/go/src'
alias gs='gosrc && ls'

alias t='tmuxn'
alias tmuxn='tmux new -s'
alias ta='tmuxa'
alias tmuxa='tmux attach -d -t'
alias tls='tmux ls'

alias cb='xsel -bi; xsel -bo'

alias rsyncv='rsync -av --progress'

function psgrep {
    ps aux | grep -P "[^]]$1"
}

function pskill {
    PROCS=$(psgrep "$1")
    echo "$PROCS"
    echo "$PROCS" | awk '{print $2}' | xargs kill
}

# takes in a search regex and a replace string, and does a recursive
# find/replace inside the current directory. Safe to run on repos with .git
# folders and shit like that
function agsed {
    search="$1"
    replace="$2"
    files=$(ag "$search" -l0)
    echo -n "$files" | xargs -0 -n1 echo
    echo -n "$files" | xargs -0 sed -i "s/$search/$replace/g"
}