Merge branch 'master' of github.com:meatballhat/dotfiles

This commit is contained in:
Dan Buch 2017-07-02 08:59:32 -04:00
commit e14d0ae694
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7
7 changed files with 368 additions and 95 deletions

View File

@ -51,52 +51,14 @@
untracked = cyan
[alias]
a = add
ad = add
addd = add
br = branch
bra = branch -a
brr = branch -r
ci = commit
co = checkout
d = diff
dc = diff --cached
di = diff
dif = diff
l = ls-files
ls = ls-files
nuke = clean -dfx
pr = pull --rebase
s = status --short
st = status
sta = stash
stcq = diff --cached --name-only
stq = diff --name-only
t = tag
ta = tag
tags = tag
slog = log git-svn..
sup = svn fetch --all
spush = svn dcommit
srb = rebase git-svn
rpo = remote prune origin
cm = checkout master
lm = log master..
rt = rebase trunk
lt = log trunk..
ct = checkout svn/trunk
logv = log --name-status
hug = blame
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
[commit]
template = ~/.gittemplate
gpgsign = true
[tag]
gpgsign = true
[gpg]
program = gpg2

2
htoprc
View File

@ -15,7 +15,7 @@ highlight_threads=1
tree_view=1
header_margin=1
detailed_cpu_time=1
color_scheme=1
color_scheme=5
delay=15
left_meters=AllCPUs CPU Memory Swap
left_meter_modes=1 1 1 1

136
i3/config Normal file
View File

@ -0,0 +1,136 @@
set $mod Mod4
font pango:DejaVu Sans Mono 12
exec "setxkbmap -layout dvorak"
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec xfce4-terminal
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
bindsym XF86AudioMicMute exec pactl set-source-mute 1 toggle
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
status_command "i3status | python ~/.i3wrapper.py"
}

64
i3status.conf Normal file
View File

@ -0,0 +1,64 @@
# vim:filetype=i3
general {
colors = true
interval = 5
output_format = "i3bar"
}
order += "volume master"
order += "disk /"
order += "disk /home"
order += "wireless _first_"
order += "battery 0"
order += "battery 1"
order += "cpu_usage"
order += "load"
order += "tztime local"
order += "tztime utc"
volume master {
format = "♪:%volume"
format_muted = "♪:muted (%volume)"
device = "default"
mixer = "Master"
mixer_idx = 0
}
disk "/" {
format = "/ %avail"
}
disk "/home" {
format = "/home %avail"
}
wireless _first_ {
format_up = "W:(%quality %essid) %ip"
format_down = "W:down"
}
battery 0 {
format = "0⚡%status %percentage"
}
battery 1 {
format = "1⚡%status %percentage"
}
cpu_usage {
format = "❤️%usage"
}
load {
format = "%1min"
}
tztime local {
format = "%Y-%m-%d %H:%M:%S"
}
tztime utc {
format = "%H:%M:%S UTC"
timezone = "UTC"
}

85
i3wrapper.py Executable file
View File

@ -0,0 +1,85 @@
#!/usr/bin/env python
import sys
import json
_BITS = []
def _bit(idx):
def wrapper(func):
_BITS.append([idx, func.__name__.replace('_', ''), func])
return func
return wrapper
@_bit(6)
def _mem():
with open('/proc/meminfo') as meminfo_fp:
attrs = {}
for line in meminfo_fp.readlines():
parts = line.split(':', 2)
attrs[parts[0].strip()] = parts[1].strip()
avail = int(attrs['MemAvailable'].split()[0])
total = int(attrs['MemTotal'].split()[0])
used = int(((total - avail) / total) * 100)
color = None
if used > 75:
color = '#ff0000'
if used < 25:
color = '#00ff00'
return 'M:{}%'.format(used), color
@_bit(0)
def _backlight(dev_dir='/sys/class/backlight/intel_backlight'):
with open('{}/brightness'.format(dev_dir)) as br_fp:
with open('{}/max_brightness'.format(dev_dir)) as mb_fp:
value = int(br_fp.read().strip())
max_value = int(mb_fp.read().strip())
pct = int(float(float(value) / float(max_value)) * 100)
color = None
if pct >= 75:
color = '#ffaa00'
if pct <= 25:
color = '#5599ff'
return '☼:{}%'.format(pct), color
def _print_line(message):
sys.stdout.write(message + '\n')
sys.stdout.flush()
def _read_line():
try:
line = sys.stdin.readline().strip()
if not line:
sys.exit(3)
return line
except KeyboardInterrupt:
sys.exit()
def main(bits=_BITS):
_print_line(_read_line())
_print_line(_read_line())
while True:
line, prefix = _read_line(), ''
if line.startswith(','):
line, prefix = line[1:], ','
loaded = json.loads(line)
for idx, name, func in bits:
value, color = func()
record = dict(full_text=str(value), name=name)
if color is not None:
record.update(dict(color=color))
loaded.insert(idx, record)
_print_line(prefix+json.dumps(loaded))
if __name__ == '__main__':
main()

