# ---------------------------------------------------------------------------- #
## \author Sebastien Beaugrand
## \sa http://beaugrand.chez.com/
## \copyright CeCILL 2.1 Free Software license
# ---------------------------------------------------------------------------- #
---
- name: "/home/{{ user }}/.bashrc"
  blockinfile:
    path: "/home/{{ user }}/.bashrc"
    create: yes
    block: |
      PS1='\u:\w> '
      SCREENDIR={{ home }}/.screen
      PATH={{ home }}/.local/bin:/usr/local/bin:/usr/bin:/bin
      if [ -d {{ home }}/install/debinst/bin ]; then
          PATH=$PATH:{{ home }}/install/debinst/bin
      fi
      if [ -d {{ home }}/bin ]; then
          PATH=$PATH:{{ home }}/bin
      fi
      export PATH=$PATH:.

      alias l='ls'
      alias lrt='ls -lrt'
      alias ls='ls --color=always'
      alias ll='ls -l'
      alias cp='cp -i'
      alias mv='mv -i'
      alias rm='rm -i'
      alias df='df -h'
      alias du='du -h'

      alias purge='rm -f *~'
      alias rpurge='find . -name \*~ -exec rm {} \;'
      alias grep='grep --color=auto'
      alias rgrep='grep --color=auto -rI --exclude-dir=build --exclude-dir=build-* --exclude-dir=.git --exclude-dir=.svn --exclude-dir=.vagrant --exclude=*.svg'
      alias rfind='find . -type d \( -name build -o -name build-* -o -name .git -name .svn -o -name .vagrant \) -prune -false -o -name'
      alias sortdu=$'du -b | awk \'{ printf "%12d %s\\n", $1, $2 }\' | LC_ALL=C sort'

      bind '"\e[1;5A": history-search-backward'
      bind '"\e[1;5B": history-search-forward'
      bind 'set bell-style none'
      test -n "$DISPLAY" && xset -b
      test -n "$DISPLAY" && setxkbmap -option "nbsp:none"

      alias kc='TMPDIR=/run/lock keychain --dir /run/lock --nogui ~/.ssh/id_rsa && source /run/lock/.keychain/*-sh'
      test -d /run/lock/.keychain && kc
      cd