Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Feb 18, 2017
1 parent bd6b693 commit 9294475
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 124 deletions.
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
My dotfiles. Mostly `vim`, `tcsh`, and `mutt`.
My dotfiles.

`manage-dotfiles.py` is a tool to manage your dotfiles.

Expand Down
10 changes: 10 additions & 0 deletions _old/hg/hgrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
; $dotid$

[ui]
username = Martin Tournoij <martin@arp242.net>

[trusted]
users = martin, 1001

[tortoisehg]
editor = xterm -e vim
3 changes: 3 additions & 0 deletions _old/hg/module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
files = {
'~/.hgrc': 'hgrc'
}
2 changes: 1 addition & 1 deletion git/gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
mnemonicprefix = true

[push]
default = simple
default = current

[merge]
tool = vimdiff
Expand Down
11 changes: 6 additions & 5 deletions manage-dotfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,12 @@ def manage_files(files):
if os.path.exists(src):
with open(src, 'rb') as fp:
is_binary = False
try:
with open(dest, 'r') as testfp:
testfp.read()
except UnicodeDecodeError:
is_binary = True
if os.path.exists(dest):
try:
with open(dest, 'r') as testfp:
testfp.read()
except UnicodeDecodeError:
is_binary = True

if is_binary or b'\x00' in fp.read(2048) and os.path.exists(dest):
h1 = hashlib.sha256(open(src, 'rb').read()).hexdigest()
Expand Down
14 changes: 14 additions & 0 deletions vim/autocmd.vim
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,17 @@ fun! s:mail()
\| endif
augroup end
endfun

" Show formatting characters in insert mode
augroup help_start
autocmd!
autocmd FileType help call s:help()
augroup end

