Initial commit

This commit is contained in:
Thomas FORGIONE
2016-08-22 12:04:24 +02:00
commit 8d1984cc69
8 changed files with 533 additions and 0 deletions

38
zsh/aliases.zsh Normal file
View File

@@ -0,0 +1,38 @@
# Some aliases
# v is shorter
alias v="$EDITOR"
# htop is better
alias top="htop"
# Vim like alias
alias :q="exit"
# Avoid typos
alias ake="make"
# My pdf reader
alias pdf="evince"
# Auto color on pacman
alias pacman='pacman --color=auto'
# clean for cmake files
alias cclean='\rm -r `find . -name "CMakeCache.txt"` `find . -name "cmake_install.cmake"` `find . -name "CMakeFiles"` `find . -name "Makefile"`'
# Some games
alias war3="optirun wine /home/thomas/.wine/drive_c/Program\ Files/Warcraft/War3.exe -opengl"
alias nox="cd /home/thomas/.wine/drive_c/Westwood/Nox/; optirun wine Game.exe; cd -1"
# Start jekyll server easily
alias jekyll="bundle exec jekyll serve"
# Some cd aliases
alias cd..="cd .."
alias cd...="cd ../.."
alias cd....="cd ../../.."
alias lsd="ls"
# Make wd command work
alias wd=". wd"

79
zsh/config.zsh Normal file
View File

@@ -0,0 +1,79 @@
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
ZSH_CUSTOM=$DOTFILES/zsh/oh-my-zsh
ZSH_THEME="laptop"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Uncomment following line if you want to disable autosetting terminal title.
DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/me
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
# Source gulp completion
# source ~/.config/zsh/extensions/gulp.plugin.zsh/gulp.plugin.zsh
# Config of stderred
# if [ -f "/usr/lib/libstderred.so" ]; then
# export LD_PRELOAD="/usr/lib/libstderred.so"
# fi
unsetopt correctall
unsetopt autocd
unsetopt cdablevars
setopt inc_append_history
unsetopt share_history
setopt HIST_IGNORE_SPACE
export HISTSIZE=100000
export SAVEHIST=$HISTSIZE
autoload -Uz up-line-or-beginning-search
autoload -Uz down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
zle -N gnome_function
bindkey '\eOA' up-line-or-beginning-search
bindkey '\e[A' up-line-or-beginning-search
bindkey '\eOB' down-line-or-beginning-search
bindkey '\e[B' down-line-or-beginning-search
bindkey "\e[H" beginning-of-line # Début
bindkey "\e[F" end-of-line # Fin
zstyle ':completion:*:processes' command 'ps -ax'
zstyle ':completion:*:processes-names' command 'ps -aeo comm='
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:*:killall:*:processes-names' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:*:killall:*' menu yes select
# Fancy ctrl-z
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
bg
zle redisplay
else
zle push-input
fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
zstyle ':completion:*:*:vim:*:*files' ignored-patterns '*.o|*.class|*.pdf|*.tar|*.tar.gz|main'
zstyle ':completion:*:*:vimcat:*:*files' ignored-patterns '*.o|*.class|*.pdf|*.tar|*.tar.gz|main'
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \
/usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
zstyle ':completion:*:back:*' command-path /usr/local/sbin /usr/local/bin \
/usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
zstyle ':completion:*:optirun:*' command-path /usr/local/sbin /usr/local/bin \
/usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin

22
zsh/exports.zsh Normal file
View File

@@ -0,0 +1,22 @@
# The path
export PATH=$PATH/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl:/opt/android-ndk:/usr/lib/emscripten:/home/thomas/.script/check:/home/thomas/.gem/ruby/2.3.0/bin:/home/thomas/.script/blog:/home/thomas/.script/mail:/home/thomas/.script/
# My editor
export EDITOR="nvim"
# Some config
export LD_LIBRARY_PATH=/usr/lib
export LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1'
export MAKEFLAGS="-j`nproc`"
# Paths needed for soft
export CLASSPATH="$CLASSPATH:/home/thomas/.java/packages/*:/home/thomas/.java/packages/lib/*:/usr/share/java/*:/usr/share/scala/lib/*"
export MATLABPATH=$HOME/.matlab2
export GOPATH="$HOME/.config/go"
export LATEX_HOME=.
export LATEX_INCLUDES=/home/thomas/Prog/People/David/latexEditor/includes
# I want clang as default compiler
export CC="clang"
export CXX="clang++"
export WINEDEBUG=-all

90
zsh/functions.zsh Normal file
View File

