refactor to use XDG directories and dircolors in config

master
Sebastian Tramp 2012-08-23 10:39:02 +02:00
parent 82bdb2b304
commit d562581685
No known key found for this signature in database
GPG Key ID: E8093B579D601B44
9 changed files with 41 additions and 37 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "autojump"]
path = autojump
url = git://github.com/joelthelion/autojump.git
[submodule "dircolors-solarized"]
path = dircolors-solarized
url = git://github.com/seebi/dircolors-solarized.git

23
README
View File

@ -3,21 +3,18 @@
Due to many requests I share my zsh configuration compilation.
Copy the repository to ~/.zsh and run 'make install' once
(or link the ~/.zsh/zshrc manually to ~/.zshrc)
(or link the ~/.config/zsh/zshrc manually to ~/.zshrc)
### File description
~/.zsh/README - This file
~/.zsh/Makefile - make-config to run with 'make install'
~/.zsh/aliases - alias definitions which can be edited/modified with 'aedit'
~/.zsh/completion - tab completion configuration
~/.zsh/functions - functions and key bindings to that functions
~/.zsh/options - shell options as history size, general keyindings, etc
~/.zsh/prompt - the prompt definition
~/.zsh/zshrc - the main RC file (will be linked to ~/.zshrc)
$ZSH_CONFIG/README - This file
$ZSH_CONFIG/Makefile - make-config to run with 'make install'
$ZSH_CONFIG/aliases - alias definitions which can be edited/modified with 'aedit'
$ZSH_CONFIG/completion - tab completion configuration
$ZSH_CONFIG/functions - functions and key bindings to that functions
$ZSH_CONFIG/options - shell options as history size, general keyindings, etc
$ZSH_CONFIG/prompt - the prompt definition
$ZSH_CONFIG/zshrc - the main RC file (will be linked to ~/.zshrc)
### These files are not in the repository but will be created
~/.zsh/history - the history file (shared for all zsh instances)
~/.zsh/private - private commands/aliases etc. (included at the end)
this should also include definitions for
EDITOR, PAGER, cdpath, fpath etc.
$ZSH_CACHE/history - the history file (shared for all zsh instances)

View File

@ -22,9 +22,9 @@ alias j=' j'
# default ls is untouched, except coloring
alias ls=' ls --color=auto'
alias myls=' ls -C -F -h --color=always'
alias l=" myls"
alias l=" myls -l"
alias ll=' myls -l'
alias la=' myls -A'
alias la=' myls -lA'
alias v=" clear; ll -gh" # standard directory view
alias vs=" v **/*(.)" # show all files in all subdirs plain in a list

View File

@ -6,7 +6,7 @@
# add an autoload function path, if directory exists
# http://www.zsh.org/mla/users/2002/msg00232.html
functionsd="$HOME/.zsh/functions.d"
functionsd="$ZSH_CONFIG/functions.d"
if [[ -d "$functionsd" ]] {
fpath=( $functionsd $fpath )
autoload -U $functionsd/*(:t)
@ -63,7 +63,7 @@ zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# caching of completion stuff
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "${HOME}/.zsh/${HOST}-cache"
zstyle ':completion:*' cache-path "$ZSH_CACHE"
# ~dirs: reorder output sorting: named dirs over userdirs

View File

@ -18,9 +18,10 @@ export LSCOLORS="gxfxcxdxbxegedabagacad"
export FPATH=/usr/local/share/zsh-completions:$FPATH
# activate gls colors
if [[ -a $HOME/.dir_colors ]]; then
export ZSH_DIRCOLORS="$ZSH_CONFIG/dircolors-solarized/dircolors.256dark"
if [[ -a $ZSH_DIRCOLORS ]]; then
if [[ "$TERM" == *256* ]]; then
which gdircolors > /dev/null && eval "`gdircolors -b $HOME/.dir_colors`"
which gdircolors > /dev/null && eval "`gdircolors -b $ZSH_DIRCOLORS`"
else
# standard colors for non-256-color terms
which gdircolors > /dev/null && eval "`gdircolors -b`"

1
dircolors-solarized Submodule

@ -0,0 +1 @@
Subproject commit 82342cd0ceb221d562e5107a7f53094aac098ea1

View File

@ -1,8 +1,9 @@
# activate ls colors, (private if possible)
if [[ -a $HOME/.dir_colors ]]; then
export ZSH_DIRCOLORS="$ZSH_CONFIG/dircolors-solarized/dircolors.256dark"
if [[ -a $ZSH_DIRCOLORS ]]; then
if [[ "$TERM" == *256* ]]; then
which dircolors > /dev/null && eval "`dircolors -b $HOME/.dir_colors`"
which dircolors > /dev/null && eval "`dircolors -b $ZSH_DIRCOLORS`"
else
# standard colors for non-256-color terms
which dircolors > /dev/null && eval "`dircolors -b`"

View File

@ -25,9 +25,9 @@ bindkey '^[[B' down-line-or-search
# History Settings (big history for use with many open shells and no dups)
# Different History files for root and standard user
if (( ! EUID )); then
HISTFILE=~/.zsh/history_root
HISTFILE=$ZSH_CACHE/history_root
else
HISTFILE=~/.zsh/history
HISTFILE=$ZSH_CACHE/history
fi
SAVEHIST=10000
HISTSIZE=12000

29
zshrc
View File

@ -4,37 +4,38 @@
# the main RC file (will be linked to ~/.zshrc)
#
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export ZSH_CONFIG="$XDG_CONFIG_HOME/zsh"
export ZSH_CACHE="$XDG_CACHE_HOME/zsh"
mkdir -p $ZSH_CACHE
typeset -ga sources
#sources+="$HOME/.zsh/colors.zsh" # maybe we do not need this anymore
sources+="$HOME/.zsh/options.zsh"
sources+="$HOME/.zsh/prompt.zsh"
sources+="$HOME/.zsh/functions.zsh"
sources+="$HOME/.zsh/aliases.zsh"
sources+="$ZSH_CONFIG/options.zsh"
sources+="$ZSH_CONFIG/prompt.zsh"
sources+="$ZSH_CONFIG/functions.zsh"
sources+="$ZSH_CONFIG/aliases.zsh"
# highlights the live command line
# Cloned From: git://github.com/nicoulaj/zsh-syntax-highlighting.git
sources+="$HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
sources+="$ZSH_CONFIG/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
# provides the package name of a non existing executable
# (sudo apt-get install command-not-found)
sources+="/etc/zsh_command_not_found"
# Bash and Zsh completion support for git-flow
# https://github.com/bobthecow/git-flow-completion
sources+="$HOME/.zsh/git-flow-completion/git-flow-completion.zsh"
# Autojump: a cd command that learns
# Cloned From: git://github.com/joelthelion/autojump.git
sources+="$HOME/.zsh/autojump/autojump.zsh"
sources+="$ZSH_CONFIG/autojump/autojump.zsh"
# Check for a system specific file
systemFile=`uname -s | tr "[:upper:]" "[:lower:]"`
sources+="$HOME/.zsh/$systemFile.zsh"
sources+="$ZSH_CONFIG/$systemFile.zsh"
# Finally include the private.zsh file
sources+="$HOME/.zsh/private.zsh"
sources+="$ZSH_CONFIG/private.zsh"
sources+="$HOME/.zsh/completion.zsh"
sources+="$ZSH_CONFIG/completion.zsh"
# try to include all sources
foreach file (`echo $sources`)