Other articles

  1. ZSH prompt

    06 February 2012 || tags: GIT ZSH

    Here is my ZSH config to achieve two aims :

    1. Clearly separates the results of commands :
    1. Integrate GIT status in the prompt when working in a GIT repository :

    To do that, I have added to my .zshrc the following lines :

     1 autoload -Uz vcs_info
     2 #zstyle ':vcs_info:*' stagedstr 'Staged'
     3 #zstyle ':vcs_info:*' unstagedstr 'Unstaged'
     4 zstyle ':vcs_info:git*' formats "%{$fg_bold[blue]%}[%s] %{$fg_bold[green]%}(%b)%{$reset_color%} %{$fg[red]%}%u %{$fg[yellow]%}%c"
     5 zstyle ':vcs_info:*' check-for-changes true
     6 zstyle ':vcs_info:*' enable git
     7 precmd() {
     8   vcs_info
    10   local STATUS="`git status 2>&1`"
    11   if [[ "$STATUS" == *'Not a git repository'* ]] then
    12     GITINFO=""
    13   else
    14     GITINFO="------ ${vcs_info_msg_0_}"$'\n'
    15   fi
    16 }
    17 setopt prompt_subst
    19 export PS1=$'\n'"%{$fg[green]%}"-----------------------------------------------------------------------$'\n''${GITINFO}'"%{$fg[green]%}""------ [%~] %*"$'\n'-----------------------------------------------------------------------"%{$reset_color%}"$'\n\n\n'"%{$fg_bold[green]%}%n@%m:%#%{$reset_color%} "

    More information about vcs_info can be found at http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information

    1 autoload -Uz vcs_info loads the vcs_info module.
    3 zstyle ':vcs_info:git*' formats "%{$fg_bold[blue]%}[%s] %{$fg_bold[green]%}(%b)%{$reset_color%} %{$fg[red]%}%u %{$fg[yellow]%}%c" defines the output format :
    • %s : the VCS used (= git)
    • %b : the current branch
    • %u : unstaged status (= there are unstaged files in the repository)
    • %c : staged status (= there are staged files in the repository)

    If you want to change the default U and S for unstaged and staged, you can use :

    1 zstyle ':vcs_info:*' stagedstr 'Staged'
    2 zstyle ':vcs_info:*' unstagedstr 'Unstaged'
    • zstyle ':vcs_info:*' check-for-changes true to monitor changes.
    • zstyle ':vcs_info:*' enable git to enable it for GIT VCS.

    I want to show the GIT status only inside a GIT repository, not in a ordinary directory. This is done in the precmd() by testing the STATUS variable which contains the GIT STATUS output :

    1 precmd() {
    2 vcs_info
    3 local STATUS="`git status 2>&1`"
    4 if [[ "$STATUS" == *'Not a git repository'* ]] then
    5   GITINFO=""
    6 else
    7   GITINFO="------ ${vcs_info_msg_0_}"$'n'
    8 fi
    9 }

    The prompt itself is build inside PS1 :

    1 export PS1=$'n'"%{$fg[green]%}"-----------------------------------------------------------------------$'n''${GITINFO}'"%{$fg[green]%}""------ [%~] %*"$'n'-----------------------------------------------------------------------"%{$reset_color%}"$'nnn'"%{$fg_bold[green]%}%n@%m:%#%{$reset_color%} "

    Note : you have to make a first commit before the staged and unstaged status become active.

  2. [FR] Configuration de VIM

    04 December 2011 || tags: VIM

    Si vous êtes intéressé par l'éditeur de texte VIM, vous pouvez regarder sur youtube une introduction en français.

    Cette présentation a pour but de vous aider à faire les premiers pas en vous montrant comment commencer à configurer VIM.

  3. Open hardware

    Firefox, Linux, LibreOffice etc. are the proof that open software are successful. But, open hardware has never been massively adopted and used in the industry. Keeping everything secret is still the commonly rule followed by corporations. It seems that thing are at least slowly changing.

    First, some major corporations like TI, NXP, Freescale, Xilinx and others have started to promote their chips by creating open communities :

    • TI : Beagleboard
    • NXP : Mbed
    • ST-Ericsson : Igloo
    • Freescale : iMX
    • Xilinx Celebrates Winners of Industry’s First Open Source Hardware Innovation Contest

    The fact that major corporations are looking toward open source world is certainly a big change.

    Usual open software license like GNU GPL are not adapted to hardware. Real efforts to define open hardware licenses are also in progress. At least the FSF is considering the open hardware license :

    We can also see more and more open hardware that may really interest companies. One very interesting place to visit is the CERN Open Hardware Repository, where you can find complex projects like the White Rabbit. A system to synchronize 1000 nodes with sub ns accuracy over 10km. Even if it’s not very used in industry, Arduino is very popular among hobbyist, and also a commercial success for its distributors. 30 000 boards were sold in 2006, and The Arduino’s community was estimated to 100 000 users in 2010. Other open hardware actors like Dangerous Prototypes sell their products through distributors (http://www.seeedstudio.com/depot/wherelabs-m-9.html).

    Some additional links :

  4. YaJiMuMa

    The theme of MicroReflexion.com has been added to Gitorious under GNU AFFERO licence YaJiMuMa:

    YaJiMuMa is a clean, simple and lightweight theme for WordPress 3+

Page 1 / 3 »