Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nicolargo
committed
Feb 19, 2012
0 parents
commit 2b33db3
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# My Dotfiles | ||
|
||
For Bash, Vim... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
|