From e6a2618400edcddc2a80ef2776871ca01992be03 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Sat, 6 Feb 2021 13:39:13 -0600 Subject: big refactor to use XDG base dir spec --- .gitignore | 1 + README.md | 29 +++++-------- config/dircolors.conf | 91 +++++++++++++++++++++++++++++++++++++++ config/git/config | 38 ++++++++++++++++ config/git/ignore | 11 +++++ config/tmux/tmux.conf | 55 +++++++++++++++++++++++ config/zsh/.zshrc | 3 ++ config/zsh/appearance.zsh | 73 +++++++++++++++++++++++++++++++ config/zsh/behavior.zsh | 65 ++++++++++++++++++++++++++++ config/zsh/completion.zsh | 52 ++++++++++++++++++++++ config/zsh/function-overrides.zsh | 8 ++++ config/zsh/key-bindings.zsh | 6 +++ config/zsh/zshrc | 17 ++++++++ config/zsh/zshrc-local | 23 ++++++++++ deploy.sh | 25 +++++------ dircolors.conf | 91 --------------------------------------- gitconfig | 38 ---------------- gitignore | 11 ----- gvimrc | 6 --- xdg-config/tmux/tmux.conf | 55 ----------------------- zsh/appearance.zsh | 73 ------------------------------- zsh/behavior.zsh | 65 ---------------------------- zsh/completion.zsh | 52 ---------------------- zsh/functions.zsh-overrides | 8 ---- zsh/key-bindings.zsh | 6 --- zshenv | 1 + zshrc | 17 -------- 27 files changed, 468 insertions(+), 452 deletions(-) create mode 100644 config/dircolors.conf create mode 100644 config/git/config create mode 100644 config/git/ignore create mode 100644 config/tmux/tmux.conf create mode 100644 config/zsh/.zshrc create mode 100644 config/zsh/appearance.zsh create mode 100644 config/zsh/behavior.zsh create mode 100644 config/zsh/completion.zsh create mode 100644 config/zsh/function-overrides.zsh create mode 100644 config/zsh/key-bindings.zsh create mode 100644 config/zsh/zshrc create mode 100644 config/zsh/zshrc-local delete mode 100644 dircolors.conf delete mode 100644 gitconfig delete mode 100644 gitignore delete mode 100644 gvimrc delete mode 100644 xdg-config/tmux/tmux.conf delete mode 100644 zsh/appearance.zsh delete mode 100644 zsh/behavior.zsh delete mode 100644 zsh/completion.zsh delete mode 100644 zsh/functions.zsh-overrides delete mode 100644 zsh/key-bindings.zsh create mode 100644 zshenv delete mode 100644 zshrc diff --git a/.gitignore b/.gitignore index 8367412..ae7bd22 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ vim/ dotfiles-backup +xdg-config/zsh/zshrc-local diff --git a/README.md b/README.md index 75f3172..3eef288 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,16 @@ -You're going to want to make changes, so before you do anything, fork this repo -and make it your own. - -Clone it somewhere on your local machine: - - $ git clone git://github.com/xcolour/dotfiles.git ~/.dotfiles - -Then run the deploy script: +Install dotfiles with the deploy script: $ sh deploy.sh -This script does the following: +Tries to follow the [XDG base directory +spec](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) +as much as possible. + +The script does the following: - Clear out `$PWD/dotfiles-backup/`. - - Back up any existing dotfiles to `$PWD/dotfiles-backup/`. - - Replace existing dotfiles with symlinks to the corresponding file in the - repo. + - Symlink everything under `config` into `$XDG_CONFIG_HOME`. Moves everything + that already exists to `$PWD/dotfiles-backup/` first. + - Symlink `vimrc` and `zshrc` into `$HOME`. Again back up existing files to + `$PWD/dotfiles-backup`. - Clone Vundle into `~/.vim/bundle/vundle/` and run `BundleInstall`. - will back up any existing dotfiles to `$PWD/dotfiles-backup/` - - Create `~/.zshrc-local` (if one doesn't already exist) for setting up local - behavior. Take a look inside for ideas. - -The prompt will highligh the local host name in red unless `ZSH_LOCAL_ENV=true` -is set. That's a good one for `~/.zshrc-local`. + - Create `~/.zshrc-local` if one doesn't already exist. diff --git a/config/dircolors.conf b/config/dircolors.conf new file mode 100644 index 0000000..cfd5f8d --- /dev/null +++ b/config/dircolors.conf @@ -0,0 +1,91 @@ +# Copyright (C) 1996, 1999-2010 Free Software Foundation, Inc. +# Copying and distribution of this file, with or without modification, +# are permitted provided the copyright notice and this notice are preserved. + +# +# Colorizable terminals + +TERM Eterm +TERM ansi +TERM color-xterm +TERM con132x25 +TERM con132x30 +TERM con132x43 +TERM con132x60 +TERM con80x25 +TERM con80x28 +TERM con80x30 +TERM con80x43 +TERM con80x50 +TERM con80x60 +TERM cons25 +TERM console +TERM cygwin +TERM dtterm +TERM eterm-color +TERM gnome +TERM gnome-256color +TERM jfbterm +TERM konsole +TERM kterm +TERM linux +TERM linux-c +TERM mach-color +TERM mlterm +TERM putty +TERM rxvt +TERM rxvt-256color +TERM rxvt-cygwin +TERM rxvt-cygwin-native +TERM rxvt-unicode +TERM rxvt-unicode-256color +TERM rxvt-unicode256 +TERM screen +TERM screen-256color +TERM screen-256color-bce +TERM screen-bce +TERM screen-w +TERM screen.rxvt +TERM screen.linux +TERM terminator +TERM vt100 +TERM xterm +TERM xterm-16color +TERM xterm-256color +TERM xterm-88color +TERM xterm-color +TERM xterm-debian + +# +# Generic types + +# Attribute codes: +# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed +# +# Text color codes: +# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white +# +# Background color codes: +# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white + +RESET 0 # reset to "normal" color +DIR 34 # directory +LINK 36 # symbolic link +FIFO 40;33 # pipe +SOCK 35 # socket +DOOR 35 # door +BLK 40;33 # block device driver +CHR 40;33 # character device driver +ORPHAN 40;31 # symlink to nonexistent file, or non-stat'able file +SETUID 37;41 # file that is setuid (u+s) +SETGID 30;43 # file that is setgid (g+s) +CAPABILITY 30;41 # file with capability +STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) +OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky +STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable +EXEC 32 # executable files + +# +# Extension-based + +#.tar.gz 01;31 diff --git a/config/git/config b/config/git/config new file mode 100644 index 0000000..f68fed8 --- /dev/null +++ b/config/git/config @@ -0,0 +1,38 @@ +[user] + name = Matt Singleton + email = matt@xcolour.net + +[alias] + st = status + ci = commit + br = branch + co = checkout + df = diff + lg = log -p + +[core] + whitespace = trailing-space,space-before-tab,cr-at-eol + editor = vim + autocrlf = input + excludesfile = /Users/matt/.gitignore + pager = less -+$LESS -RSX + +[push] + default = nothing + +[color] + ui = true + +[mergetool] + keepTemporaries = false + prompt = false + +[merge] + tool = meld + +[diff] + tool = meld +[init] + defaultBranch = main +[pull] + ff = only diff --git a/config/git/ignore b/config/git/ignore new file mode 100644 index 0000000..57dd8e6 --- /dev/null +++ b/config/git/ignore @@ -0,0 +1,11 @@ +*.class +*.pyc +*.swo +*.swp +.svn +.swo +*#* +# +.#* +doc/tags +.DS_STORE diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf new file mode 100644 index 0000000..b1b98e0 --- /dev/null +++ b/config/tmux/tmux.conf @@ -0,0 +1,55 @@ +# vi bindings +set -g status-keys vi +setw -g mode-keys vi + +# reasonable history buffer +set -g history-limit 10000 + +# status line +setw -g window-status-current-style bright +set -g status-right '#(date "+%H:%M %Z %Y-%m-%d")' +set -g status-style bg=white +set -g status-left " #S@#h " +set -g status-left-length 15 +set -g status-left-style bg=green,fg=white + +# ui +set -g set-titles on +set -g default-terminal "screen-256color" +set -ga terminal-overrides ",xterm-256color:Tc" +set -g pane-border-style fg=white + +# splits +bind | split-window -h +bind \\ split-window -h +bind - split-window -v + +# reversed to match vim split names +bind v select-layout even-horizontal +bind h select-layout even-vertical + +# vim-style resize +bind -r H resize-pane -L 2 +bind -r J resize-pane -D 2 +bind -r K resize-pane -U 2 +bind -r L resize-pane -R 2 + +# vim-style move +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# unbind arrow keys +unbind Up +unbind Down +unbind Left +unbind Right +unbind M-Up +unbind M-Down +unbind M-Left +unbind M-Right +unbind C-Up +unbind C-Down +unbind C-Left +unbind C-Right diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc new file mode 100644 index 0000000..ee3ebdd --- /dev/null +++ b/config/zsh/.zshrc @@ -0,0 +1,3 @@ +# just a shim to make the real zshrc not hidden +# since zsh doesn't support renaming the config +source "$ZDOTDIR/zshrc" diff --git a/config/zsh/appearance.zsh b/config/zsh/appearance.zsh new file mode 100644 index 0000000..e7132a8 --- /dev/null +++ b/config/zsh/appearance.zsh @@ -0,0 +1,73 @@ +# +# colorize shell programs + +if ls --color -d . &>/dev/null 2>&1; then + alias ls='ls --color=tty' + eval `dircolors ${XDG_CONFIG_HOME:-${HOME}/.config}/dircolors.conf` +else + alias ls='ls -G' + export LSCOLORS="exgxbxdxcxegedxbxgxcxd" +fi + +# grep +export GREP_COLOR='1;32' +alias grep='grep --color=auto' +alias egrep='egrep --color=auto' +alias fgrep='fgrep --color=auto' + +# less +export LESS_TERMCAP_mb=$'\e[0;31m' # begin blinking - red +export LESS_TERMCAP_md=$'\e[0;34m' # begin bold - blue +export LESS_TERMCAP_me=$'\e[0m' # end mode +export LESS_TERMCAP_so=$'\e[30;46m' # begin standout mode - black on cyan +export LESS_TERMCAP_se=$'\e[0m' # end standout mode +export LESS_TERMCAP_us=$'\e[4;33m' # begin underline - yellow underline +export LESS_TERMCAP_ue=$'\e[0m' # end underline + +# +# make a sweet prompt + +autoload colors; colors; +setopt prompt_subst # expansion of color codes, etc. in the prompt + +# print the fully resolved shell command with time stamp +# to be run from zsh's builtin 'preexec' with all arguments passed through ($*) +function theme_preexec () { + echo "($fg[magenta]`date +%r`$reset_color) $fg[cyan]$3$reset_color" +} + +# print the prompt char in red if the last command exited non-zero +function prompt_char { + echo "%(?.$.%{$fg[red]%}$%{$reset_color%})" +} + +function repo_prompt_info { + # git + ref=$(git symbolic-ref HEAD 2> /dev/null || git rev-parse --short HEAD 2> /dev/null) + if [ $? -eq 0 ]; then + #repo=$(basename $(git rev-parse --show-toplevel)) + echo "%{$fg[cyan]%}%{\e[1m%}${ref#refs/heads/}%{$reset_color%}" + return + fi +} + +function workspace_prompt_info { + repo=$(repo_prompt_info) + if [ "$repo" ]; then + echo "[$repo] " + return + fi +} + +# print the hostname in green if local, else red +function hostname_info { + if [[ $ZSH_LOCAL_ENV == "true" ]]; then + echo "%{$fg[green]%}%{$ZSH_HOST_PREFIX%}%m%{$ZSH_HOST_SUFFIX%}%{$reset_color%}" + else + echo "%{$fg[red]%}%{$ZSH_HOST_PREFIX%}%m%{$ZSH_HOST_SUFFIX%}%{$reset_color%}" + fi +} + +# a colorful multiline prompt using the above defined functions +PROMPT=$'%{$fg[yellow]%}%n%{$reset_color%}@$(hostname_info):%{$fg[blue]%}%~%{$reset_color%} +$(workspace_prompt_info)$(prompt_char)%{$reset_color%} ' diff --git a/config/zsh/behavior.zsh b/config/zsh/behavior.zsh new file mode 100644 index 0000000..e7e6b81 --- /dev/null +++ b/config/zsh/behavior.zsh @@ -0,0 +1,65 @@ +# +# execution + +setopt rm_star_wait # wait 10 seconds before accepting 'rm *' confirmation +export REPORTTIME=5 # report timing for any command longer than 5 seconds +unsetopt flowcontrol # disable ^s from freezing the terminal + +# +# history + +HISTFILE="${XDG_DATA_HOME:-${HOME}/.local/share}/zsh/history" +HISTSIZE=10000 +SAVEHIST=10000 + +setopt hist_ignore_all_dups # ignore dups including non-sequential ones +setopt share_history # share command history data between sessions +setopt hist_verify # load hist into command buffer rather than exec immediately + +# +# term support + +# set term title appropriately based on term type +# user@host:current_dir (current_command) +case "$TERM" in + xterm*|rxvt*|screen*|alacritty*) + term_preexec () { + printf '\e]0;%s (%s)\a' ${(%):-'%n@%m:%~'} "$1" + } + term_precmd () { + printf '\e]0;%s\a' ${(%):-'%n@%m:%~'} + } + ;; +esac + +# +# virtualenv + +if [ -e /usr/local/bin/virtualenvwrapper_lazy.sh ]; then + vew=/usr/local/bin/virtualenvwrapper_lazy.sh +elif [ -e /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh ]; then + vew=/usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh +fi + +if [ -n "$vew" ]; then + export VIRTUAL_ENV_DISABLE_PROMPT=true + export WORKON_HOME=~/.virtualenv/envs + source $vew +fi + +# +# draw a horizontal separator + +function hr { + printf "$bg[red]${(l:$COLUMNS:: :)}$reset_color\n" + printf "$bg[yellow]${(l:$COLUMNS:: :)}\n" + printf "$bg[green]${(l:$COLUMNS:: :)}\n" + printf "$bg[cyan]${(l:$COLUMNS:: :)}\n" + printf "$bg[blue]${(l:$COLUMNS:: :)}\n" + printf "$bg[magenta]${(l:$COLUMNS:: :)}$reset_color\n" +} + +# +# less + +export LESS=-i diff --git a/config/zsh/completion.zsh b/config/zsh/completion.zsh new file mode 100644 index 0000000..740e9a3 --- /dev/null +++ b/config/zsh/completion.zsh @@ -0,0 +1,52 @@ +# initialize the completion system +autoload -U compinit +zmodload zsh/complist +compinit -d "${XDG_CACHE_HOME:-${HOME}/.cache}/zsh/zcompdump-${ZSH_VERSION}" + +# complete only after the second consecutive tab +setopt auto_menu + +# use GNU ls color specification for completion menu +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} + +# use menu selection by default +zstyle ':completion:*:default' menu select + +# custom completion list for processes (just current user's) +zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" +# special colors for kill completion listing +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' + +# disable named-directories autocompletion +zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories +cdpath=(.) + +# use /etc/hosts and known_hosts for hostname completion +[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() +[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$( /dev/null && term_preexec $* + type theme_preexec &> /dev/null && theme_preexec $* +} + +precmd () { + type term_precmd &> /dev/null && term_precmd +} diff --git a/config/zsh/key-bindings.zsh b/config/zsh/key-bindings.zsh new file mode 100644 index 0000000..4deac62 --- /dev/null +++ b/config/zsh/key-bindings.zsh @@ -0,0 +1,6 @@ +bindkey -e # use emacs mode +bindkey '^r' history-incremental-search-backward # ctrl-r +bindkey '^[[Z' reverse-menu-complete # shift-tab + +bindkey '\e[3~' delete-char # make sure delete key works +bindkey ' ' magic-space # also do history expansion on space diff --git a/config/zsh/zshrc b/config/zsh/zshrc new file mode 100644 index 0000000..2a0fcf0 --- /dev/null +++ b/config/zsh/zshrc @@ -0,0 +1,17 @@ +export EDITOR=vim +export LANG=en_US.UTF-8 + +if [ -e "$ZDOTDIR/zshrc-local" ]; then + source "$ZDOTDIR/zshrc-local" +fi + +source "$ZDOTDIR/appearance.zsh" +source "$ZDOTDIR/behavior.zsh" +source "$ZDOTDIR/completion.zsh" +source "$ZDOTDIR/key-bindings.zsh" + +# override builtin functions (preexec, precmd, etc.) +source "$ZDOTDIR/function-overrides.zsh" + +# user bin should take absolute priority +export PATH="$HOME/bin:$PATH" diff --git a/config/zsh/zshrc-local b/config/zsh/zshrc-local new file mode 100644 index 0000000..50a16b2 --- /dev/null +++ b/config/zsh/zshrc-local @@ -0,0 +1,23 @@ +# get sbin on the path +#export PATH="/usr/sbin:/sbin:$PATH" + +# move homebrew stuff to the beginning of the search path +#export PATH="/usr/local/bin:/usr/local/sbin:$PATH" +#export MANPATH="/usr/local/man:$MANPATH" +#export PATH="/usr/local/opt/python/libexec/bin:$PATH" +#export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" +#export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" +#export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH" +#export MANPATH="/usr/local/opt/findutils/libexec/gnuman:$MANPATH" +#export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH" +#export MANPATH="/usr/local/opt/grep/libexec/gnuman:$MANPATH" + +# Java +#export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)" + +# start the ssh agent on login and stop on logout +#eval `ssh-agent -s` +#trap 'eval `ssh-agent -k`' 0 + +# prompt hostname is highlighted in red for non-local envs +export ZSH_LOCAL_ENV=true diff --git a/deploy.sh b/deploy.sh index b76e531..5ba66bb 100755 --- a/deploy.sh +++ b/deploy.sh @@ -5,25 +5,26 @@ set -e rm -rf dotfiles-backup mkdir -p dotfiles-backup +# XDG layout +xcache="${XDG_CACHE_HOME:-${HOME}/.cache}" +xdata="${XDG_DATA_HOME:-${HOME}/.local/share}" +xconfig="${XDG_CONFIG_HOME:-${HOME}/.config}" + # deploy -if [ -z "$XDG_CONFIG_HOME" ]; -then - config_home="$HOME/.config" -else - config_home="$XDG_CONFIG_HOME" -fi -cd xdg-config +mkdir -p "${xcache}/zsh" +mkdir -p "${xdata}/zsh" +cd config for d in * do - dest="$config_home/$d" + dest="${xconfig}/$d" if [ -e "$dest" ]; then - mv "$dest" ../dotfiles-backup/$d + mv "$dest" "../dotfiles-backup/$d" fi ln -sf "$(pwd)/$d" "$dest" done cd .. -for f in vimrc gvimrc gitconfig gitignore zshrc zsh dircolors.conf +for f in vimrc zshenv do if [ -e ~/.${f} ]; then mv ~/.${f} dotfiles-backup/${f} @@ -40,6 +41,6 @@ fi vim +BundleInstall +qall vim +BundleClean +qall -if [ ! -e ~/.zshrc-local ]; then - cp zshrc-local ~/.zshrc-local +if [ ! -e config/zsh/zshrc-local ]; then + cp zshrc-local config/zsh/zshrc-local fi diff --git a/dircolors.conf b/dircolors.conf deleted file mode 100644 index cfd5f8d..0000000 --- a/dircolors.conf +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (C) 1996, 1999-2010 Free Software Foundation, Inc. -# Copying and distribution of this file, with or without modification, -# are permitted provided the copyright notice and this notice are preserved. - -# -# Colorizable terminals - -TERM Eterm -TERM ansi -TERM color-xterm -TERM con132x25 -TERM con132x30 -TERM con132x43 -TERM con132x60 -TERM con80x25 -TERM con80x28 -TERM con80x30 -TERM con80x43 -TERM con80x50 -TERM con80x60 -TERM cons25 -TERM console -TERM cygwin -TERM dtterm -TERM eterm-color -TERM gnome -TERM gnome-256color -TERM jfbterm -TERM konsole -TERM kterm -TERM linux -TERM linux-c -TERM mach-color -TERM mlterm -TERM putty -TERM rxvt -TERM rxvt-256color -TERM rxvt-cygwin -TERM rxvt-cygwin-native -TERM rxvt-unicode -TERM rxvt-unicode-256color -TERM rxvt-unicode256 -TERM screen -TERM screen-256color -TERM screen-256color-bce -TERM screen-bce -TERM screen-w -TERM screen.rxvt -TERM screen.linux -TERM terminator -TERM vt100 -TERM xterm -TERM xterm-16color -TERM xterm-256color -TERM xterm-88color -TERM xterm-color -TERM xterm-debian - -# -# Generic types - -# Attribute codes: -# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed -# -# Text color codes: -# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white -# -# Background color codes: -# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white - -RESET 0 # reset to "normal" color -DIR 34 # directory -LINK 36 # symbolic link -FIFO 40;33 # pipe -SOCK 35 # socket -DOOR 35 # door -BLK 40;33 # block device driver -CHR 40;33 # character device driver -ORPHAN 40;31 # symlink to nonexistent file, or non-stat'able file -SETUID 37;41 # file that is setuid (u+s) -SETGID 30;43 # file that is setgid (g+s) -CAPABILITY 30;41 # file with capability -STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) -OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky -STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable -EXEC 32 # executable files - -# -# Extension-based - -#.tar.gz 01;31 diff --git a/gitconfig b/gitconfig deleted file mode 100644 index f68fed8..0000000 --- a/gitconfig +++ /dev/null @@ -1,38 +0,0 @@ -[user] - name = Matt Singleton - email = matt@xcolour.net - -[alias] - st = status - ci = commit - br = branch - co = checkout - df = diff - lg = log -p - -[core] - whitespace = trailing-space,space-before-tab,cr-at-eol - editor = vim - autocrlf = input - excludesfile = /Users/matt/.gitignore - pager = less -+$LESS -RSX - -[push] - default = nothing - -[color] - ui = true - -[mergetool] - keepTemporaries = false - prompt = false - -[merge] - tool = meld - -[diff] - tool = meld -[init] - defaultBranch = main -[pull] - ff = only diff --git a/gitignore b/gitignore deleted file mode 100644 index 57dd8e6..0000000 --- a/gitignore +++ /dev/null @@ -1,11 +0,0 @@ -*.class -*.pyc -*.swo -*.swp -.svn -.swo -*#* -# -.#* -doc/tags -.DS_STORE diff --git a/gvimrc b/gvimrc deleted file mode 100644 index 1ffd59f..0000000 --- a/gvimrc +++ /dev/null @@ -1,6 +0,0 @@ -" TODO: make me platform independent - -set guifont=Anonymous\ Pro:h16 -set guioptions-=T -set lines=40 "just make it as tall as possible -set columns=120 diff --git a/xdg-config/tmux/tmux.conf b/xdg-config/tmux/tmux.conf deleted file mode 100644 index b1b98e0..0000000 --- a/xdg-config/tmux/tmux.conf +++ /dev/null @@ -1,55 +0,0 @@ -# vi bindings -set -g status-keys vi -setw -g mode-keys vi - -# reasonable history buffer -set -g history-limit 10000 - -# status line -setw -g window-status-current-style bright -set -g status-right '#(date "+%H:%M %Z %Y-%m-%d")' -set -g status-style bg=white -set -g status-left " #S@#h " -set -g status-left-length 15 -set -g status-left-style bg=green,fg=white - -# ui -set -g set-titles on -set -g default-terminal "screen-256color" -set -ga terminal-overrides ",xterm-256color:Tc" -set -g pane-border-style fg=white - -# splits -bind | split-window -h -bind \\ split-window -h -bind - split-window -v - -# reversed to match vim split names -bind v select-layout even-horizontal -bind h select-layout even-vertical - -# vim-style resize -bind -r H resize-pane -L 2 -bind -r J resize-pane -D 2 -bind -r K resize-pane -U 2 -bind -r L resize-pane -R 2 - -# vim-style move -bind h select-pane -L -bind j select-pane -D -bind k select-pane -U -bind l select-pane -R - -# unbind arrow keys -unbind Up -unbind Down -unbind Left -unbind Right -unbind M-Up -unbind M-Down -unbind M-Left -unbind M-Right -unbind C-Up -unbind C-Down -unbind C-Left -unbind C-Right diff --git a/zsh/appearance.zsh b/zsh/appearance.zsh deleted file mode 100644 index 620ef54..0000000 --- a/zsh/appearance.zsh +++ /dev/null @@ -1,73 +0,0 @@ -# -# colorize shell programs - -if ls --color -d . &>/dev/null 2>&1; then - alias ls='ls --color=tty' - eval `dircolors ~/.dircolors.conf` -else - alias ls='ls -G' - export LSCOLORS="exgxbxdxcxegedxbxgxcxd" -fi - -# grep -export GREP_COLOR='1;32' -alias grep='grep --color=auto' -alias egrep='egrep --color=auto' -alias fgrep='fgrep --color=auto' - -# less -export LESS_TERMCAP_mb=$'\e[0;31m' # begin blinking - red -export LESS_TERMCAP_md=$'\e[0;34m' # begin bold - blue -export LESS_TERMCAP_me=$'\e[0m' # end mode -export LESS_TERMCAP_so=$'\e[30;46m' # begin standout mode - black on cyan -export LESS_TERMCAP_se=$'\e[0m' # end standout mode -export LESS_TERMCAP_us=$'\e[4;33m' # begin underline - yellow underline -export LESS_TERMCAP_ue=$'\e[0m' # end underline - -# -# make a sweet prompt - -autoload colors; colors; -setopt prompt_subst # expansion of color codes, etc. in the prompt - -# print the fully resolved shell command with time stamp -# to be run from zsh's builtin 'preexec' with all arguments passed through ($*) -function theme_preexec () { - echo "($fg[magenta]`date +%r`$reset_color) $fg[cyan]$3$reset_color" -} - -# print the prompt char in red if the last command exited non-zero -function prompt_char { - echo "%(?.$.%{$fg[red]%}$%{$reset_color%})" -} - -function repo_prompt_info { - # git - ref=$(git symbolic-ref HEAD 2> /dev/null || git rev-parse --short HEAD 2> /dev/null) - if [ $? -eq 0 ]; then - #repo=$(basename $(git rev-parse --show-toplevel)) - echo "%{$fg[cyan]%}%{\e[1m%}${ref#refs/heads/}%{$reset_color%}" - return - fi -} - -function workspace_prompt_info { - repo=$(repo_prompt_info) - if [ "$repo" ]; then - echo "[$repo] " - return - fi -} - -# print the hostname in green if local, else red -function hostname_info { - if [[ $ZSH_LOCAL_ENV == "true" ]]; then - echo "%{$fg[green]%}%{$ZSH_HOST_PREFIX%}%m%{$ZSH_HOST_SUFFIX%}%{$reset_color%}" - else - echo "%{$fg[red]%}%{$ZSH_HOST_PREFIX%}%m%{$ZSH_HOST_SUFFIX%}%{$reset_color%}" - fi -} - -# a colorful multiline prompt using the above defined functions -PROMPT=$'%{$fg[yellow]%}%n%{$reset_color%}@$(hostname_info):%{$fg[blue]%}%~%{$reset_color%} -$(workspace_prompt_info)$(prompt_char)%{$reset_color%} ' diff --git a/zsh/behavior.zsh b/zsh/behavior.zsh deleted file mode 100644 index 84e5bfc..0000000 --- a/zsh/behavior.zsh +++ /dev/null @@ -1,65 +0,0 @@ -# -# execution - -setopt rm_star_wait # wait 10 seconds before accepting 'rm *' confirmation -export REPORTTIME=5 # report timing for any command longer than 5 seconds -unsetopt flowcontrol # disable ^s from freezing the terminal - -# -# history - -HISTFILE=$HOME/.zsh_history -HISTSIZE=10000 -SAVEHIST=10000 - -setopt hist_ignore_all_dups # ignore dups including non-sequential ones -setopt share_history # share command history data between sessions -setopt hist_verify # load hist into command buffer rather than exec immediately - -# -# term support - -# set term title appropriately based on term type -# user@host:current_dir (current_command) -case "$TERM" in - xterm*|rxvt*|screen*|alacritty*) - term_preexec () { - printf '\e]0;%s (%s)\a' ${(%):-'%n@%m:%~'} "$1" - } - term_precmd () { - printf '\e]0;%s\a' ${(%):-'%n@%m:%~'} - } - ;; -esac - -# -# virtualenv - -if [ -e /usr/local/bin/virtualenvwrapper_lazy.sh ]; then - vew=/usr/local/bin/virtualenvwrapper_lazy.sh -elif [ -e /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh ]; then - vew=/usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh -fi - -if [ -n "$vew" ]; then - export VIRTUAL_ENV_DISABLE_PROMPT=true - export WORKON_HOME=~/.virtualenv/envs - source $vew -fi - -# -# draw a horizontal separator - -function hr { - printf "$bg[red]${(l:$COLUMNS:: :)}$reset_color\n" - printf "$bg[yellow]${(l:$COLUMNS:: :)}\n" - printf "$bg[green]${(l:$COLUMNS:: :)}\n" - printf "$bg[cyan]${(l:$COLUMNS:: :)}\n" - printf "$bg[blue]${(l:$COLUMNS:: :)}\n" - printf "$bg[magenta]${(l:$COLUMNS:: :)}$reset_color\n" -} - -# -# less - -export LESS=-i diff --git a/zsh/completion.zsh b/zsh/completion.zsh deleted file mode 100644 index 5c8160a..0000000 --- a/zsh/completion.zsh +++ /dev/null @@ -1,52 +0,0 @@ -# initialize the completion system -autoload -U compinit -zmodload zsh/complist -compinit - -# complete only after the second consecutive tab -setopt auto_menu - -# use GNU ls color specification for completion menu -zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} - -# use menu selection by default -zstyle ':completion:*:default' menu select - -# custom completion list for processes (just current user's) -zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" -# special colors for kill completion listing -zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' - -# disable named-directories autocompletion -zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories -cdpath=(.) - -# use /etc/hosts and known_hosts for hostname completion -[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() -[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$( /dev/null && term_preexec $* - type theme_preexec &> /dev/null && theme_preexec $* -} - -precmd () { - type term_precmd &> /dev/null && term_precmd -} diff --git a/zsh/key-bindings.zsh b/zsh/key-bindings.zsh deleted file mode 100644 index 4deac62..0000000 --- a/zsh/key-bindings.zsh +++ /dev/null @@ -1,6 +0,0 @@ -bindkey -e # use emacs mode -bindkey '^r' history-incremental-search-backward # ctrl-r -bindkey '^[[Z' reverse-menu-complete # shift-tab - -bindkey '\e[3~' delete-char # make sure delete key works -bindkey ' ' magic-space # also do history expansion on space diff --git a/zshenv b/zshenv new file mode 100644 index 0000000..a573065 --- /dev/null +++ b/zshenv @@ -0,0 +1 @@ +export ZDOTDIR="${XDG_CONFIG_HOME:-${HOME}/.config}/zsh" diff --git a/zshrc b/zshrc deleted file mode 100644 index 6f4e111..0000000 --- a/zshrc +++ /dev/null @@ -1,17 +0,0 @@ -export EDITOR=vim -export LANG=en_US.UTF-8 - -if [ -e "$HOME/.zshrc-local" ]; then - source "$HOME/.zshrc-local" -fi - -source "$HOME/.zsh/appearance.zsh" -source "$HOME/.zsh/behavior.zsh" -source "$HOME/.zsh/completion.zsh" -source "$HOME/.zsh/key-bindings.zsh" - -# override builtin functions (preexec, precmd, etc.) -source "$HOME/.zsh/functions.zsh-overrides" - -# user bin should take absolute priority -export PATH="$HOME/bin:$PATH" -- cgit v1.2.3