Commit fd4c2d89 authored by Martin Janů's avatar Martin Janů 🌱
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+10 −0
Original line number Diff line number Diff line

# Ignore all
/*

# Unignore this file
!/.gitignore

# Unignore zsh configuration
!/.zshrc
!/.zshenv

.zshenv

0 → 100644
+1 −0
Original line number Diff line number Diff line
export EDITOR="nano"

.zshrc

0 → 100644
+138 −0
Original line number Diff line number Diff line

### History options
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=10000
setopt appendhistory
# Do not append to history lines starting with space
setopt histignorespace
###

### Completions
# The following lines were added by compinstall

zstyle ':completion:*' completer _complete _ignored _correct _approximate
zstyle ':completion:*' expand suffix
zstyle ':completion:*' file-sort name
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' ignore-parents pwd
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*'
zstyle ':completion:*' max-errors 3
zstyle ':completion:*' menu select=long
zstyle ':completion:*' original true
zstyle ':completion:*' preserve-prefix '//[^/]##/'
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle :compinstall filename '$HOME/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall
###

### Prompt
autoload -U colors
colors

# git integration
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst

# Set the username color
usercolor="magenta"
case $USER in
    root)   usercolor=red;;
    martin) usercolor=blue;;
    xjanu)  usercolor=green;;
esac

# Set the hostname color
hostcolor="none"
if [ $SSH_CLIENT ]; then
    hostcolor="yellow"
fi

username="%{$fg_bold[$usercolor]%}%n%{$reset_color%}"
hostname="%{$fg_bold[$hostcolor]%}%m%{$reset_color%}"
workingdir="%~"
gitbranch="%{$fg[yellow]%}\$vcs_info_msg_0_%{$reset_color%}"
promptsymb="%{$fg[red]%}♥%{$reset_color%}"

PS1="$username@$hostname $workingdir $gitbranch$promptsymb "

# git integration
zstyle ':vcs_info:git:*' formats '%b%f '
zstyle ':vcs_info:*' enable git
###

### Key bindings
# set emacs mode
bindkey -e

# Use terminfo database for Home and End keys.
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
[[ -n "${key[Home]}"      ]] && bindkey -- "${key[Home]}"      beginning-of-line
[[ -n "${key[End]}"       ]] && bindkey -- "${key[End]}"       end-of-line
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
	autoload -Uz add-zle-hook-widget
	function zle_application_mode_start { echoti smkx }
	function zle_application_mode_stop { echoti rmkx }
	add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
	add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi
###

### Aliases
alias "ls"="ls -X --color=auto"
alias "ll"="ls -l"
alias "la"="ls -a"
alias "ghc"="ghc -dynamic"
###

### Colored man pages
man() {
    LESS_TERMCAP_md=$'\e[01;31m' \
    LESS_TERMCAP_me=$'\e[0m' \
    LESS_TERMCAP_se=$'\e[0m' \
    LESS_TERMCAP_so=$'\e[01;44;33m' \
    LESS_TERMCAP_ue=$'\e[0m' \
    LESS_TERMCAP_us=$'\e[01;32m' \
    command man "$@"
}
###

### Useful functions

modreload() {
    sudo rmmod $1
    sudo modprobe $1
}

#shreddir() {
#    for i in `find "$@" -type f`
#    do
#        shred -f -v -n 1 "$i"
#        sync
#        shred -f -v -n 0 -u "$i"
#    done
#    rm -vfr "$@"
#}

#encrypt() {
#    tar -cvzf - "$@" | \
#    openssl aes-256-cbc -md sha512 -pbkdf2 -iter 1000 -salt -in - -out out.tar.gz.enc
#    shreddir "$@"
#}

#decrypt() {
#    openssl aes-256-cbc -md sha512 -pbkdf2 -iter 1000 -d -in "$1" -out - | \
#    tar -xvzf -
#}

###