commit 4ad70aac4d14a62d33d086da81544e6dda86c661 Author: MORI Taeyeon Date: Mon Mar 3 15:48:21 2014 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..207bc1c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/zsh/.* +user-info + diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0cb22f6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "zsh/prezto"] + path = zsh/prezto + url = https://github.com/sorin-ionescu/prezto diff --git a/dotfiles/makepkg.conf b/dotfiles/makepkg.conf new file mode 100644 index 0000000..87c18a6 --- /dev/null +++ b/dotfiles/makepkg.conf @@ -0,0 +1,6 @@ +source "$DOTFILES/user-info" +PACKAGER="$REALNAME <$EMAIL>" + +MAKEFLAGS="-j4" +CFLAGS="-march=native" + diff --git a/dotfiles/vimrc b/dotfiles/vimrc new file mode 100644 index 0000000..47bb80e --- /dev/null +++ b/dotfiles/vimrc @@ -0,0 +1,108 @@ +set modeline + +" General +"""""""""""""""""""""""""""""""""""""""""""""""""""""""" +set hi=700 "history + +" Filetype +filetype plugin on +filetype indent on + +set ar "autoread + +" Shortcuts +let mapleader="," +let g:mapleader="," + +" Fast Saving +nmap w: :w! + +" User interface +"""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Movement with j/k +set so=7 + +" Wildmenu +set wildmenu +set wildignore=*.o,*~,*.pyc,*.pyo + +" Ruler +set ru "ruler +set nu "number + +" Cmd Bar +set ch=2 "cmdheight + +set hid + +" Backspace +set backspace=eol,start,indent +set whichwrap+=<,>,h,l + +" Search +set ic "ignorecase +set sc "smartcase +set hlsearch +set incsearch + +set lazyredraw +set magic + +" Brackets +set sm "showmatch +set mat=2 + +" Errors +set noeb "noerrorbells +set novb "novisualbell +set t_vb= +set tm=500 + +" Colors & Fonts +""""""""""""""""""""""""""""""""""""""""""""""""" +syntax enable + +colorscheme desert +set bg=dark "background + +set enc=utf8 "encoding +set ffs=unix,dos,mac + +" Files +""""""""""""""""""""""""""""""""""""""""""""""""" +set nobackup +set nowb +set noswapfile + +" Text +""""""""""""""""""""""""""""""""""""""""""""""""" +" Tabs +set et "expandtab +set smarttab +set sw=4 "shiftwidth +set ts=4 "tabstop +" Indents +set ai "autoindent +set si "smartindent +set wrap +" Lin eBreak +set lbr +set tw=500 + +" Buffers +"""""""""""""""""""""""""""""""""""""""""""""""""" +set switchbuf=useopen,usetab,newtab +set stal=2 + +" Status Line +"""""""""""""""""""""""""""""""""""""""""""""""""" +set laststatus=2 +set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l + +function! HasPaste() + if &paste + return 'Paste Mode ' + end + return '' +endfunction + diff --git a/git/config b/git/config new file mode 100644 index 0000000..b57c5db --- /dev/null +++ b/git/config @@ -0,0 +1,3 @@ +[colors] + ui = true + diff --git a/install b/install new file mode 100755 index 0000000..b3b3dc0 --- /dev/null +++ b/install @@ -0,0 +1,123 @@ +#!/bin/zsh +# .files installer +# (c) 2014 MORI Taeyeon + +# Paths & Utils +DOT="$(realpath "$(dirname "$0")")" + +setopt EXTENDED_GLOB +source "$DOT/zsh/lib.zsh" + +# Parse commandline +OVERWRITE=false + +function print_usage() { + echo "Usage: $0 [--help] [--overwrite]" + echo + echo "Install Tae's dotfiles" + echo + echo "Parameters:" + echo " -h, --help Display this help message" + echo " --overwrite Just overwrite existing dotfiles" +} + +for arg in "$@"; do + [[ -z "$STATE" ]] && { + case "$arg" in + -h|--help) print_usage; exit 0;; + --overwrite) OVERWRITE=true;; + *) print_usage; exit 1;; + esac + } || { + case "$STATE" in + # handle options with parameters + esac + STATE= + } +done +[[ -n "$STATE" ]] && err "Option $STATE is missing it's parameter!" && exit 1 + +# Helper functions +function generate() { + [[ -e "$1" ]] && ! $OVERWRITE && ! grep -q "Generated by .files/install" "$1" && \ + err "Custom version of $1 detected. Please delete it before running .files/install" && exit 1 + echo "# Generated by .files/install" >"$1" + echo "# `date "+%m/%d/%Y %H:%M:%S"`" >>"$1" + echo >>"$1" + cat >>"$1" +} + +function relink() { + [[ ! -e "$1" ]] && err "No such file or directory: '$1'" && return 1 + [[ -L "$2" ]] && rm -f "$2" + [[ -e "$2" ]] && ! $OVERWRITE && err "File already exists and isn't a symbolic link: '$2'" && return 1 + color 31 ln -s "$1" "$2" +} + +# Update git modules +msg "Updating git submodules..." +git submodule update --init --recursive + +# Ask questions about user +msg "Asking questions..." + +[[ -e "$DOT/user-info" ]] && source "$DOT/user-info" + +[[ -z "$REAL_NAME" ]] && REALNAME=`grep "^$USER:[^:]*:$UID:" /etc/passwd | cut -d: -f5 | cut -d, -f1` +ask "Real name" REALNAME +ask "E-Mail address" EMAIL + +generate "$DOT/user-info" </dev/null 2>&1 + return $? +} + +# [predicate] Colorize output +function color { + local COLOR=$1 && shift + echo -en "\e[${COLOR}m" + "$@" + echo -en "\e[0m" + return $? +} + +alias msg="color 34 echo" +alias err="color 31 echo" + +# Ask a question +function ask() { + local RESULT + echo -en "\e[35m$1" + [[ -n "${(P)2}" ]] && echo -n " [${(P)2}]" + echo -n ": " + color 36 read $3 RESULT + [[ -n "$RESULT" ]] && eval $2=\""$RESULT"\" +} + +# Get random choice +function random_choice() { + if quiet which shuf; then + shuf -n1 -e "$@" + else + local NUMBER=${RANDOM%$#+1} + echo ${!NUMBER} + fi +} + diff --git a/zsh/prezto b/zsh/prezto new file mode 160000 index 0000000..10cf701 --- /dev/null +++ b/zsh/prezto @@ -0,0 +1 @@ +Subproject commit 10cf7018645fd9c09a0aa03c4ebac5ae6222c77e diff --git a/zsh/zlogin b/zsh/zlogin new file mode 100644 index 0000000..32f28cf --- /dev/null +++ b/zsh/zlogin @@ -0,0 +1,22 @@ +# +# Executes commands at login post-zshrc. +# +# Authors: +# Sorin Ionescu +# + +# Execute code that does not affect the current session in the background. +{ + # Compile the completion dump to increase startup speed. + zcompdump="${ZDOTDIR:-$HOME}/.zcompdump" + if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then + zcompile "$zcompdump" + fi +} &! + +# Print a random, hopefully interesting, adage. +if (( $+commands[fortune] )); then + fortune -a + print +fi + diff --git a/zsh/zlogout b/zsh/zlogout new file mode 100644 index 0000000..d898fec --- /dev/null +++ b/zsh/zlogout @@ -0,0 +1,14 @@ +# +# Executes commands at logout. +# +# Authors: +# Sorin Ionescu +# + +# Print the message. +cat <<-EOF + +Thank you. Come again! + -- Dr. Apu Nahasapeemapetilon +EOF + diff --git a/zsh/zpreztorc b/zsh/zpreztorc new file mode 100644 index 0000000..89f29f8 --- /dev/null +++ b/zsh/zpreztorc @@ -0,0 +1,159 @@ +# +# Sets Prezto options. +# +# Authors: +# Sorin Ionescu +# + +# +# General +# + +# Set case-sensitivity for completion, history lookup, etc. +# zstyle ':prezto:*:*' case-sensitive 'yes' + +# Color output (auto set to 'no' on dumb terminals). +zstyle ':prezto:*:*' color 'yes' + +# Set the Zsh modules to load (man zshmodules). +# zstyle ':prezto:load' zmodule 'attr' 'stat' + +# Set the Zsh functions to load (man zshcontrib). +# zstyle ':prezto:load' zfunction 'zargs' 'zmv' + +# Set the Prezto modules to load (browse modules). +# The order matters. +zstyle ':prezto:load' pmodule \ + 'environment' \ + 'terminal' \ + 'editor' \ + 'history' \ + 'directory' \ + 'spectrum' \ + 'utility' \ + 'completion' \ + 'prompt' \ + 'syntax-highlighting' \ + 'git' \ + 'python' \ + 'pacman' + +# +# Editor +# + +# Set the key mapping style to 'emacs' or 'vi'. +zstyle ':prezto:module:editor' key-bindings 'emacs' + +# Auto convert .... to ../.. +# zstyle ':prezto:module:editor' dot-expansion 'yes' + +# +# Git +# + +# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'. +# zstyle ':prezto:module:git:status:ignore' submodules 'all' + +# +# GNU Utility +# + +# Set the command prefix on non-GNU systems. +# zstyle ':prezto:module:gnu-utility' prefix 'g' + +# +# History Substring Search +# + +# Set the query found color. +# zstyle ':prezto:module:history-substring-search:color' found '' + +# Set the query not found color. +# zstyle ':prezto:module:history-substring-search:color' not-found '' + +# Set the search globbing flags. +# zstyle ':prezto:module:history-substring-search' globbing-flags '' + +# +# Pacman +# + +# Set the Pacman frontend. +zstyle ':prezto:module:pacman' frontend 'pacaur' + +# +# Prompt +# + +# Set the prompt theme to load. +# Setting it to 'random' loads a random theme. +# Auto set to 'off' on dumb terminals. +zstyle ':prezto:module:prompt' theme 'sorin' + +# +# Ruby +# + +# Auto switch the Ruby version on directory change. +# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes' + +# +# Screen +# + +# Auto start a session when Zsh is launched in a local terminal. +# zstyle ':prezto:module:screen:auto-start' local 'yes' + +# Auto start a session when Zsh is launched in a SSH connection. +# zstyle ':prezto:module:screen:auto-start' remote 'yes' + +# +# SSH +# + +# Set the SSH identities to load into the agent. +# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github' + +# +# Syntax Highlighting +# + +# Set syntax highlighters. +# By default, only the main highlighter is enabled. +# zstyle ':prezto:module:syntax-highlighting' highlighters \ +# 'main' \ +# 'brackets' \ +# 'pattern' \ +# 'cursor' \ +# 'root' +# +# Set syntax highlighting styles. +# zstyle ':prezto:module:syntax-highlighting' styles \ +# 'builtin' 'bg=blue' \ +# 'command' 'bg=blue' \ +# 'function' 'bg=blue' + +# +# Terminal +# + +# Auto set the tab and window titles. +zstyle ':prezto:module:terminal' auto-title 'yes' + +# Set the window title format. +zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s' + +# Set the tab title format. +# zstyle ':prezto:module:terminal:tab-title' format '%m: %s' + +# +# Tmux +# + +# Auto start a session when Zsh is launched in a local terminal. +# zstyle ':prezto:module:tmux:auto-start' local 'yes' + +# Auto start a session when Zsh is launched in a SSH connection. +zstyle ':prezto:module:tmux:auto-start' remote 'yes' + diff --git a/zsh/zprofile b/zsh/zprofile new file mode 100644 index 0000000..0346d23 --- /dev/null +++ b/zsh/zprofile @@ -0,0 +1,78 @@ +# +# Executes commands at login pre-zshrc. +# +# Authors: +# Sorin Ionescu +# + +# +# Browser +# + +if [[ "$OSTYPE" == darwin* ]]; then + export BROWSER='open' +fi + +# +# Editors +# + +export EDITOR='vim' +export VISUAL='nano' +export PAGER='less' + +# +# Language +# + +if [[ -z "$LANG" ]]; then + export LANG='en_US.UTF-8' +fi + +# +# Paths +# + +# Ensure path arrays do not contain duplicates. +typeset -gU cdpath fpath mailpath path + +# Set the the list of directories that cd searches. +# cdpath=( +# $cdpath +# ) + +# Set the list of directories that Zsh searches for programs. +path=( + $HOME/.local/bin + /usr/local/{bin,sbin} + $path +) + +# +# Less +# + +# Set the default Less options. +# Mouse-wheel scrolling has been disabled by -X (disable screen clearing). +# Remove -X and -F (exit if the content fits on one screen) to enable it. +export LESS='-F -g -i -M -R -S -w -X -z-4' + +# Set the Less input preprocessor. +if (( $+commands[lesspipe.sh] )); then + export LESSOPEN='| /usr/bin/env lesspipe.sh %s 2>&-' +fi + +# +# Temporary Files +# + +if [[ ! -d "$TMPDIR" ]]; then + export TMPDIR="/tmp/$UID" + mkdir -p -m 700 "$TMPDIR" +fi + +TMPPREFIX="${TMPDIR%/}/zsh" +if [[ ! -d "$TMPPREFIX" ]]; then + mkdir -p "$TMPPREFIX" +fi + diff --git a/zsh/zshenv b/zsh/zshenv new file mode 100644 index 0000000..2b13503 --- /dev/null +++ b/zsh/zshenv @@ -0,0 +1,12 @@ +# +# Defines environment variables. +# +# Authors: +# Sorin Ionescu +# + +# Ensure that a non-login, non-interactive shell has a defined environment. +if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then + source "${ZDOTDIR:-$HOME}/.zprofile" +fi + diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100644 index 0000000..8410477 --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,14 @@ +# +# Executes commands at the start of an interactive session. +# +# Authors: +# Sorin Ionescu +# + +# Source Prezto. +if [[ -s "${ZDOTDIR}/prezto/init.zsh" ]]; then + source "${ZDOTDIR}/prezto/init.zsh" +fi + +# Customize to your needs... +