Last active
February 16, 2025 17:55
-
-
Save ntamvl/c657ef61843baf61a9cc1f66cbaab317 to your computer and use it in GitHub Desktop.
Revisions
-
ntamvl revised this gist
May 6, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -67,6 +67,7 @@ parse_git_branch() { # PS1='\n\[\033[0;35m\]\u\[\033[0;32m\]\w\[\033[0m\]$(__git_ps1)\n\$\[\033[0m\] ' # PS1='\[\033[0;35m\]\u\[\033[0;32m\]\w\[\033[0m\]$(__git_ps1)\n\$\[\033[0m\] ' # PS1='\[\033[0;34m\]\u@\h:\[\033[0;32m\]\W\[\033[0m\]$(__git_ps1) \$\[\033[0m\] ' # PS1='\[\033[0;34m\]\u@\h:\[\033[0;32m\]\W\[\033[0m\]$(parse_git_branch) \$\[\033[0m\] ' PS1='\[\033[0;34m\]\u@\h:\[\033[0;32m\]\W\[\033[0m\]$(parse_git_branch) \$\[\033[0m\] ' -
ntamvl revised this gist
May 4, 2019 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -72,6 +72,10 @@ PS1='\[\033[0;34m\]\u@\h:\[\033[0;32m\]\W\[\033[0m\]$(parse_git_branch) \$\[\033 # Tell grep to highlight matches export GREP_OPTIONS='--color=auto' # Tell ls to be colourful export CLICOLOR=1 export LSCOLORS=Exfxcxdxbxegedabagacad ``` -
ntamvl revised this gist
May 4, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -53,7 +53,7 @@ Check the bash man page, under the PROMPTING header for options for the `PROMPT` # the command number of this command ``` **My `.bash_profile` file** ```bash parse_git_branch() { -
ntamvl revised this gist
May 4, 2019 . 1 changed file with 22 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -53,6 +53,28 @@ Check the bash man page, under the PROMPTING header for options for the `PROMPT` # the command number of this command ``` ## My `.bash_profile` ```bash parse_git_branch() { # git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ [\1]/' } # export PS1="\u@\h \[\033[32m\]\w - \$(parse_git_branch)\[\033[00m\] $ " # export PS1="\w \$(parse_git_branch)\[\033[00m\] \$ " # PS1='\n\[\033[0;35m\]\u\[\033[0;32m\]\w\[\033[0m\]$(__git_ps1)\n\$\[\033[0m\] ' # PS1='\[\033[0;35m\]\u\[\033[0;32m\]\w\[\033[0m\]$(__git_ps1)\n\$\[\033[0m\] ' # PS1='\[\033[0;34m\]\u@\h:\[\033[0;32m\]\W\[\033[0m\]$(__git_ps1) \$\[\033[0m\] ' PS1='\[\033[0;34m\]\u@\h:\[\033[0;32m\]\W\[\033[0m\]$(parse_git_branch) \$\[\033[0m\] ' # Tell grep to highlight matches export GREP_OPTIONS='--color=auto' ``` ----------------- ``` source: http://mybyways.com/blog/os-x-terminal-color-prompt -
ntamvl revised this gist
May 4, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -53,7 +53,7 @@ Check the bash man page, under the PROMPTING header for options for the `PROMPT` # the command number of this command ``` ----------------- ``` source: http://mybyways.com/blog/os-x-terminal-color-prompt ``` -
ntamvl revised this gist
May 4, 2019 . 1 changed file with 12 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,15 +19,18 @@ Line 2 used to read `"\e[0;36m\w$ \e[m"` which is correct for other UNIX distrib The first `\[\e[36m\]` turns on the color (cyan in this case), and the closing `\[\e[0m\]` turns it off. \e is just shorthand for the ASCII escape `\033`. You can also use the opening format `\[\e[36;40m\]` to set the background (cyan on white in this case). |Color|Foreground|Background| |--- |--- |--- | |Black|30|40| |Red|31|41| |Green|32|42| |Yellow|33|43| |Blue|34|44| |Purple|35|45| |Cyan|36|46| |White|37|47| Check the bash man page, under the PROMPTING header for options for the `PROMPT` itself. Here's an excerpt (mine is just `\w`): ``` -
ntamvl revised this gist
May 4, 2019 . 1 changed file with 0 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -54,22 +54,3 @@ Check the bash man page, under the PROMPTING header for options for the `PROMPT` ``` source: http://mybyways.com/blog/os-x-terminal-color-prompt ``` -
ntamvl revised this gist
May 4, 2019 . 1 changed file with 20 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -53,4 +53,23 @@ Check the bash man page, under the PROMPTING header for options for the `PROMPT` ============= ``` source: http://mybyways.com/blog/os-x-terminal-color-prompt ``` ColorForegroundBackground Black 30 40 Red 31 41 Green 32 42 Yellow 33 43 Blue 34 44 Purple 35 45 Cyan 36 46 White 37 47 -
ntamvl revised this gist
May 4, 2019 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -50,3 +50,7 @@ Check the bash man page, under the PROMPTING header for options for the `PROMPT` # the command number of this command ``` ============= ``` source: http://mybyways.com/blog/os-x-terminal-color-prompt ``` -
ntamvl created this gist
May 4, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ # OS X Terminal color prompt Update `.bash_profile` with content: ```bash export CLICOLOR=1 export PS1="\[\e[36m\]\w\[\e[0m\]$ " alias ll='ls -GFhl' dir='ls -GFhl' alias start=open printf "\033]0;`date "+%a %d %b %Y %I:%M %p"`\007" alias title='printf "\033]0;%s\007"' ``` Line 2 used to read `"\e[0;36m\w$ \e[m"` which is correct for other UNIX distributions but not OSX. In OSX the format is: ``` \[\e[36m\] PROMPT \[\e[0m\] ``` The first `\[\e[36m\]` turns on the color (cyan in this case), and the closing `\[\e[0m\]` turns it off. \e is just shorthand for the ASCII escape `\033`. You can also use the opening format `\[\e[36;40m\]` to set the background (cyan on white in this case). Color Foreground Background Black 30 40 Red 31 41 Green 32 42 Yellow 33 43 Blue 34 44 Purple 35 45 Cyan 36 46 White 37 47 Check the bash man page, under the PROMPTING header for options for the `PROMPT` itself. Here's an excerpt (mine is just `\w`): ``` \d the date in "Weekday Month Date" format (e.g., "Tue May 26") \h the hostname up to the first '.' \H the hostname \j the number of jobs currently managed by the shell \l the basename of the shell's terminal device name \s the name of the shell, the basename of $0 (the portion following the final slash) \t the current time in 24-hour HH:MM:SS format \T the current time in 12-hour HH:MM:SS format \@ the current time in 12-hour am/pm format \A the current time in 24-hour HH:MM format \u the username of the current user \v the version of bash (e.g., 2.00) \V the release of bash, version + patch level (e.g., 2.00.0) \w the current working directory, with $HOME abbreviated with a tilde \W the basename of the current working directory, with $HOME abbreviated with a tilde ! the history number of this command # the command number of this command ```