commit b470f707e789a799ed0bc4088712c8d6a9b82cae
parent c55b10570767ef81feb2174031775b028afb7fee
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Tue, 10 Sep 2019 10:03:58 +0200
Clean up commands and remove locale sourcing in zshrc
Diffstat:
M | .commands.sh | | | 102 | ++++++++++--------------------------------------------------------------------- |
M | .zshrc | | | 1 | - |
2 files changed, 12 insertions(+), 91 deletions(-)
diff --git a/.commands.sh b/.commands.sh
@@ -1,9 +1,5 @@
#!/bin/sh
-#### FUNCTIONS AND ALIASES
-
-alias b='bash'
-alias z='zsh'
alias e='$EDITOR'
alias se='sudo $EDITOR'
alias n='$FILE'
@@ -12,28 +8,18 @@ alias youtube-dl='youtube-dl -f bestvideo+bestaudio/best --all-subs --embed-subs
alias xq="xbps-query"
alias xr="sudo xbps-remove"
-## cd
alias cg='c "$(git rev-parse --show-toplevel)"' # cd under git repo
-alias ch='cd "$(dirs -lp | sort -u | fzy)"' # cd from history
-
-# change to directory under pwd
+alias ch='cd "$(dirs -lp | sort -u | fzy)"' # cd from history
c() {
dir
dir=$(find "${1:-.}" -type d | grep -v '/\.' | fzf)
[ -d "$dir" ] && cd "$dir" || return
}
-## ls
-if [ "$(uname)" != 'Darwin' ]; then
- alias ls='ls --color=auto -F'
-else
- alias ls='ls -G -F'
-fi
+alias ls='ls -F'
alias l='ls -alFh'
-alias la='ls -A'
-## Open files
-o() {
+O() {
[ "$(uname)" = 'Darwin' ] && open="open" || open="xdg-open"
if [ "$#" -gt 0 ] && [ -f "$1" ]; then
setsid $open "$1" >/dev/null 2>&1
@@ -57,20 +43,14 @@ o() {
fi
}
-## dotfiles
alias dotfiles="git --git-dir=\$HOME/.dotfiles/ --work-tree=\$HOME"
-alias dotfiles-commit="dotfiles commit -a -S -v ; dotfiles push"
-
-## python
-alias ipython-prof='ipython -m cProfile -s time'
-alias python-prof='python -m cProfile -s time'
+alias dotfiles-commit="dotfiles commit -a -S -v; dotfiles push"
-## make
alias m="make"
alias mc="make clean"
alias me="make edit"
+alias mi="sudo make install"
-## date
alias date-denmark='TZ=Europe/Copenhagen date'
alias date-eastern='TZ=US/Eastern date'
alias date-pacific='TZ=US/Pacific date'
@@ -80,9 +60,7 @@ alias date-alaska='TZ=US/Alaska date'
alias date-uk='TZ=Europe/London date'
alias date-israel='TZ=Israel date'
-## git
alias gs='git status | less'
-#alias gl='git log --graph --oneline --decorate --all'
alias ga='git add'
alias gd='git diff --'
alias gch='git diff HEAD^..HEAD'
@@ -92,8 +70,6 @@ alias gp='git push'
alias gpu='git pull && git fetch --all'
alias gcgp='git commit --verbose --gpg-sign && git push'
alias gcagp='git commit --all --verbose --gpg-sign && git push'
-
-# redefine git log alias
alias gl="git log --graph --oneline --decorate --all --color=always |
fzf --ansi +s --preview='git show --color=always {2}' \
--bind='pgdn:preview-page-down' \
@@ -101,31 +77,10 @@ alias gl="git log --graph --oneline --decorate --all --color=always |
--bind='enter:execute:git show --color=always {2} | less -R' \
--bind='ctrl-x:execute:git checkout {2} .'"
-## grep
-alias grep='grep --color=auto'
-
-## speech synthesis
-if [ "$(uname)" != 'Darwin' ]; then
- say() { echo "$@" | festival --tts; }
- sayfile() { festival --tts "$@"; }
-else
- sayfile() { say -f "$@"; }
-fi
-
-## w3m
alias w3m="w3m -B"
-w3mtor() {
- if [ $# -eq 0 ]; then
- url="https://check.torproject.org/"
- else
- url="$1"
- fi
- torify w3m "$url"
-}
-
-w3mddg() { torify surfraw ddg "$@"; }
+alias w3mtor='torsocks w3m -B "$@"'
-news() {
+news() {
if [ $# -eq 0 ]; then
url="https://text.npr.org"
elif [ "$1" = "npr" ]; then
@@ -137,48 +92,18 @@ news() {
fi
torsocks w3m "$url"
}
-
-## web services
weather() { curl "wttr.in/?m"; }
-transfer() { # use transfer.sh to share files over the net
- if [ $# -eq 0 ]; then
- echo "No arguments specified. Usage: transfer.sh <file>"
- return 1
- fi
- tmpfile=$( mktemp -t transferXXX )
- if tty -s; then
- basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
- curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" \
- >> "$tmpfile"
- else
- curl --progress-bar --upload-file "-" "https://transfer.sh/$1" \
- >> "$tmpfile"
- fi
- cat "$tmpfile"
- rm -f "$tmpfile"
- echo ""
-}
-t_add() {
- transmission-remote --add --download-dir "$PWD" --encryption-required "$@"
-}
-t_list() {
- transmission-remote --list
-}
-t_stop() {
- transmission-remote --torrent "$@" --stop
-}
+t_add() { transmission-remote --add --download-dir "$PWD" --encryption-required "$@" }
+t_list() { transmission-remote --list }
+t_remove() { transmission-remote --torrent "$@" --remove }
+t_remove_all() { transmission-remote -tall --remove }
+t_stop() { transmission-remote --torrent "$@" --stop }
t_stop_idle() {
for id in $(t-list | grep Done | grep Idle | awk '{ print $1 }' | tr '\n' ','); do
t-stop "$id"
done
}
-t_remove() {
- transmission-remote --torrent "$@" --remove
-}
-t_remove_all() {
- transmission-remote -tall --remove
-}
m_all_sl() {
for d in ~/.local/lib/dwm ~/.local/lib/st ~/.local/lib/surf \
@@ -220,6 +145,3 @@ man9() {
f="$plan9mans/${1}.1"
[ -e "$f" ] && man "$f"
}
-
-# shellcheck source=/dev/null
-[ -f ~/.shortcuts ] && . ~/.shortcuts
diff --git a/.zshrc b/.zshrc
@@ -232,7 +232,6 @@ _fzf_complete_pass() {
}
. ~/.commands.sh
-. ~/.locale
[ -f /usr/share/fzf/key-bindings.zsh ] && \
. /usr/share/fzf/key-bindings.zsh ] || :