Initial commit

master
Taeyeon Mori 10 years ago
commit 4ad70aac4d
  1. 3
      .gitignore
  2. 3
      .gitmodules
  3. 6
      dotfiles/makepkg.conf
  4. 108
      dotfiles/vimrc
  5. 3
      git/config
  6. 123
      install
  7. 43
      zsh/lib.zsh
  8. 1
      zsh/prezto
  9. 22
      zsh/zlogin
  10. 14
      zsh/zlogout
  11. 159
      zsh/zpreztorc
  12. 78
      zsh/zprofile
  13. 12
      zsh/zshenv
  14. 14
      zsh/zshrc

3
.gitignore vendored

@ -0,0 +1,3 @@
/zsh/.*
user-info

3
.gitmodules vendored

@ -0,0 +1,3 @@
[submodule "zsh/prezto"]
path = zsh/prezto
url = https://github.com/sorin-ionescu/prezto

@ -0,0 +1,6 @@
source "$DOTFILES/user-info"
PACKAGER="$REALNAME <$EMAIL>"
MAKEFLAGS="-j4"
CFLAGS="-march=native"

@ -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 <leader>w: :w!<cr>
" 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

@ -0,0 +1,3 @@
[colors]
ui = true

@ -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" <<EOF
REALNAME="$REALNAME"
EMAIL="$EMAIL"
EOF
# Setup dotfiles
msg "Linking dotfiles..."
for file in "$DOT/dotfiles"/*; do
NAM="${file:t}"
color 32 echo " Adding .$NAM"
relink "$file" "$HOME/.$NAM"
done
# Setup git
msg "Setting up Git configuration..."
GIT="$DOT/git"
[[ -e "$HOME/.gitconfig" ]] && ! grep -q ".files/install" "$HOME/.gitconfig" && err "Custom ~/.gitconfig already exists! Please remove it before running .files/install" && exit 1
generate "$HOME/.gitconfig" <<EOF
[include]
path = $GIT/config
path = $GIT/user-info
EOF
generate "$GIT/user-info" <<EOF
[user]
name = $REALNAME
email = $EMAIL
EOF
# Setup ZSH/Prezto
msg "Setting up ZSH configuration..."
ZSH="$DOT/zsh"
generate "$HOME/.zshenv" <<EOF
export DOTFILES="$DOT"
ZDOTDIR="\$DOTFILES/zsh"
source "\$ZDOTDIR/zshenv"
EOF
for file in zprofile zshrc zpreztorc zlogin zlogout; do
relink "$ZSH/$file" "$ZSH/.$file"
done
relink "$ZSH/prezto" "$ZSH/.zprezto"
# Set login shell
msg "Setting login shell to '/bin/zsh'..."
echo $SHELL | grep -q zsh || chsh -s /bin/zsh
# Warn user
color 33 echo "You need to relog to apply shell configuration."

@ -0,0 +1,43 @@
#!/bin/zsh
# ZSH Utitlities library
# (c) 2014 MORI Taeyeon
# I <3 predicates :)
# [predicate] Mute command
function quiet {
"$@" >/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
}

@ -0,0 +1 @@
Subproject commit 10cf7018645fd9c09a0aa03c4ebac5ae6222c77e

@ -0,0 +1,22 @@
#
# Executes commands at login post-zshrc.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# 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

@ -0,0 +1,14 @@
#
# Executes commands at logout.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Print the message.
cat <<-EOF
Thank you. Come again!
-- Dr. Apu Nahasapeemapetilon
EOF

@ -0,0 +1,159 @@
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# 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'

@ -0,0 +1,78 @@
#
# Executes commands at login pre-zshrc.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# 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

@ -0,0 +1,12 @@
#
# Defines environment variables.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# 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

@ -0,0 +1,14 @@
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Source Prezto.
if [[ -s "${ZDOTDIR}/prezto/init.zsh" ]]; then
source "${ZDOTDIR}/prezto/init.zsh"
fi
# Customize to your needs...
Loading…
Cancel
Save