View File

@ -1,7 +1,8 @@
# vim:filetype=zsh
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
PROMPT='$(date -u +%Y-%m-%dT%H:%M:%S) ${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}🙀 %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}!%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"

129
zshrc
View File

@ -28,33 +28,33 @@ COMPLETION_WAITING_DOTS="true"
# DISABLE_UNTRACKED_FILES_DIRTY="true"
plugins=(
autoenv
aws
bundler
cabal
command-not-found
cp
docker
gem
git
git-hubflow
golang
heroku
hk
knife
osx
pip
postgres
python
rails
rake-fast
rbenv
redis-cli
rsync
ruby
tmux
vagrant
vi-mode
autoenv
aws
bundler
cabal
command-not-found
cp
docker
gem
git
git-hubflow
golang
heroku
hk
knife
osx
pip
postgres
python
rails
rake-fast
rbenv
redis-cli
rsync
ruby
tmux
vagrant
vi-mode
)
fpath=(/usr/local/share/zsh/site-functions $fpath)
@ -63,6 +63,8 @@ source $ZSH/oh-my-zsh.sh
unalias gb
export VISUAL=vim
# The completion for aws is not compatible with $fpath :scream_cat:
if [[ -f /usr/local/share/zsh/site-functions/_aws ]] ; then
source /usr/local/share/zsh/site-functions/_aws
@ -72,19 +74,22 @@ unsetopt correct_all
bindkey '^R' history-incremental-search-backward
path=(
$HOME/bin
$HOME/go/bin
$HOME/.rbenv/bin
$HOME/.rbenv/shims
$HOME/.phpenv/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
$HOME/bin
$HOME/go/bin
$HOME/.rbenv/bin
$HOME/.rbenv/shims
$HOME/.phpenv/bin
$HOME/perl5/bin
$HOME/code/trvs/bin
/usr/local/sbin
/usr/local/bin
/usr/bin/vendor_perl
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
)
if which pyenv >/dev/null; then
@ -96,7 +101,7 @@ if which phpenv >/dev/null; then
eval "$(phpenv init - 2>/dev/null)"
fi
eval "$(gimme 1.8.1)" 2>/dev/null
eval "$(gimme 1.8.3)" 2>/dev/null
export GOPATH="$HOME/go"
CDPATH="$HOME/code:$HOME/src:$HOME/Development/src:$HOME/repos"
@ -107,21 +112,41 @@ done
export GPG_TTY=$(tty)
function dump-ssh-agent() {
env | awk '/SSH/ {
sub(/=/, "=\"", $1)
sub(/$/, "\"", $1)
print "export " $1
}' | tee ~/.ssh/agent.out
env | awk '/SSH/ {
sub(/=/, "=\"", $1)
sub(/$/, "\"", $1)
print "export " $1
}' | tee ~/.ssh/agent.out
}
function load-ssh-agent() {
source ~/.ssh/agent.out
source ~/.ssh/agent.out
}
[[ -e ~/.zshenv ]] && source ~/.zshenv
function start-ssh-agent() {
ssh-agent >~/.ssh/agent.out
}
function __maybesource() {
if [[ -f "${1}" ]]; then
source "${1}"
fi
}
load-ssh-agent &>/dev/null
__maybesource ~/.zshenv
__maybesource ~/.travis/travis.sh
__maybesource ~/google-cloud-sdk/path.zsh.inc
__maybesource ~/google-cloud-sdk/completion.zsh.inc
__maybesource /usr/share/nvm/init-nvm.sh
if [[ -f ~/perl5/lib/perl5/local/lib.pm ]]; then
eval "$(perl -I ~/perl5/lib/perl5 '-Mlocal::lib')"
fi
if trvs version &>/dev/null; then
eval "$(trvs init -)"
fi
[ -f ~/.travis/travis.sh ] && source ~/.travis/travis.sh
[ -f ~/google-cloud-sdk/path.zsh.inc ] && source ~/google-cloud-sdk/path.zsh.inc
[ -f ~/google-cloud-sdk/completion.zsh.inc ] && source ~/google-cloud-sdk/completion.zsh.inc
[ -f ~/code/trvs/bin/trvs ] && eval "$(~/code/trvs/bin/trvs init -)"
true