commit 7958f6eafc56153d645c49fcf01e859631e39115 Author: lhark Date: Wed Jun 3 23:39:41 2015 +0200 Adds installation script diff --git a/gitconfig b/gitconfig new file mode 100644 index 0000000..877ddba --- /dev/null +++ b/gitconfig @@ -0,0 +1,3 @@ +[user] + email = lhark@hotmail.fr + name = lhark diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..5be1736 --- /dev/null +++ b/install.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") + +FILES="vimrc zshrc gitconfig" + +for file in {$FILES} do + ln -s -T {$SCRIPTPATH}{$file} .{$file} + mv -P .{$file} /home/{$USER} +done diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..cc0f911 --- /dev/null +++ b/vimrc @@ -0,0 +1,431 @@ +"on: [1.8.8]" +""""""""""""""""""""""""""""""""" +"Author: [Karlkorp, Inc. 2014]" +"""""""""""""""""""""""""""""""""""""""""""""""" +"Type: [Vim/GVim/MacVim configuration file]" +"""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"Name: [.vimrc (unix/mac); _vimrc (MS Windows/DOS)]" +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"Location: [$HOME/.vimrc (unix/mac); $USERNAME\_vimrc (MS Windows)]" +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"[Plug-ins list]"""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"+------------------+-------------------------------------------------+" +"| CtrlP | https://github.com/kien/ctrlp.vim |" +"| Undotree | https://github.com/mbbill/undotree |" +"| Python-Mode | https://github.com/klen/python-mode |" +"| Tagbar | https://github.com/majutsushi/tagbar |" +"| Tabular | https://github.com/godlygeek/tabular |" +"| Vim-Perl | https://github.com/vim-perl/vim-perl |" +"| Surround | https://github.com/tpope/vim-surround |" +"| Vim-Startify | https://github.com/mhinz/vim-startify |" +"| NERDTree | https://github.com/scrooloose/nerdtree |" +"| DelimitMate | https://github.com/Raimondi/delimitMate |" +"| Vundle | https://github.com/gmarik/Vundle.vim.git |" +"| SnipMate | https://github.com/msanders/snipmate.vim |" +"| EasyMotion | https://github.com/Lokaltog/vim-easymotion |" +"| AutoComplPop | https://github.com/vim-scripts/AutoComplPop |" +"| Multiple-Cursors | https://github.com/terryma/vim-multiple-cursors |" +"+------------------+-------------------------------------------------+" +"[Colorschemes list]"""""""""""""""""""""""""""""""""""""""""""""""""""" +"+------------------+-------------------------------------------------+" +"| Molokai | https://github.com/tomasr/molokai |" +"| Mirodark | https://github.com/djjcast/mirodark |" +"+------------------+-------------------------------------------------+" +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"[To disable compatibility with Vi]" +set nocompatible +"[Use Plug-ins and Plug-in Manager(Vundle) only on UNIX or MAC OS]" +if has("unix") || has("mac") +filetype off +"[Download and install Vundle Plug-in Manager]" +try +if !isdirectory(expand("$HOME/.vim/bundle")) +silent !mkdir -p $HOME/.vim/bundle +silent cd $HOME/.vim/bundle +silent !git clone https://github.com/gmarik/Vundle.vim.git +silent cd $HOME +endif +"[Run Plug-ins]" +set runtimepath+=$HOME/.vim/bundle/Vundle.vim +call vundle#begin() +Plugin 'gmarik/Vundle.vim' +map :VundleInstall +map :VundleUpdate +if has("python") +Plugin 'klen/python-mode' +endif +if has("perl") +Plugin 'vim-perl/vim-perl' +endif +if has("ruby") +Plugin 'terryma/vim-multiple-cursors' +endif +Plugin 'majutsushi/tagbar' +map :TagbarToggle +Plugin 'mbbill/undotree' +map :UndotreeToggle +Plugin 'scrooloose/nerdtree' +map :NERDTreeToggle +Plugin 'AutoComplPop' +Plugin 'kien/ctrlp.vim' +Plugin 'godlygeek/tabular' +Plugin 'tpope/vim-surround' +Plugin 'mhinz/vim-startify' +Plugin 'Raimondi/delimitMate' +Plugin 'msanders/snipmate.vim' +Plugin 'Lokaltog/vim-easymotion' +"[Vim colorschemes]" +Plugin 'tomasr/molokai' +Plugin 'djjcast/mirodark' +call vundle#end() +catch +endtry +else +filetype on +endif +"[Recognize the type/syntax of the file]" +filetype plugin on +filetype indent on +set omnifunc=syntaxcomplete#Complete +"[Enable built-in plug-ins/macros]" +runtime macros/matchit.vim +"[Enable syntax highlighting]" +syntax on +"[Read the changes after the save .vimrc]" +if has("autocmd") +autocmd! BufWritePost $MYVIMRC source $MYVIMRC +endif +"[Define the leader key]" +let mapleader="," +"[List of buffers]" +map :ls!:buffer +"[Reselect visual block after indent/outdent]" +vnoremap < >gv +"[Improve up/down movement on wrapped lines]" +nnoremap j gj +nnoremap k gk +"[Clear search highlights]" +nnoremap // :nohlsearch +"[Easy split navigation]" +nnoremap j +nnoremap k +nnoremap h +nnoremap l +"[Locate the desired objects in the center of the screen]" +nnoremap n nzz +nnoremap N Nzz +nnoremap * *zz +nnoremap # #zz +"[New line under/bellow current line without jump to insert-mode]" +nnoremap o o +nnoremap O O +"[Auto-complete parenthesis, brackets and braces, quotes]" +"inoremap " "" +"inoremap ' '' +"inoremap ( () +"inoremap [ [] +"inoremap { {} +"[Easy jump into the normal-mode from the insert-mode]" +inoremap jj +"[To move over parenthesis, brackets, quotes in insert-mode]" +inoremap kk +inoremap hh +"[Easy omni-completion with Ctrl-Space]" +inoremap +"[To disable the arrow keys]" +"for prefix in ['i', 'n', 'v'] +"for key in ['', '', '', ''] +"execute prefix . "noremap " . key . " " +"endfor +"endfor +"[Threshold for reporting number of lines changed]" +set report=0 +"[Show command in the last line of the screen]" +set showcmd +"[Show both the tag name and a tidied-up form of the search pattern]" +set showfulltag +"[Don't give the intro message when starting Vim]" +set shortmess="" +if has("unix") || has("mac") +set shortmess+=I +endif +"[Always show StatusLine]" +set laststatus=2 +"[Define StatusLine]" +set statusline="" +set statusline+=%F%m%r%h%w +set statusline+=%=%y +set statusline+=\ [%{&ff}] +set statusline+=\ Line:%l/%L[%p%%] +set statusline+=\ Column:[%v] +set statusline+=\ Buffer:[%n] +set statusline+=\ Mode:[%{ShowModeInStatusLine()}] +"[Splitting rules]" +set splitbelow +set splitright +set equalalways +"[Lisp coding settings]" +if (&filetype == "lisp") +set lisp +endif +"[Use the mouse in terminal]" +set mouse=a +set mousemodel=extend +"[Hide mouse while printing the text]" +set mousehide +"[Visualisation settings]" +set background=dark +set ttyfast +set showmode +set tabline="" +set cmdheight=1 +set showtabline=0 +set colorcolumn="" +set nocursorcolumn +set cmdwinheight=10 +set virtualedit=all +"[GUI/Color Scheme/Font settings]" +if has("gui_running") +winsize 90 50 +silent cd $HOME +set linespace=0 +set guioptions="" +set guitablabel="" +if has("autocmd") +autocmd InsertEnter * set cursorline +autocmd InsertLeave * set nocursorline +endif +if has("win32") || has("win64") +try +colorscheme desert +set guifont=PT_Mono:h11 +catch +endtry +elseif has("unix") +try +colorscheme mirodark +set guifont=PT\ Mono\ 11 +catch +endtry +elseif has("mac") +try +set antialias +colorscheme molokai +set guifont=Monaco:h11 +catch +endtry +endif +else +if has("unix") || has("mac") +try +set t_Co=256 +colorscheme desert +catch +endtry +endif +endif +"[Backspace functions]" +set backspace=indent,eol,start +"[Scroll settings]" +set scrolloff=10 +set scrolljump=10 +set showmatch +set matchpairs="" +set matchpairs+=(:) +set matchpairs+={:} +set matchpairs+=[:] +set matchpairs+=<:> +"[Turn backup off and value of history]" +set nobackup +set noswapfile +set history=1000 +set nowritebackup +set undolevels=5000 +"[Indent & Tab/mode-line settings]" +set nopaste +set modeline +set smarttab +set tabstop=4 +set expandtab +set autoindent +set copyindent +set smartindent +set cinwords="" +set modelines=1 +set shiftwidth=4 +set softtabstop=4 +set cinwords+=except,finally,def,class,with,do +set cinwords+=if,elif,else,for,while,try,switch +"[TextWidth settings]" +set textwidth=80 +"[Settings of line numbers]" +set number +set numberwidth=2 +"[Don't show current position]" +set noruler +"[For regular expressions turn magic on]" +set magic +"[Search settings]" +set hlsearch +set incsearch +set smartcase +set ignorecase +"[When on, the ":substitute" flag 'g' is default on]" +set nogdefault +"[Language settings]" +set iminsert=0 +set imsearch=0 +set helplang=en +set langmenu=en +language messages POSIX +"[Show DocName in title]" +set title +"[Hide/show the white-space and more invisible symbols]" +set list +set listchars=tab:\|-,trail:- +set nojoinspaces +"[Folding settings]" +set foldenable +set foldclose="" +set foldcolumn=1 +set foldlevel=10 +set foldlevelstart=10 +set foldmethod=indent +set foldopen=block,hor,mark,percent,quickfix,search,tag,undo +"[Set to auto-read and to auto-write when +" a file is changed from the outside]" +set autoread +set autowrite +"[Vim will change the current working directory whenever you +" open a file, switch buffers, delete a buffer or open/close a window]" +set autochdir +"[Not be redrawn while executing macros, +" registers that have not been typed]" +set lazyredraw +"[Time-out settings]" +set timeout +set timeoutlen=3000 +set ttimeoutlen=100 +"[When off a buffer is unloaded when it is abandoned]" +set hidden +"[Switch between buffers. Settings]" +set switchbuf=useopen,usetab,newtab +"[Wrap settings]" +set wrap +set wrapscan +set whichwrap=<,>,[,] +set nolinebreak +"[Encoding/FileType settings]" +set encoding=utf-8 +set termencoding=utf-8 +set fileencoding=utf-8 +set fileencodings=utf-8,cp1251,koi8-r +"[Use UNIX, DOS, MAC FileType]" +set fileformat=unix +set fileformats=unix,mac,dos +"[Better consistency between Windows and UNIX]" +set sessionoptions="" +set viewoptions=folds,options,cursor,unix,slash +set sessionoptions+=unix,slash,blank,buffers,curdir +set sessionoptions+=folds,help,options,tabpages,winsize +"[Completion settings]" +if has("autocmd") +autocmd FileType c set omnifunc=ccomplete#Complete +autocmd FileType css set omnifunc=csscomplete#CompleteCSS +autocmd FileType html set omnifunc=htmlcomplete#CompleteTags +if has("ruby") +autocmd FileType ruby set omnifunc=rubycomplete#Complete +endif +if has("perl") +autocmd FileType perl set omnifunc=perlcomplete#CompletePERL +endif +if has("python") +autocmd FileType python set omnifunc=pythoncomplete#Complete +endif +autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS +endif +"[Completion search settings]" +set complete=.,b,d,i,k,s,t,u,U,w +set completeopt=longest,menuone,preview,menu +"[For jump between Java import statement]" +set includeexpr=substitute(v:fname,'\\.','/','g') +"[Determines the maximum number of items +" to show in the popup menu for Insert mode completion]" +set pumheight=7 +"[No annoying sound or errors]" +set noerrorbells +set novisualbell +"[Shared with OS clipboard]" +set clipboard=unnamed +"[Abbreviations]" +cnoreabbrev W w +cnoreabbrev Q q +"[Turn on the wild menu and wild-mode settings]" +set wildmenu +set wildmode=list:longest,full +set wildignore=*.o,*.obj,*.pyc,*.pyo,*.swp,*.bak,*.exe,*.class +"[Use a GUI dialog when confirming]" +set confirm +"[Method used for encryption when the buffer is written to a file]" +if (version <= 702) +set cryptmethod=zip +else +set cryptmethod=blowfish +endif +"[Make the scripts executable]" +function! ChangeScriptMode() +if getline(1) =~ "#!" +if getline(1) =~ "bin/" +silent !chmod +x +endif +endif +endfunction +if has("unix") || has("mac") +if has("autocmd") +autocmd BufWritePost * call ChangeScriptMode() +endif +endif +"[Python/Perl scripts templates]" +function! InitScriptFile(type) +if (a:type == "python") +execute setline(1, "#!/usr/bin/env python") +execute setline(2, "# -*- coding: utf-8 -*-") +elseif (a:type == "perl") +execute setline(1, "#!/usr/bin/env perl") +execute setline(2, "") +execute setline(3, "use warnings;") +execute setline(4, "use strict;") +endif +normal Go +endfunction +if has("autocmd") +autocmd BufNewFile *.pl,*.pm call InitScriptFile("perl") +autocmd BufNewFile *.py,*.pyw call InitScriptFile("python") +endif +"[Remove tabs and spaces at the end of lines]" +function! DeleteTrailingTWS() +normal mb +silent %s/[ \t]*$//g +silent %s/\s\+$//ge +normal 'b +endfunction +if has("autocmd") +autocmd BufWritePre *.py,*.pyw retab +autocmd BufWritePre * call DeleteTrailingTWS() +endif +"[Show current mode in StatusLine]" +function! ShowModeInStatusLine() +let g:currentMode = mode() +let g:showMode = "" +if (g:currentMode ==# "i") +let g:showMode = "Insert" +elseif (g:currentMode ==# "R") +let g:showMode = "Replace" +elseif (g:currentMode ==# "n") +let g:showMode = "Normal" +else +let g:showMode = "Visual" +endif +return g:showMode +endfunction""""""""""""""""""" diff --git a/zshrc b/zshrc new file mode 100644 index 0000000..d11bd26 --- /dev/null +++ b/zshrc @@ -0,0 +1,412 @@ +# zshrc inspiré de celui de la fromation debian de VIA +# modifié par David_5_1 +# http://formation-debian.via.ecp.fr/ +# Ajouts depuis le wiki de archlinux http://wiki.archlinux.fr/Zsh +# et depuis http://doc.ubuntu-fr.org/zsh +# et depuis http://zsh.sourceforge.net/Guide/zshguide.html +# utilisation de https://github.com/zsh-users/zsh-syntax-highlighting + +# adapté par lhark + + +# Ajout de */sbin au PATH (pour ifconfig en particulier) +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:~/bin + +# Configuration for virtualenv +export WORKON_HOME=$HOME/.virtualenvs +source /usr/local/bin/virtualenvwrapper.sh > /dev/null 2>&1 + +# Titre du terminal +case $TERM in + xterm*) + preexec () { + print -Pn "\e]0;$1 -- ${USER}@${HOST}\a" + } + ;; +esac + +# Aliases +alias ls='ls --classify --tabsize=0 --literal --color=auto --show-control-chars -h' +alias ll='ls -lha' +# alias la='ls -A' +# alias lla='ls -la' +# alias less='less --quiet' +alias df='df --human-readable' +alias du='du --human-readable' +# alias mutt='mutt -y' +alias upgrade='sudo apt-get update && sudo apt-get -dy dist-upgrade && sudo apt-get dist-upgrade' +# alias -g GP='|grep ' +alias grep="grep --color" +alias ssh='ssh -A' +# alias -s txt=cat +alias rm='rm -I' +alias ipa='ip route && echo && ip address' +alias ipr='ip address && echo && ip route' +alias which='which -a' +alias gg='git log --oneline --abbrev-commit --all --graph --decorate --color' +# À tester un jour :) +#alias -s ps=gv + +# Demande confirmation pour 'rm *' -> ou +unsetopt rm_star_silent + +# Si on utilise des jokers dans une liste d'arguments, retire les jokers +# qui ne correspondent à rien au lieu de donner une erreur +setopt null_glob + +# Autocomplétion ? +unsetopt list_ambiguous + +setopt auto_remove_slash +unsetopt glob_dots +autoload -U compinit promptinit colors +compinit +promptinit +colors +autoload -Uz vcs_info +zstyle ':vcs_info:*' enable git cvs svn +setopt auto_cd +zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' +zstyle ':completion:*' max-errors 3 numeric +zstyle ':completion:*' use-compctl false + +# Traite les liens symboliques comme il faut +setopt chase_links + +# !! n'est pas exécuté directement +setopt hist_verify + +# Afficher le temps pris pour exécuter les commandes +EXPORTTIME=0 + +# Points rouges pendant l'autocomplétion +COMPLETION_WAITING_DOTS="true" + +################################################################################ +# Utility functions for the prompt # +################################################################################ + +# Background changes depending on solarized theme +case ${SOLARIZED_THEME:-dark} in + light) local bkg=white;; + *) local bkg=black;; +esac + +local ZSH_THEME_GIT_PROMPT_PREFIX="%{%K{${bkg}}$fg_bold[green]%}[%{$fg_bold[blue]%}" +local ZSH_THEME_GIT_PROMPT_SUFFIX="%{%K{${bkg}}$fg_bold[green]%}]%K{${bkg}}" +local ZSH_THEME_GIT_PROMPT_CLEAN="%{%K{${bkg}}$fg_bold[green]%}✓%{$reset_color%}" +local ZSH_THEME_GIT_PROMPT_AHEAD="%{%K{${bkg}}$fg[cyan]%}▴%{$reset_color%}" +local ZSH_THEME_GIT_PROMPT_BEHIND="%{%K{${bkg}}$fg[magenta]%}▾%{$reset_color%}" +local ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[green]%K{${bkg}}%}●%{$reset_color%}" +local ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg[yellow]%K{${bkg}}%}●%{$reset_color%}" +local ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[red]%K{${bkg}}%}●%{$reset_color%}" + +local ZSH_THEME_VIRTUALENV_PREFIX=" %{$fg_bold[green]%}(%{%b%K{${bkg}}$fg[green]%}" +local ZSH_THEME_VIRTUALENV_SUFFIX="%{$reset_color%K{${bkg}}$fg_bold[green]%})%{$reset_color%K{${bkg}}%}" + +# Depending if root or not, displays the right prompt char +# and changes the color of the username +if [[ $EUID -eq 0 ]]; then + local _USERNAME="%{$fg_bold[red]%}%n" + local _LIBERTY="%{$fg_no_bold[red]%}#" +else + local _USERNAME="%{$fg_bold[green]%}%n" + local _LIBERTY="%{$fg_no_bold[green]%}$" +fi +_LIBERTY="$_LIBERTY%{$reset_color%}" + + +function virtualenv_prompt_info(){ + [[ -n ${VIRTUAL_ENV} ]] || return + echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}" +} + +# disables prompt mangling in virtual_env/bin/activate +export VIRTUAL_ENV_DISABLE_PROMPT=1 + +function _prompt_chars() { + if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + local _GIT_CHAR="%{$fg_no_bold[blue]%}±%{$reset_color%}" + else + local _GIT_CHAR=' ' + fi + + local _VENV_PROMPT="%{%K{${bkg}}%}$(virtualenv_prompt_info)" + + echo "$_GIT_CHAR$_VENV_PROMPT $_LIBERTY" +} + +function charge_batterie { + local BATTERY=/sys/class/power_supply/BAT0 + local REM_CAP=`cat $BATTERY/charge_now` + local FULL_CAP=`cat $BATTERY/charge_full` + local BATSTATE=`cat $BATTERY/status` + local CHARGE=$(( $REM_CAP * 100 / $FULL_CAP )) + local Batterie="" + case $BATSTATE in + 'Full') + Batterie="~";; + 'Charging') + Batterie="+";; + 'Discharging') + Batterie="-";; + esac + # Maximum à 100% + if [ $CHARGE -gt "99" ] + then + CHARGE=100 + fi + local Couleur="magenta" + if [ $CHARGE -gt "15" ] + then + Couleur="yellow" + fi + if [ $CHARGE -gt "30" ] + then + Couleur="green" + fi + + echo %{$fg[${Couleur}]%B%}${Batterie}%{%b$fg[${Couleur_batt}]%}$CHARGE%%%{$reset_color%} +} + +space_sh_git_branch () { + local ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return + echo "${ref#refs/heads/}" +} + +space_sh_git_status () { + _INDEX=$(command git status --porcelain -b 2> /dev/null) + local _STATUS="" + if $(echo "$_INDEX" | grep '^[AMRD]. ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" + fi + if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" + fi + if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" + fi + if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" + fi + if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" + fi + if $(echo "$_INDEX" | grep '^## .*ahead' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" + elif $(echo "$_INDEX" | grep '^## .*behind' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" + fi + if $(echo "$_INDEX" | grep '^## .*diverged' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" + fi + + echo $_STATUS +} + +space_sh_git_prompt () { + local _branch=$(space_sh_git_branch) + local _result="" + if [[ "${_branch}x" != "x" ]]; then + local _status=$(space_sh_git_status) + _result="$ZSH_THEME_GIT_PROMPT_PREFIX$_branch" + if [[ "${_status}x" != "x" ]]; then + _result="$_result $_status" + fi + _result="$_result$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi + echo $_result +} + + +# Host coloring, specific to Rezometz +local couleur_hote="" +case $HOST in + TwelveYearsAndStillGoingStrong|lharkinateur|BecauseROSThatSWhy) + couleur_hote=cyan;; + chimay|orval) + couleur_hote=magenta;; + babel|taima|era|vidar|okami) + couleur_hote=red;; + loki|skadi) + couleur_hote=blue;; + *) + couleur_hote=white;; +esac + +#Heure="%(!,%{%B$fg[red]%}%D{%a %d/%m} %T%{$reset_color%}%b,%D{%a %d/%m} %T)" + +# Pour recalculer les variables du prompt +# Il faut que le signe $ soit échappé ou entre guillemets simples +setopt promptsubst + +################################################################################ +# Prompt display # +################################################################################ + +PROMPT="%{$reset_color%} +" +PROMPT+="%{%K{${bkg}%}"'$_USERNAME' +PROMPT+="%{$fg_bold[blue]%}@" +PROMPT+="%{$fg_bold[$couleur_hote]%}"'%m' +PROMPT+=" %{$reset_color%K{${bkg}}%}" +PROMPT+="%{$fg[yellow]%}"'%~' +PROMPT+="%{$fg_bold[green]%} %E +" +PROMPT+='%{%K{${bkg}}%}$(_prompt_chars) ' + + +RPROMPT='$(space_sh_git_prompt)%E%{$reset_color%}' + +#PROMPT="$Heure $Utilisateur@$Machine %{$fg_no_bold[yellow]%}%~ +#%{$reset_color%}%# " +#RPROMPT="\$(charge_batterie) %(!,%B[%?]%b,[%?])" + +#RPROMPT="${vcs_info_msg_0_} \$(charge_batterie) %(!,%B[%?]%b,[%?])" + +#RPROMPT=" %(!,%B[%?]%b,[%?])" + +# %{ %} pas d'affichage, à utiliser pour ne pas fausser le calcul de RPROMPT +# $fg[color], $fg_(no_)bold[color], $reset_color +# black red green yellow blue magenta cyan white + +# Raccourcis claviers à la VIM +bindkey -v +# ou à la emacs +# bindkey -e + +# Réglages de l'historique +HISTSIZE=10000 +SAVEHIST=10000 +HISTFILE=~/.history +HISTTIMEFORMAT="%d/%m %H:%M:%S " +setopt hist_ignore_all_dups sharehistory hist_ignore_space + +# >| doit être utilisés pour pouvoir écraser un fichier déjà existant ; +# # le fichier ne sera pas écrasé avec '>' +# unsetopt clobber + +# Afficher «zsh: exit ERREUR» en cas d'erreur ≠ 0 +# setopt print_exit_value +# zstyle ':completion:*' auto-description 'specify: %d' +# zstyle ':completion:*' completer _expand _complete _correct _approximate +# zstyle ':completion:*' format 'Completing %d' +# zstyle ':completion:*' group-name '' +# zstyle ':completion:*' menu select=2 +# eval "$(dircolors -b)" +# zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} +# zstyle ':completion:*' list-colors '' +# zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the +# character to insert%s +# zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' +# 'r:|[._-]=* r:|=* l:|=*' +# zstyle ':completion:*' menu select=long +# zstyle ':completion:*' select-prompt %SScrolling active: current selection at +# %p%s +# zstyle ':completion:*' use-compctl false +# zstyle ':completion:*' verbose true +# +# zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) +# #([0-9]#)*=0=01;31' +# zstyle ':completion:*:kill:*' command 'ps -u $USER -o +# pid,%cpu,tty,cputime,cmd' + +# Gestion des touches spéciales pour mon clavier +# Pour connaître le code d'une touche, exécuter «cat» +typeset -A key +# CTRL + flèches +bindkey ";5D" beginning-of-line +bindkey ";5C" end-of-line +bindkey ";5A" up-line-or-history +bindkey ";5B" down-line-or-history +bindkey "^[[1;5D" beginning-of-line +bindkey "^[[1;5C" end-of-line +bindkey "^[[1;5A" history-incremental-search-backward +bindkey "^[[1;5B" history-incremental-search-forward +# Page Up/Down +bindkey "^[[5~" history-beginning-search-backward +bindkey "^[[6~" history-beginning-search-forward +# CTRL + Page UP/Down +bindkey "^[[5;5~" beginning-of-buffer-or-history +bindkey "^[[6;5~" end-of-buffer-or-history +# Origine / Fin (pavé numérique) +bindkey "^[[1~" beginning-of-line +bindkey "^[[4~" end-of-line +# Origine / Fin +bindkey "^[OH" beginning-of-line +bindkey "^[OF" end-of-line + +# Finally, make sure the terminal is in application mode, when zle is +# active. Only then are the values from $terminfo valid. +if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then + function zle-line-init () { + printf '%s' "${terminfo[smkx]}" + } + function zle-line-finish () { + printf '%s' "${terminfo[rmkx]}" + } + zle -N zle-line-init + zle -N zle-line-finish +fi + +# # Stockage des dossiers visités (cd -NUM et dir -v) +# DIRSTACKFILE="$HOME/.cache/zsh/dirs" +# if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then +# dirstack=( ${(f)"$(< $DIRSTACKFILE)"} ) +# [[ -d $dirstack[1] ]] && cd $dirstack[1] +# fi +# chpwd() { +# print -l $PWD ${(u)dirstack} >>$DIRSTACKFILE +# } +DIRSTACKSIZE=20 + +setopt autopushd pushdsilent pushdtohome + +# Remove duplicate entries +setopt pushdignoredups + +# This reverts the +/- operators. +setopt pushdminus +autoload -U zsh-mime-setup +autoload -U zsh-mime-handler +zsh-mime-setup +zstyle ':mime:*' mailcap /etc/mailcap +# video/*; /usr/bin/mplayer '%s'; +# text/*; less '%s'; +# audio/*; /usr/bin/mplayer '%s'; +export EDITOR=/usr/bin/vim + +# Crée un cache des complétion possibles +# très utile pour les complétion qui demandent beaucoup de temps +# comme la recherche d'un paquet aptitude install moz +zstyle ':completion:*' use-cache on +zstyle ':completion:*' cache-path ~/.zs + +# Des couleurs pour la complétion cf kill -9 +zmodload zsh/complist +setopt extendedglob +zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31" +setopt correct + +# Syntax coloration for man +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 "$@" +} +# source ~/.zs/zsh-syntax-highlighting.zsh +# exec 2>>(while read line; do +# print '\e[91m'${(q)line}'\e[0m' > /dev/tty; print -n $'\0'; done &) +# Totalement indispensable mais tellemnent chiant que je l'ai viré au bout de 2 +# heures :) +# if [ $HOST != "sinquin" ]; then +# (play -q -n synth sine F2 sine C3 remix - fade 0 4 .1 norm -4 bend +# 0.5,2399,2 fade 0 4.0 0.5 &) +# fi