ksh, git, vim, set_time
[dotfiles_afify.git] / .config / ksh / kshrc
blobf5a2e312e635d225fd549f60e86641c3c75aa1a0
1 #!/bin/ksh
3 alias k='clear'
4 alias mv='mv -i'
5 alias cp='cp -ir'
6 alias rm='rm -i'
7 alias mkdir='mkdir -p'
8 alias xc='xclip -sel clip'
9 alias fonts=" fc-list | sed 's/^.*: //' | awk -F: '{print $1}' | sort | uniq"
10 alias lsb="dmesg | egrep '^(cd|wd|sd|fd). at ' | sort | uniq"
11 alias sc="rsync -avzhe ssh --progress"
12 alias cpp="rsync -avzhe --progress"
13 alias val="valgrind --trace-children=yes --track-fds=yes --track-origins=yes --leak-check=full --show-leak-kinds=all -s"
14 alias wgetf="wget --tries=100 --continue --content-disposition --trust-server-names -i"
15 alias egyb=" cd ~/downloads && python /mnt/data/dev/archived/egybest_downloader/egybest_unix.py"
16 alias ya="youtube-dl -i --add-metadata -f bestaudio"
17 alias yv4="youtube-dl -i --add-metadata -f 'bestvideo[height<=480]+bestaudio/best[height<=480]'"
18 alias yv7="youtube-dl -i --add-metadata -f 'bestvideo[height<=720]+bestaudio/best[height<=720]'"
19 alias yvp4="yv4 -o \"%(autonumber)s-%(title)s.%(ext)s\""
20 alias yvp7="yv7 -o \"%(autonumber)s-%(title)s.%(ext)s\""
21 [ "$(uname)" = "OpenBSD" ] && alias ls='colorls -GA' || alias ls='ls --color=always -A'
22 [ "$(uname)" = "OpenBSD" ] && alias gr='grep -Inr' || alias gr='grep -Inr --color=always'
23 alias ll='ls -lh'
25 [ "$(id -u)" = 0 ] && col="9m" || col="24m"
26 export PS1="\[\033[38;5;$col\]\W \033[38;5;166m\]\$(git branch --show-current 2>/dev/null)\[\033[00m\] "
28 ex(){
29 [ -f "$1" ] && case $1 in
30 *.tar.bz2) tar xjf "$1";;
31 *.tar.gz) tar xzf "$1";;
32 *.tar.xz) tar xf "$1";;
33 *.tar.zst) tar -I zstd -xvf "$1";;
34 *.tar) tar xf "$1";;
35 *.tbz2) tar xjf "$1";;
36 *.tgz) tar xzf "$1";;
37 *.xz) xz -d "$1";;
38 *.bz2) bunzip2 "$1";;
39 *.rar) unrar x "$1";;
40 *.gz) gunzip "$1";;
41 *.zip) unzip "$1";;
42 *.7z) 7z x "$1";;
43 *.Z) uncompress "$1";;
44 *) echo "'$1' cannot be extracted.";;
45 esac
48 cf(){
49 cp /mnt/data/dev/openbsd_clang-format/.clang-format .
50 clang-format -style=file -i $1
51 rm -f .clang-format
54 g(){
55 gr "$1" | less -R
58 comp(){
59 dir=$(basename "$1")
60 [ -f "$1" ] || [ -d "$1" ] && tar -czvf "$dir.tar.gz" -C "$1/.." "$dir"
63 fixp(){
64 [ -f "$1" ] || [ -d "$1" ] &&
65 find "$1" -type d -exec chmod 700 {} \; &&
66 find "$1" -type f -exec chmod 600 {} \; &&
67 chown -R $USER "$1" && chgrp -R $USER "$1"