@@ -0,0 +1,90 @@
# Some helping functions
### File manipulation ###
# Copy to clipboard
copy() {
if [ $# -eq 0 ]; then
xclip -selection c
else
cat $1 | xclip -selection c
fi
}
# Swap files
swap() {
local tmp=`mktemp`
mv "$1" "$tmp"
mv "$2" "$1"
mv "$tmp" "$2"
}
# mkdir && cd
mkcd() {
mkdir $1 && cd $1
}
### Vim helpers ###
vclass() {
v src/"$1".cpp -c ":vs include/$1.hpp"
}
vide() {
v $1 -c ":NERDTree"
}
v2() {
v $1 -c ":vs $2"
}
vfind() {
v `find . -name "$1"`
}
### Awesome functions ###
# Wallpaper change
wallpaper() {
case $1 in
'vixen' ) echo "change_wallpaper('vixen.jpg');" | awesome-client;;
'vixen2' ) echo "change_wallpaper('vixen2.jpg');" | awesome-client;;
'arch' ) echo "change_wallpaper('arch4.png');" | awesome-client;;
'harley' ) echo "change_wallpaper('1200custom.png');" | awesome-client;;
*) return -1
esac
}
# Notify to awesome
notify() {
if [ $# -lt 2 ]; then
echo "naughty.notify({text = \"$1\", timeout = 10})" | awesome-client
elif [ $# -lt 3 ]; then
echo "naughty.notify({title=\"$1\", text = \"$2\", timeout = 10})" | awesome-client
fi
}
### Others ###
# colors for the man pages
man() {
env LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
# Better svn log
svn() {
case $* in
log ) shift 1; command svn log "$@" | less ;;
* ) command svn "$@" ;;
esac
}
# Clears resolv.conf with google's dns
resolv() {
echo 'nameserver 8.8.8.8' | sudo tee /etc/resolv.conf > /dev/null
}
# Generate a standard LaTeX maefile
makelatex() {
cp /home/thomas/.script/classgen/Makefile.latex ./Makefile
}

View File

@@ -0,0 +1,68 @@
# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
# Based on bira theme
# load some modules
autoload -U colors zsh/terminfo # Used in the colour alias below
colors
setopt prompt_subst
# make some aliases for the colours: (coud use normal escap.seq's too)
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$fg[${(L)color}]%}'
done
eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
eval PR_BOLD="%{$terminfo[bold]%}"
# Check the UID
if [[ $UID -ge 1000 ]]; then # normal user
eval PR_USER='${PR_MAGENTA}%n${PR_NO_COLOR}'
eval PR_USER_OP='${PR_BLUE}%#${PR_NO_COLOR}'
local PR_PROMPT='$PR_NO_COLOR▶$PR_NO_COLOR'
local PR_ARROW_UP='╭── '
local PR_ARROW_DOWN='╰'
elif [[ $UID -eq 0 ]]; then # root
eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
local PR_ARROW_UP='${PR_RED}╭── ${PR_NO_COLOR}'
local PR_ARROW_DOWN='${PR_RED}╰${PR_NO_COLOR}'
local PR_PROMPT='$PR_RED▶$PR_NO_COLOR'
fi
# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' #SSH
else
eval PR_HOST='${PR_BLUE}%M${PR_NO_COLOR}' # no SSH
fi
# local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
local user_host='$PR_BOLD${PR_USER}$PR_BOLD'
local current_dir='$PR_BOLD%{$PR_BLUE%}%~%{$PR_NO_COLOR%}'
local rvm_ruby=''
if which rvm-prompt &> /dev/null; then
rvm_ruby='%{$PR_RED%}$(rvm-prompt i v g s)%{$PR_NO_COLOR%}'
else
if which rbenv &> /dev/null; then
rvm_ruby='%{$PR_RED%}$(rbenv version | sed -e "s/ (set.*$//")%{$PR_NO_COLOR%}'
fi
fi
local return_code=""
local git_branch='$(git_prompt_info)'
#PROMPT="${user_host} ${current_dir} ${rvm_ruby}${git_branch}$PR_PROMPT "
separator='${PR_YELLOW}::${PR_NO_COLOR}'
tty | read tty_value
if [[ $tty_value == *pts* ]]; then # if in a tty
PROMPT="$PR_ARROW_UP${user_host}${separator}${PR_NO_COLOR}${current_dir} ${rvm_ruby} ${git_branch}
$PR_ARROW_DOWN$PR_PROMPT ${PR_NO_COLOR}"
return_code="%(?.%{$PR_GREEN%}%? ↵%{$PR_NO_COLOR%}.%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
else
eval PR_NO_COLOR="$PR_WHITE"
PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}> ${PR_NO_COLOR}"
return_code="%(?.%{$PR_GREEN%}%? <%{$PR_NO_COLOR%}.%{$PR_RED%}%? <%{$PR_NO_COLOR%})"
fi
RPS1=" ${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$PR_NO_COLOR%}"