Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Feb 19, 2012
0 parents commit 2b33db3
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
@@ -0,0 +1,3 @@
# My Dotfiles

For Bash, Vim...
50 changes: 50 additions & 0 deletions _bashrc.d/bashrc_prompt
@@ -0,0 +1,50 @@
# Colors
NoColor="\033[0m"
Cyan="\033[0;36m"
Green="\033[0;32m"
Red="\033[0;31m"
Yellow="\033[0;33m"

# Chars
RootPrompt="#"
NonRootPrompt="$"

# Contextual prompt
prompt() {
USERNAME=`whoami`
HOSTNAME=`hostname`
CURRENTPATH=`pwd`

LEFTPROMPT=$Cyan$USERNAME@$HOSTNAME":"$Yellow$CURRENTPATH
let LEFTSIZE=$(echo -n "$USERNAME@$HOSTNAME:$CURRENTPATH" | wc -c)

RIGHTPROMPT=""
let RIGHTSIZE=0
GITSTATUS=$(git status 2> /dev/null)
#echo $GITSTATUS > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo $GITSTATUS | grep "not staged" > /dev/null 2>&1
if [ $? -eq 0 ]; then
RIGHTPROMPT=$Red
else
RIGHTPROMPT=$Green
fi
BRANCH=`git describe --contains --all HEAD`
RIGHTPROMPT=$RIGHTPROMPT"[Git branch "$BRANCH"]"
let RIGHTSIZE=$(echo -n "[Git branch "$BRANCH"]" | wc -c)
fi
let BLANCKSIZE=${COLUMNS}-${LEFTSIZE}-${RIGHTSIZE}
RIGHTPROMPT=$RIGHTPROMPT$NoColor

echo -e -n "\n"$LEFTPROMPT
printf "%$(($BLANCKSIZE))s"
echo -e $RIGHTPROMPT
}

# Main prompt
PROMPT_COMMAND=prompt
if [ $EUID -ne 0 ]; then
PS1=$NonRootPrompt" "
else
PS1=$RootPrompt" "
fi
26 changes: 26 additions & 0 deletions _config/terminator/config
@@ -0,0 +1,26 @@
[global_config]
title_hide_sizetext = True
[keybindings]
[profiles]
[[default]]
background_darkness = 0.99
font = Inconsolata Medium 12
background_color = "#002b36"
show_titlebar = False
foreground_color = "#eee8d5"
[[b&w]]
show_titlebar = False
cursor_color = "#599760"
[[tiny]]
use_system_font = False
font = Monospace 8
show_titlebar = False
[layouts]
[[default]]
[[[child1]]]
type = Terminal
parent = window0
[[[window0]]]
type = Window
parent = ""
[plugins]
7 changes: 7 additions & 0 deletions bashrc
@@ -0,0 +1,7 @@
# Defined prompt only if is not already defined
if [ ! -z "$PS1" ]; then
echo "== Define the prompt"
source .bashrc.d/bashrc_prompt
fi


0 comments on commit 2b33db3

Please sign in to comment.