Skip to content

Instantly share code, notes, and snippets.

@akheron
Last active December 29, 2019 06:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akheron/61a01d597360c0187dc4 to your computer and use it in GitHub Desktop.
Save akheron/61a01d597360c0187dc4 to your computer and use it in GitHub Desktop.
My dotfiles: .gitconfig, .mailcap, .screenrc, .toprc, .tmux.conf
[alias]
st = status --short --branch
dc = diff --cached -M -B -C
typo = commit --amend
fixup = commit --amend --no-edit
logk = log --graph --pretty=\"format:%C(yellow)%h%C(red)%d%Creset %s %C(green)%an, %ar%Creset\"
ffpull = pull --ff-only
ffmerge = merge --ff-only
ri = "!f() { rev=$(git rev-parse $1 2>/dev/null) || rev=HEAD~$1; git rebase -i $rev; }; f"
rc = rebase --continue
ra = rebase --abort
rs = rebase --skip
ru = reset --hard @{upstream}
whoami = !echo \"$(git config --get user.name) <$(git config --get user.email)>\"
pushu = !git push --set-upstream origin $(git symbolic-ref --short HEAD)
[color]
ui = auto
[push]
default = simple
[rebase]
autosquash = true
[credential]
helper = cache
[merge]
conflictstyle = diff3
# Open in browser when viewing interactively
text/html; /usr/bin/chromium %s && sleep 1.5; description=HTML Text; nametemplate=%s.html
# Dump with w3cm and the correct encoding when viewing non-interactively
text/html; /usr/bin/w3m -dump -T text/html -I %{charset} -O utf-8 %s; copiousoutput; description=HTML Text; nametemplate=%s.html
image/png; sxiv '%s'; test=test -n "$DISPLAY"
image/jpeg; sxiv '%s'; test=test -n "$DISPLAY"
# Support non-standard image/jpg, too
image/jpg; sxiv '%s'; test=test -n "$DISPLAY"
application/pdf; evince '%s'; test=test -n "$DISPLAY"
application/x-pdf; evince '%s'; test=test -n "$DISPLAY"
# doc/docx
application/vnd.openxmlformats-officedocument.wordprocessingml.document; lowriter '%s'; test=test -n "$DISPLAY"
application/msword; lowriter '%s'; test=test -n "$DISPLAY"
# xlsx
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; localc '%s'; test=test -n "$DISPLAY"
# winmail.dat
application/ms-tnef; tnef -w %s
escape ^zz
startup_message off
hardstatus on
hardstatus string "%n: %t"
defscrollback 5000
vbell off
flow off
# disable lockscreen
bind x
bind ^x
# Keybindings
unbind C-b
set -g prefix C-z
bind z send-prefix
bind escape copy-mode
bind C-z last-window
bind p select-pane -t :.-1
bind n select-pane -t :.+1
set -g default-terminal linux
# Colors
set -g status-bg yellow
set -g status-fg black
set -g pane-active-border-style fg=yellow
set -g pane-active-border-style bg=yellow
# tmux-yank
set -g @yank_selection 'primary'
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
run '~/.tmux/plugins/tpm/tpm'
瑯瀧猠䍯湦楧⁆楬攠⡌楮畸⁰牯捥獳敳⁷楴栠睩湤潷猩੉携椬⁍潤敟慬瑳捲㴰Ⱐ䵯摥彩物硰猽ㄬ⁄敬慹彴業攽ㄮ㔰〬⁃畲睩渽《䑥昉晩敬摳捵爽ꔦ䮨뎴뮽䂷몹㔶쑆씧⤪⬬⴮⼰ㄲ㠼㸿䅂䍇䡉䩌䵎佐兒協啖坘奚孜嵞彠慢捤敦杨楪ਉ睩湦污杳㴱㤳〷㘬⁳潲瑩湤砽ㄸⰠ浡硴慳歳㴰Ⱐ杲慰桟捰畳㴰Ⱐ杲慰桟浥浳㴰ਉ獵浭捬爽ㄬ獧獣汲㴱Ⱐ桥慤捬爽㌬⁴慳正汲㴱੊潢०楥汤獣畲㶥ꚹ랺⢳듄뮽䀼Ʂ⤪⬬⴮⼰ㄲ㔶㠾㽁䉃䙇䡉䩋䱍乏偑剓呕噗塙婛屝幟恡扣摥晧桩樊ॷ楮晬慧猽ㄶ㌱㈴Ⱐ獯牴楮摸㴰Ⱐ浡硴慳歳㴰Ⱐ杲慰桟捰畳㴲Ⱐ杲慰桟浥浳㴰ਉ獵浭捬爽㘬獧獣汲㴶Ⱐ桥慤捬爽㜬⁴慳正汲㴶੍敭०楥汤獣畲㶥못㲽뺿상䵂仃䐳㒷씦✨⤪⬬⴮⼰ㄲ㔶㠹䙇䡉䩋䱏偑剓呕噗塙婛屝幟恡扣摥晧桩樊ॷ楮晬慧猽ㄶ㌱㈴Ⱐ獯牴楮摸㴲ㄬ慸瑡獫猽〬⁧牡灨彣灵猽㈬⁧牡灨彭敭猽《ॳ畭浣汲㴵Ⱐ浳杳捬爽㔬⁨敡摣汲㴴Ⱐ瑡獫捬爽㔊啳爉晩敬摳捵爽ꖦꞨꪰ릷뫄씩⬬⴮⼱㈳㐵㘸㬼㴾㽀䅂䍆䝈䥊䭌䵎佐兒協啖坘奚孜嵞彠慢捤敦杨楪ਉ睩湦污杳㴱㘳ㄲ㐬⁳潲瑩湤砽㌬慸瑡獫猽〬⁧牡灨彣灵猽㈬⁧牡灨彭敭猽《ॳ畭浣汲㴳Ⱐ浳杳捬爽㌬⁨敡摣汲㴲Ⱐ瑡獫捬爽㌊䙩硥摟睩摥獴㴰Ⱐ卵浭彭獣慬攽㈬⁔慳歟浳捡汥㴱Ⱐ婥牯彳異灲敳猽《
#!/bin/sh
# Only ttys have $WINDOWID set correctly? Firefox doesn't, anyway.
if ! which wmctrl >/dev/null 2>&1; then
me=`basename $0`
echo "$me: wmctrl not found; aborting." >&2
exit 1
fi
# Note that the exit in END is what determines the final exit status,
# even though the previous exit initiates the exit.
wmctrl -a :ACTIVE: -v 2>&1 \
| awk 'BEGIN { exit_status = 1 }
/^Using window:/ { print $3; exit_status = 0; exit }
END { exit exit_status }' \
|| exit 1
#!/bin/sh
# Save the current winid so we know what to switch back to from emacs.
client_winid=`current-winid`
# Switch to emacs and wait for editing to be completed.
wmctrl -xa emacs
/usr/bin/emacsclient -a fe "$@"
# Switch back to window from which emacsclient was invoked.
wmctrl -ia $client_winid
#!/bin/sh
usage() {
echo "usage: get-workspaces.sh OUTPUT"
echo ""
echo "Print the names of workspaces on the given output"
echo ""
exit 2
}
[ -z "$1" ] && usage
output=$(map-output.sh "$1")
i3-msg -t get_workspaces | python -c 'import json, sys; output = sys.argv[1]; print(" ".join(str(x["num"]) for x in json.load(sys.stdin) if x["output"] == output))' "$output"
#!/bin/sh
#
# Give descriptive names to your outputs
#
if [ "$1" == "dongle" ]; then echo DP1
elif [ "$1" == "dock" ]; then echo DP1-3
elif [ "$1" == "laptop" ]; then echo eDP1
else echo "$1"
fi
#!/bin/sh
set -e
usage() {
echo "usage: move-workspaces.sh OUTPUT WORKSPACE [WORKSPACE...]"
echo ""
echo "Moves workspaces with the given numbers to the given output"
echo ""
exit 2
}
[ -z "$1" ] && usage
output=$(map-output.sh "$1")
shift
[ -z "$1" ] && usage
while [ -n "$1" ]; do
i3-msg workspace "$1"
i3-msg move workspace to output "$output"
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment