#!/bin/bash

#######################################################
### things to do BEFORE host/user-specific settings ###
#######################################################

### .... ###
### SUBZ ###
### '''' ###

git() {
    if grep -Fwqse "$1" "$GIT_DISABLED_COMMANDS"; then
        echo "You don't want this." >&2
        return 1
    else
        command git "$@"
    fi
}

clear_to_bottom() {
    tput clear; tput cup $(tput lines) 0
}

### .... ###
### BASH ###
### '''' ###

export HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups
export HISTIGNORE=$HISTIGNORE:ls:ll:la:cd
export HISTIGNORE="$HISTIGNORE:git ap:git cm:git cma:git dc:git st"
export HISTFILESIZE=10000
export GLOBIGNORE=.:..

# some more aliases
alias cls='clear'
alias clsz='clear_to_bottom'
alias ll='ls -lh'
alias lla='ls -lha'
alias open='gnome-open'
alias diff='diff -u'
alias pad4='sed -e "s/^/    /"'
alias grepr='grep -nr . -e'
alias sc='se --direction=encz.cz'

### ...... ###
### OTHERS ###
### '''''' ###

export GREP_OPTIONS="--color --binary-files=without-match"

# make green git bash trinket even cooler
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_DISABLED_COMMANDS="$HOME/.gittum/disabled-commands"

# disable mounting things like SFTP to ~/.gvfs when accessed
# via GIO (used by nautilus etc.)
export GVFS_DISABLE_FUSE=1

# disable the terrible beep sound (only for X; for tty?, blacklist pcspkr)
[[ ${!DISPLAY[@]} ]] &&  xset b off

# get rid of those .pyc files once and for all
export PYTHONDONTWRITEBYTECODE=1