Initial commit.
This commit is contained in:
commit
fb6fd486e9
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# ZSH config
|
||||
|
||||
This is a ZSH configuration, baked by [Stanislav N. aka pztrn](http://en.pztrn.name/).
|
||||
|
||||
## Features
|
||||
|
||||
* Fully modular design.
|
||||
* Ability to write own mini-apps.
|
||||
* Support libraries support. Just write them and place in 'lib'. Don't forget to source them!
|
2
zsh/00-init.zsh
Normal file
2
zsh/00-init.zsh
Normal file
@ -0,0 +1,2 @@
|
||||
bindkey -e
|
||||
zstyle :compinstall filename '${CONFIG_PATH}/.zshrc'
|
11
zsh/10-exports.zsh
Normal file
11
zsh/10-exports.zsh
Normal file
@ -0,0 +1,11 @@
|
||||
export PATH="/home/pztrn/bin:/usr/lib:/usr/lib/colorgcc/bin:/usr/sbin:/sbin:/usr/local/heroku/bin:/data/Programs/hyde:$PATH"
|
||||
export EDITOR=nano
|
||||
|
||||
# More or less pretty fonts in Java programs.
|
||||
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'
|
||||
export JAVA_FONTS=/usr/share/fonts/TTF
|
||||
|
||||
# PyENV.
|
||||
export PYENV_ROOT="/data/.pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
eval "$(pyenv init -)"
|
3
zsh/11-autocomplete.zsh
Normal file
3
zsh/11-autocomplete.zsh
Normal file
@ -0,0 +1,3 @@
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
11
zsh/20-history.zsh
Normal file
11
zsh/20-history.zsh
Normal file
@ -0,0 +1,11 @@
|
||||
HISTFILE=~/.histfile
|
||||
HISTSIZE=1000
|
||||
SAVEHIST=1000
|
||||
|
||||
setopt extended_history
|
||||
setopt hist_expire_dups_first
|
||||
setopt hist_ignore_dups # ignore duplication command history list
|
||||
setopt hist_ignore_space
|
||||
setopt hist_verify
|
||||
setopt inc_append_history
|
||||
setopt share_history # share command history data
|
61
zsh/30-keys.zsh
Normal file
61
zsh/30-keys.zsh
Normal file
@ -0,0 +1,61 @@
|
||||
# This configuration was completely stolen from Oh-My-ZSH:
|
||||
# https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/key-bindings.zsh
|
||||
# Enchanced with more word actions (move backward and forward one word), I
|
||||
# prefer ALT key to do same thing.
|
||||
|
||||
# Make sure that the terminal is in application mode when zle is active, since
|
||||
# only then values from $terminfo are valid
|
||||
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
||||
function zle-line-init() {
|
||||
echoti smkx
|
||||
}
|
||||
function zle-line-finish() {
|
||||
echoti rmkx
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
fi
|
||||
|
||||
bindkey -e # Use emacs key bindings
|
||||
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
|
||||
bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
|
||||
bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
|
||||
if [[ "${terminfo[kpp]}" != "" ]]; then
|
||||
bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
|
||||
fi
|
||||
if [[ "${terminfo[knp]}" != "" ]]; then
|
||||
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
|
||||
fi
|
||||
if [[ "${terminfo[kcuu1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
|
||||
fi
|
||||
if [[ "${terminfo[kcud1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
|
||||
fi
|
||||
if [[ "${terminfo[khome]}" != "" ]]; then
|
||||
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
|
||||
fi
|
||||
if [[ "${terminfo[kend]}" != "" ]]; then
|
||||
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
|
||||
fi
|
||||
bindkey ' ' magic-space # [Space] - do history expansion
|
||||
bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
|
||||
bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
|
||||
bindkey '^[[1;3C' forward-word # [ALT-RightArrow] - move forward one word
|
||||
bindkey '^[[1;3D' backward-word # [ALT-LeftArrow] - move backward one word
|
||||
if [[ "${terminfo[kcbt]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcbt]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards
|
||||
fi
|
||||
bindkey '^?' backward-delete-char # [Backspace] - delete backward
|
||||
if [[ "${terminfo[kdch1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward
|
||||
else
|
||||
bindkey "^[[3~" delete-char
|
||||
bindkey "^[3;5~" delete-char
|
||||
bindkey "\e[3~" delete-char
|
||||
fi
|
||||
|
||||
# Edit the current command line in $EDITOR
|
||||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '\C-x\C-e' edit-command-line
|
12
zsh/40-prompt.zsh
Normal file
12
zsh/40-prompt.zsh
Normal file
@ -0,0 +1,12 @@
|
||||
# Load user desired prompt.
|
||||
|
||||
autoload -Uz promptinit
|
||||
promptinit
|
||||
|
||||
if [ "${PROMPT_THEME}" != "" ]; then
|
||||
if [ -f ${CONFIG_PATH}/zsh/prompts/${PROMPT_THEME}.zsh-theme ]; then
|
||||
source ${CONFIG_PATH}/zsh/prompts/${PROMPT_THEME}.zsh-theme
|
||||
else
|
||||
echo "Theme \"${PROMPT_THEME}\" could not be loaded. File does not exist or unreadable."
|
||||
fi
|
||||
fi
|
42
zsh/50-aliases.zsh
Normal file
42
zsh/50-aliases.zsh
Normal file
@ -0,0 +1,42 @@
|
||||
alias screen="TERM=xterm screen"
|
||||
|
||||
# AION ^_^
|
||||
#alias aion="cd /data/Programs/aion/ && WINEPREFIX="/home/pztrn/.wine-aion" wine AWLite.exe"
|
||||
|
||||
# SVN Add all in ABUILDS
|
||||
#alias addall="cd /data/AgiliaLinux/ABUILDS && sh svnadd.sh"
|
||||
|
||||
# VirtualBox Aliases
|
||||
alias as-start='VBoxManage startvm "Arch Linux Server" --type headless'
|
||||
alias as-stop='VBoxManage controlvm "Arch Linux Server" acpipowerbutton'
|
||||
|
||||
alias x86_64-start='VBoxManage startvm "Agilia x86_64" --type headless'
|
||||
alias x86_64-stop='VBoxManage controlvm "Agilia x86_64" acpipowerbutton'
|
||||
|
||||
# QTile
|
||||
alias qtcfg="nano ~/.config/qtile/config.py"
|
||||
|
||||
# Games
|
||||
alias regnum="/data/Programs/Regnum/rolauncher"
|
||||
alias ut2004="aoss /data/Programs/UT2004/ut2004"
|
||||
|
||||
#PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
|
||||
#source /home/pztrn/.rvm/scripts/rvm
|
||||
|
||||
# Xilitra
|
||||
alias xbs="/data/XILITRA/xbs/src/xbs.py"
|
||||
alias deptracker="/data/XILITRA/xilitra-dev-tools/deptracker/deptracker"
|
||||
alias xpkg="/data/XILITRA/xpkg/src/xpkg.py"
|
||||
|
||||
# Other
|
||||
alias clocksync="sudo ntpdate 0.pool.ntp.org"
|
||||
alias got="git"
|
||||
|
||||
# Blogs
|
||||
alias crotal="/data/.pyenv/versions/2.7.6/bin/crotal"
|
||||
|
||||
#alias yasearch="yaourt -Ss"
|
||||
#alias yainstall="yaourt -S"
|
||||
#alias yadel="yaourt -Rd"
|
||||
#alias sysupdate="yaourt -Syua"
|
||||
#alias flvgrab="ffmpeg -f alsa -f x11grab -r 30 -s 1920x1080 -i :0.0 -acodec pcm_s16le -vcodec flv -sameq"
|
20
zsh/99-fbterm.zsh
Normal file
20
zsh/99-fbterm.zsh
Normal file
@ -0,0 +1,20 @@
|
||||
# Launch fbterm on TTY login
|
||||
|
||||
# But first some pre-checks. nVidia proprietary drivers will not allow
|
||||
# us to use it, so we should disable this.
|
||||
|
||||
NVIDIA_POWERED=0
|
||||
lsmod | grep nvidia &> /dev/null
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
error 1 "Will not use FBTerm - nVidia proprietary driver detected"
|
||||
NVIDIA_POWERED=1
|
||||
fi
|
||||
|
||||
if [ ${USE_FBTERM} -gt 0 ]; then
|
||||
if [ ${NVIDIA_POWERED} -ne 1 ]; then
|
||||
if [[ "$TTY" =~ ".*tty.*" ]] then
|
||||
fbterm
|
||||
fi
|
||||
fi
|
||||
fi
|
0
zsh/aliases/.gitkeep
Normal file
0
zsh/aliases/.gitkeep
Normal file
0
zsh/apps/.gitkeep
Normal file
0
zsh/apps/.gitkeep
Normal file
4
zsh/apps/colors.app.zsh
Normal file
4
zsh/apps/colors.app.zsh
Normal file
@ -0,0 +1,4 @@
|
||||
function main()
|
||||
{
|
||||
//
|
||||
}
|
72
zsh/lib/logger.lib.sh
Normal file
72
zsh/lib/logger.lib.sh
Normal file
@ -0,0 +1,72 @@
|
||||
# Logger for debug output.
|
||||
|
||||
# Debug messages array.
|
||||
DEBUG_MESSAGES=("\033[1;32mINFO \033[1;m" "\033[1;36mDEBUG \033[1;m" "\033[1;31mHARDDEBUG\033[1;m")
|
||||
|
||||
# Colorize messages depending on verbosity level.
|
||||
VERB_LVL_COLORS=("\033[1;m" "\033[1;34m" "\033[1;35m")
|
||||
|
||||
# Formatted message will be placed in this variable.
|
||||
FORMATTED_MESSAGE=""
|
||||
|
||||
function log() {
|
||||
# Just log.
|
||||
log_common $1 "$2"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${VERB_LVL_COLORS[${1}]}${FORMATTED_MESSAGE}\033[1;m"
|
||||
fi
|
||||
}
|
||||
|
||||
function log_common() {
|
||||
# Executes some common things for logs.
|
||||
local DEBUG_LVL=$1
|
||||
local MESSAGE=$2
|
||||
|
||||
check_debug ${DEBUG_LVL}
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# All ok, printing...
|
||||
FORMATTED_MESSAGE="[${DEBUG_MESSAGES[${DEBUG_LVL}]}] ${MESSAGE}"
|
||||
return 0
|
||||
}
|
||||
|
||||
function error() {
|
||||
# Just log.
|
||||
error_common $1 "$2"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${VERB_LVL_COLORS[${1}]}${FORMATTED_MESSAGE}\033[1;m"
|
||||
fi
|
||||
}
|
||||
|
||||
function error_common() {
|
||||
# Executes some common things for logs.
|
||||
local DEBUG_LVL=$1
|
||||
local MESSAGE=$2
|
||||
|
||||
check_debug ${DEBUG_LVL}
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# All ok, printing...
|
||||
FORMATTED_MESSAGE="[ERROR] \033[1;31m${MESSAGE}\033[1;m"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
function check_debug() {
|
||||
# Checks for debug level and if it applicable to us.
|
||||
# Return codes:
|
||||
# - 0: this debug level is okay to be printed.
|
||||
# - 1: this debug level should not be printed.
|
||||
local DEBUG_LVL=$1
|
||||
|
||||
|
||||
if [ ${DEBUG_LVL} -le ${DEBUG} ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
72
zsh/prompts/pztrn.zsh-theme
Normal file
72
zsh/prompts/pztrn.zsh-theme
Normal file
@ -0,0 +1,72 @@
|
||||
# pztrn prompt theme
|
||||
autoload -U add-zsh-hook
|
||||
|
||||
prompt_pztrn_help () {
|
||||
cat <<'EOF'
|
||||
|
||||
prompt pztrn [<color1> [<color2> [<color3> [<color4> [<color5>]]]]]
|
||||
|
||||
defaults are red, cyan, green, yellow, and white, respectively.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
prompt_pztrn_setup () {
|
||||
local -a pcc
|
||||
local -A pc
|
||||
local p_date p_tty p_plat p_ver p_userpwd p_apm p_shlvlhist p_rc p_end p_win
|
||||
|
||||
autoload -Uz vcs_info
|
||||
|
||||
pcc[1]=${1:-${${SSH_CLIENT+'yellow'}:-'red'}}
|
||||
pcc[2]=${2:-'cyan'}
|
||||
pcc[3]=${3:-'green'}
|
||||
pcc[4]=${4:-'yellow'}
|
||||
pcc[5]=${5:-'white'}
|
||||
|
||||
pc['\[']="%F{$pcc[1]}["
|
||||
pc['\]']="%F{$pcc[1]}]"
|
||||
pc['<']="%F{$pcc[1]}<"
|
||||
pc['>']="%F{$pcc[1]}>"
|
||||
pc['\(']="%F{$pcc[1]}("
|
||||
pc['\)']="%F{$pcc[1]})"
|
||||
|
||||
p_date="$pc['\[']%F{$pcc[2]}%D{%a %y/%m/%d %R %Z}$pc['\]']"
|
||||
p_tty="$pc['\[']%F{$pcc[3]}%l$pc['\]']"
|
||||
p_plat="$pc['\[']%F{$pcc[2]}$(uname -r)$pc['\]']"
|
||||
p_ver="$pc['\[']%F{$pcc[2]}${ZSH_VERSION}$pc['\]']"
|
||||
|
||||
[[ -n "$WINDOW" ]] && p_win="$pc['\(']%F{$pcc[4]}$WINDOW$pc['\)']"
|
||||
|
||||
p_userpwd="$pc['\[']%F{$pcc[5]}User:%F{$pcc[3]} %n$pc['\]']$pc['\[']%F{$pcc[5]}Host:%F{$pcc[3]} %M$pc['\]']"
|
||||
|
||||
p_shlvlhist="$pc['\[']%F{$pcc[3]}%B%h%b$pc['\]']"
|
||||
p_rc="%(?..[%?%1v] )"
|
||||
p_end="%f%B%#%b "
|
||||
p_path="$pc['\[']%F{$pcc[4]} %d $pc['\]']"
|
||||
|
||||
zle_highlight[(r)default:*]=default:$pcc[2]
|
||||
|
||||
prompt="$p_date$p_tty$p_plat$p_ver$p_userpwd$p_shlvlhist
|
||||
$p_path $p_end"
|
||||
PS2='%(4_.\.)%3_> %E'
|
||||
|
||||
add-zsh-hook precmd prompt_pztrn_precmd
|
||||
}
|
||||
|
||||
prompt_pztrn_precmd () {
|
||||
setopt noxtrace noksharrays localoptions
|
||||
local exitstatus=$?
|
||||
local git_dir git_ref
|
||||
|
||||
psvar=()
|
||||
[[ $exitstatus -ge 128 ]] && psvar[1]=" $signals[$exitstatus-127]" ||
|
||||
psvar[1]=""
|
||||
|
||||
[[ -o interactive ]] && jobs -l
|
||||
|
||||
vcs_info
|
||||
[[ -n $vcs_info_msg_0_ ]] && psvar[2]="$vcs_info_msg_0_" || psvar[2]="NO"
|
||||
}
|
||||
|
||||
prompt_pztrn_setup "$@"
|
54
zshrc
Normal file
54
zshrc
Normal file
@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
# ^^^ THIS IS FOR SYNTAX HIGHLIGHT!
|
||||
|
||||
#. /etc/profile
|
||||
|
||||
#####################################################################
|
||||
# CONFIGURATION
|
||||
# -------------
|
||||
# You should set these variables :)
|
||||
#####################################################################
|
||||
# The very important thing - debug.
|
||||
# Should we enable debug output?
|
||||
DEBUG=0
|
||||
# Prompt configuration
|
||||
PROMPT_THEME="pztrn"
|
||||
|
||||
# FBTerm - should we use it?
|
||||
# nVidia users with proprietary drivers - sorry, you can't use it.
|
||||
USE_FBTERM=1
|
||||
|
||||
#####################################################################
|
||||
# INITIALIZATION
|
||||
# --------------
|
||||
# Here goes initialization thing.
|
||||
# DO NOT CHANGE ANYTHING, UNLESS YOU ARE KNOW WHAT ARE YOU DOING!
|
||||
#####################################################################
|
||||
# Get real script path.
|
||||
CONFIG_PATH=''
|
||||
CONFIG_FOUND=0
|
||||
|
||||
if [ -h ${HOME}/.zshrc ]; then
|
||||
CONFIG_PATH=`readlink ${HOME}/.zshrc`
|
||||
CONFIG_PATH=`dirname ${CONFIG_PATH}`
|
||||
if [ ${#CONFIG_PATH[@]} -gt 0 ]; then
|
||||
CONFIG_FOUND=1
|
||||
else
|
||||
echo "CONFIG_PATH has invalid value: '${CONFIG_PATH}'"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Some sourcing.
|
||||
source ${CONFIG_PATH}/zsh/lib/logger.lib.sh
|
||||
|
||||
if [ $CONFIG_FOUND -eq 1 ]; then
|
||||
for config_file in `ls ${CONFIG_PATH}/zsh/ | sort | grep zsh`; do
|
||||
source ${CONFIG_PATH}/zsh/${config_file}
|
||||
done
|
||||
else
|
||||
echo "Failed to load configuration."
|
||||
fi
|
||||
|
||||
set -B
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user