refactor to use XDG directories and dircolors in config
This commit is contained in:
parent
82bdb2b304
commit
d562581685
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -4,3 +4,6 @@
|
||||||
[submodule "autojump"]
|
[submodule "autojump"]
|
||||||
path = autojump
|
path = autojump
|
||||||
url = git://github.com/joelthelion/autojump.git
|
url = git://github.com/joelthelion/autojump.git
|
||||||
|
[submodule "dircolors-solarized"]
|
||||||
|
path = dircolors-solarized
|
||||||
|
url = git://github.com/seebi/dircolors-solarized.git
|
||||||
|
|
23
README
23
README
|
@ -3,21 +3,18 @@
|
||||||
|
|
||||||
Due to many requests I share my zsh configuration compilation.
|
Due to many requests I share my zsh configuration compilation.
|
||||||
Copy the repository to ~/.zsh and run 'make install' once
|
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
|
### File description
|
||||||
~/.zsh/README - This file
|
$ZSH_CONFIG/README - This file
|
||||||
~/.zsh/Makefile - make-config to run with 'make install'
|
$ZSH_CONFIG/Makefile - make-config to run with 'make install'
|
||||||
~/.zsh/aliases - alias definitions which can be edited/modified with 'aedit'
|
$ZSH_CONFIG/aliases - alias definitions which can be edited/modified with 'aedit'
|
||||||
~/.zsh/completion - tab completion configuration
|
$ZSH_CONFIG/completion - tab completion configuration
|
||||||
~/.zsh/functions - functions and key bindings to that functions
|
$ZSH_CONFIG/functions - functions and key bindings to that functions
|
||||||
~/.zsh/options - shell options as history size, general keyindings, etc
|
$ZSH_CONFIG/options - shell options as history size, general keyindings, etc
|
||||||
~/.zsh/prompt - the prompt definition
|
$ZSH_CONFIG/prompt - the prompt definition
|
||||||
~/.zsh/zshrc - the main RC file (will be linked to ~/.zshrc)
|
$ZSH_CONFIG/zshrc - the main RC file (will be linked to ~/.zshrc)
|
||||||
|
|
||||||
### These files are not in the repository but will be created
|
### These files are not in the repository but will be created
|
||||||
~/.zsh/history - the history file (shared for all zsh instances)
|
$ZSH_CACHE/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.
|
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,9 @@ alias j=' j'
|
||||||
# default ls is untouched, except coloring
|
# default ls is untouched, except coloring
|
||||||
alias ls=' ls --color=auto'
|
alias ls=' ls --color=auto'
|
||||||
alias myls=' ls -C -F -h --color=always'
|
alias myls=' ls -C -F -h --color=always'
|
||||||
alias l=" myls"
|
alias l=" myls -l"
|
||||||
alias ll=' myls -l'
|
alias ll=' myls -l'
|
||||||
alias la=' myls -A'
|
alias la=' myls -lA'
|
||||||
alias v=" clear; ll -gh" # standard directory view
|
alias v=" clear; ll -gh" # standard directory view
|
||||||
alias vs=" v **/*(.)" # show all files in all subdirs plain in a list
|
alias vs=" v **/*(.)" # show all files in all subdirs plain in a list
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
# add an autoload function path, if directory exists
|
# add an autoload function path, if directory exists
|
||||||
# http://www.zsh.org/mla/users/2002/msg00232.html
|
# http://www.zsh.org/mla/users/2002/msg00232.html
|
||||||
functionsd="$HOME/.zsh/functions.d"
|
functionsd="$ZSH_CONFIG/functions.d"
|
||||||
if [[ -d "$functionsd" ]] {
|
if [[ -d "$functionsd" ]] {
|
||||||
fpath=( $functionsd $fpath )
|
fpath=( $functionsd $fpath )
|
||||||
autoload -U $functionsd/*(:t)
|
autoload -U $functionsd/*(:t)
|
||||||
|
@ -63,7 +63,7 @@ zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||||
|
|
||||||
# caching of completion stuff
|
# caching of completion stuff
|
||||||
zstyle ':completion:*' use-cache on
|
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
|
# ~dirs: reorder output sorting: named dirs over userdirs
|
||||||
|
|
|
@ -18,9 +18,10 @@ export LSCOLORS="gxfxcxdxbxegedabagacad"
|
||||||
export FPATH=/usr/local/share/zsh-completions:$FPATH
|
export FPATH=/usr/local/share/zsh-completions:$FPATH
|
||||||
|
|
||||||
# activate gls colors
|
# 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
|
if [[ "$TERM" == *256* ]]; then
|
||||||
which gdircolors > /dev/null && eval "`gdircolors -b $HOME/.dir_colors`"
|
which gdircolors > /dev/null && eval "`gdircolors -b $ZSH_DIRCOLORS`"
|
||||||
else
|
else
|
||||||
# standard colors for non-256-color terms
|
# standard colors for non-256-color terms
|
||||||
which gdircolors > /dev/null && eval "`gdircolors -b`"
|
which gdircolors > /dev/null && eval "`gdircolors -b`"
|
||||||
|
|
1
dircolors-solarized
Submodule
1
dircolors-solarized
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 82342cd0ceb221d562e5107a7f53094aac098ea1
|
|
@ -1,8 +1,9 @@
|
||||||
|
|
||||||
# activate ls colors, (private if possible)
|
# 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
|
if [[ "$TERM" == *256* ]]; then
|
||||||
which dircolors > /dev/null && eval "`dircolors -b $HOME/.dir_colors`"
|
which dircolors > /dev/null && eval "`dircolors -b $ZSH_DIRCOLORS`"
|
||||||
else
|
else
|
||||||
# standard colors for non-256-color terms
|
# standard colors for non-256-color terms
|
||||||
which dircolors > /dev/null && eval "`dircolors -b`"
|
which dircolors > /dev/null && eval "`dircolors -b`"
|
||||||
|
|
|
@ -25,9 +25,9 @@ bindkey '^[[B' down-line-or-search
|
||||||
# History Settings (big history for use with many open shells and no dups)
|
# History Settings (big history for use with many open shells and no dups)
|
||||||
# Different History files for root and standard user
|
# Different History files for root and standard user
|
||||||
if (( ! EUID )); then
|
if (( ! EUID )); then
|
||||||
HISTFILE=~/.zsh/history_root
|
HISTFILE=$ZSH_CACHE/history_root
|
||||||
else
|
else
|
||||||
HISTFILE=~/.zsh/history
|
HISTFILE=$ZSH_CACHE/history
|
||||||
fi
|
fi
|
||||||
SAVEHIST=10000
|
SAVEHIST=10000
|
||||||
HISTSIZE=12000
|
HISTSIZE=12000
|
||||||
|
|
29
zshrc
29
zshrc
|
@ -4,37 +4,38 @@
|
||||||
# the main RC file (will be linked to ~/.zshrc)
|
# 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
|
typeset -ga sources
|
||||||
#sources+="$HOME/.zsh/colors.zsh" # maybe we do not need this anymore
|
sources+="$ZSH_CONFIG/options.zsh"
|
||||||
sources+="$HOME/.zsh/options.zsh"
|
sources+="$ZSH_CONFIG/prompt.zsh"
|
||||||
sources+="$HOME/.zsh/prompt.zsh"
|
sources+="$ZSH_CONFIG/functions.zsh"
|
||||||
sources+="$HOME/.zsh/functions.zsh"
|
sources+="$ZSH_CONFIG/aliases.zsh"
|
||||||
sources+="$HOME/.zsh/aliases.zsh"
|
|
||||||
|
|
||||||
# highlights the live command line
|
# highlights the live command line
|
||||||
# Cloned From: git://github.com/nicoulaj/zsh-syntax-highlighting.git
|
# 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
|
# provides the package name of a non existing executable
|
||||||
# (sudo apt-get install command-not-found)
|
# (sudo apt-get install command-not-found)
|
||||||
sources+="/etc/zsh_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
|
# Autojump: a cd command that learns
|
||||||
# Cloned From: git://github.com/joelthelion/autojump.git
|
# 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
|
# Check for a system specific file
|
||||||
systemFile=`uname -s | tr "[:upper:]" "[:lower:]"`
|
systemFile=`uname -s | tr "[:upper:]" "[:lower:]"`
|
||||||
sources+="$HOME/.zsh/$systemFile.zsh"
|
sources+="$ZSH_CONFIG/$systemFile.zsh"
|
||||||
|
|
||||||
# Finally include the private.zsh file
|
# 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
|
# try to include all sources
|
||||||
foreach file (`echo $sources`)
|
foreach file (`echo $sources`)
|
||||||
|
|
Loading…
Reference in a new issue