fun! s:help()
augroup help_insert
autocmd!
autocmd InsertEnter <buffer> setlocal conceallevel=0 | highlight clear Ignore
autocmd InsertLeave <buffer> setlocal conceallevel=2
augroup end
endfun
1 change: 1 addition & 0 deletions x11/pekwm/keys
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Global {

# External Commands
KeyPress = "Mod4 X" { Actions = "Exec xterm -lc -geometry 90x27" }
#KeyPress = "Mod4 D" { Actions = "Exec dmenu_run" }
KeyPress = "KP_Add" { Actions = "Exec /home/martin/Local/bin/find-cursor" }

# Pekwm control
Expand Down
101 changes: 18 additions & 83 deletions zsh/zsh/commands.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,17 @@ chpwd() {
print -Pn "\e]2;zsh: %~\a"
}

# precmd()
# preexec()

# zmv - a command for renaming files by means of shell patterns.
# Rename files with globbing, like DOS: "mv *.txt *.md"
autoload -U zmv

# zargs, as an alternative to find -exec and xargs.
autoload -U zargs

if [[ $uname = FreeBSD ]]; then
alias ls="ls-F -I"
alias la="ls-F -A"
alias lc="ls-F -lThoI"
alias lac="ls-F -lThoA"

# bsdgrep is FreeBSD >=9
# bsdgrep doesn't seem stable/reliable (yet)
#if exists bsdgrep; then
# alias grep="bsdgrep --color"
#else
alias grep="grep --color"
#fi
elif [[ $uname = OpenBSD ]]; then
if _exists colorls; then
alias ls="colorls -FG"
alias la="colorls -FGA"
alias lc="colorls -FGlTho"
alias lac="colorls -FGlThoA"
else
alias ls="ls -F"
alias la="ls -FA"
alias lc="ls -FlTho"
alias lac="ls -FAlTho"
fi
elif [[ $uname = Linux ]]; then
#unalias ls

# -N disabled retarded GNU shit of quoting the filenames (which is suddenly
# the default?!)
# No idea how compatible it is...
if [[ $uname = Linux ]]; then
alias ls='ls -FN --color'
alias l=ls

alias lc='ls -lh'
alias la='ls -A'
alias lac='ls -lhA'
alias lsd='ls -ld *(-/DN)'
alias lh='ls -d .*'
alias grep="grep --color"

alias sockstat="netstat -lnptu --protocol=inet,unix"
Expand All @@ -58,46 +23,36 @@ elif [[ $uname = Linux ]]; then
alias zzz=sudo pm-suspend
fi

# bsdtar/libarchive works with many file formats, not just tar
_exists bsdtar && alias tar=bsdtar

# Linux top is an unusable piece of shit after recent changes
_exists htop && alias top=htop
else
# These should work on almost any platform ...
alias la="ls -a"
alias lc="ls -l"
alias lac="ls -la"
fi

# Override the tcsh builtins
#if (-x /usr/bin/nice) then
# alias nice="/usr/bin/nice"
#elif (-x /bin/nice) then
# alias nice="/bin/nice"
#endif
#if (-x /usr/bin/time) alias time="/usr/bin/time -h"

# A few more aliases...
alias cp="cp -i"
alias mv="mv -i"
alias make="nice -n 20 make"
alias j="jobs -l"
alias lman="groff -man -Tascii" # `local man' <file>.1
alias rdiff="diff -urN -x CVS -x .svn -x .git -x .hg "
alias decolor="sed 's|\x1b\[[;0-9]*m||g'"
alias trcolor="sed -e 's|\x1b\[36m|\x1b\[31m|g'; 's|\x1b\[33m|\x1b\[31m|g'"

# Third-party stuff
_exists mpv && alias music="mpv $* *.{mp3,flac}"
alias ag='ag -S --color-match 31 --color-line-number 35 --color-path 1\;4'
alias youtube-dl='youtube-dl --no-part --title'
alias mplayer=mpv

if _exists drill; then
alias dig=drill
elif _exists dig; then
alias drill=dig
fi

alias ag='ag -S --color-match 31 --color-line-number 35 --color-path 1\;4'

# Use title in filename
alias youtube-dl='youtube-dl --no-part -t'
# CSH habit...
setenv() { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" }

# Typos
alias sl="ls"
Expand All @@ -109,30 +64,10 @@ alias iv="vi" # Some image viewer I never use, annoying
alias grpe="grep"
alias Grep="grep"
alias les=less
alias les=less
alias Less=less

# Visual separator
alias sep="echo '\033[1;34m=========================================\033[0m'"

# http://superuser.com/questions/380772/removing-ansi-color-codes-from-text-stream#380778
# man Term::ANSIColor
# http://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
# http://www.andrewnoske.com/wiki/Unix_-_ANSI_colors
alias decolor="sed 's|\x1b\[[;0-9]*m||g'"
alias trcolor="sed -e 's|\x1b\[36m|\x1b\[31m|g'; 's|\x1b\[33m|\x1b\[31m|g'"

# Until I can find/make a colour scheme that works
alias ipython='ipython --colors=NoColor --no-confirm-exit'

alias xvi=xvim
alias write="mlterm -e vim -c :WriteMode\ '&'"
alias vh='vim -c ':help $1' -c :only'
alias vims='vim -c ScratchBuffer'
alias vim-basic='vim -u ~/.vim/basic'
alias tclsh='rlwrap tclsh'

alias mplayer=mpv

alias rdiff="diff -urN -x CVS -x .svn -x .git -x .hg "

# Prettify JSON from clipboard
alias jsonpp='xclip -o | python -mjson.tool | xclip -i'
# Global aliases
alias -g /t='| tail'
alias -g /v='| vim -'
alias -g /l='| less'
35 changes: 12 additions & 23 deletions zsh/zsh/completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,28 @@ setopt alwaystoend # Move cursor to end of word when when completing f
setopt nolistambiguous # Show options on single tab press

# Load and init
autoload -Uz compinit && compinit
autoload -Uz compinit && compinit && zmodload zsh/complist
zstyle ':completion:*' completer _expand _complete _ignored

# Make completion case-insensitive
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
#zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'

# Always ignore these files
zstyle ':completion:*' ignored-patterns '*?.pyc' '*?.o'
# Always ignore these files/functions
zstyle ':completion:*:files' ignored-patterns '*?.pyc' '*?.o'
zstyle ':completion:*:functions' ignored-patterns '_*'

# Use menu
zstyle ':completion:*' menu select
# Show more info in some completions
zstyle ':completion:*' verbose yes

# Show warning when there are no completions
zstyle ':completion:*:warnings' format 'No completions'

# TODO:
# Shift+tab
# show help text in different colour or something
#


# -----

# Show colours
#zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}

#http://zsh.sourceforge.net/FAQ/zshfaq04.html#l46
# Show ls-like colours in file completion
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}

# Use menu
zstyle ':completion:*' menu select

#zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
#zstyle ':completion:*' menu select=2
#zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
#zstyle ':completion::complete:*' use-cache 1

#zstyle ':completion:*:descriptions' format '%U%F{cyan}%d%f%u'
# TODO:
# show help text in different colour or something
16 changes: 15 additions & 1 deletion zsh/zsh/keys.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,30 @@
bindkey -e

autoload -Uz up-line-or-beginning-search down-line-or-beginning-search edit-command-line
insert_sudo () { zle beginning-of-line; zle -U "sudo " }

zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
zle -N edit-command-line
zle -N up-line-or-beginning-search
zle -N insert-sudo insert_sudo

bindkey '^[[A' up-line-or-beginning-search # Arrow up
bindkey '^[[B' down-line-or-beginning-search # Arrow down
bindkey '^[[H' beginning-of-line # Home
bindkey '^[[1~' beginning-of-line # Home
bindkey '^[[F' end-of-line # End
bindkey '^[[4~' end-of-line # End
bindkey '^[[3~' delete-char # Delete
bindkey '^[[5~' up-line-or-history # Page up
bindkey '^[[6~' down-line-or-history # Page down
bindkey '^Xe' edit-command-line # ^Xe
bindkey '^[OP' run-help # F1
bindkey '^S' insert-sudo
bindkey '^I' complete-word # complete on tab, leave expansion to _expand
# Useful for going back in menu completion
bindkey '^[[Z' up-history # Shift+Tab

# Use this completion and start completion for new dir
bindkey -M menuselect '^o' accept-and-infer-next-history

#bindkey ' ' magic-space # also do history expansion on space
11 changes: 8 additions & 3 deletions zsh/zsh/settings.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
### Various
setopt nomatch # Show error if globbing fails
setopt notify # Report status of bg jobs immediately
unsetopt beep # Don't beep
setopt nohup # Don't kill background jobs when exiting
setopt noclobber # Don't clobber existing files with >
setopt printexitvalue # Show exit code if non-zero
# TODO: too noise; would prefer it to just print "Exit n"
#setopt printexitvalue # Show exit code if non-zero
unsetopt beep # Don't beep
unsetopt bgnice # Don't frob with nicelevels
unsetopt autoremoveslash # Too magic for my liking

#setopt extendedglob

# https://wiki.archlinux.org/index.php/Zsh#Dirstack
#setopt autopushd
#setopt pushdminus
#setopt pushdignoredups

# Disable ^S/^Q - I never use them and I can use those keys in Vim now
Expand All @@ -36,7 +40,8 @@ zstyle ':vcs_info:*' formats '(%b)'

set_prompt() {
vcs_info
echo "[%~]${vcs_info_msg_0_}%# "
# TODO: Ignore 130 (^C)
echo "%(?..%S %? %s)[%~]${vcs_info_msg_0_}%# "
}

set_rprompt() {
Expand Down
18 changes: 11 additions & 7 deletions zsh/zsh/zshrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
ZDOTDIR=~/.zsh
umask 022

_exists() { hash $1 2>/dev/null }
_exists uname && uname=$(uname) || uname=win32

prefix=0
if [[ -d /usr/pkg/bin ]]; then # NetBSD
prefix=/usr/pkg
elif [[ -d /usr/local/bin ]]; then # FreeBSD, OpenBSD
set prefix = /usr/local
fi
source ~/.zsh/env.zsh

_exists uname && uname=$(uname) || uname=win32
# Our work here is done if not an interactive shell
[[ -o zle ]] || exit 0

source ~/.zsh/settings.zsh
source ~/.zsh/completion.zsh
Expand All @@ -18,6 +16,12 @@ source ~/.zsh/keys.zsh

unfunction _exists

# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/dircycle/dircycle.plugin.zsh
# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/dirhistory/dirhistory.plugin.zsh
# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/dirpersist/dirpersist.plugin.zsh
# https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/tmux
source ~/.zsh/plugins/*.zsh

# We're ssh-ing into vagrant
if [[ -d /vagrant ]]; then
#cd /vagrant
Expand Down

0 comments on commit 9294475

Please sign in to comment.