Last active
March 15, 2018 18:19
-
-
Save ggrumbley/9aeba731340ee9a6e70dac7e2140b968 to your computer and use it in GitHub Desktop.
[WINDOWS] My PS1 Theme for Cmder (/cmder/vendor/clink.lua) | Git BASH (~/.config/git/git-prompt.sh) | Mintty theme goes in ~/.mintty/themes
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 characters
function set_prompt_filter() | |
-- get_cwd() is differently encoded than the clink.prompt.value, so everything other than | |
-- pure ASCII will get garbled. So try to parse the current directory from the original prompt | |
-- and only if that doesn't work, use get_cwd() directly. | |
-- The matching relies on the default prompt which ends in X:\PATH\PATH> | |
-- (no network path possible here!) | |
local old_prompt = clink.prompt.value | |
local cwd = old_prompt:match('.*(.:[^>]*)>') | |
if cwd == nil then cwd = clink.get_cwd() end | |
-- environment systems like pythons virtualenv change the PROMPT and usually | |
-- set some variable. But the variables are differently named and we would never | |
-- get them all, so try to parse the env name out of the PROMPT. | |
-- envs are usually put in round or square parentheses and before the old prompt | |
local env = old_prompt:match('.*%(([^%)]+)%).+:') | |
-- also check for square brackets | |
if env == nil then env = old_prompt:match('.*%[([^%]]+)%].+:') end | |
-- build our own prompt | |
-- orig: $E[1;32;40m$P$S{git}{hg}$S$_$E[1;30;40m{lamb}$S$E[0m | |
-- color codes: "\x1b[1;37;40m" | |
local cmder_prompt = "\x1b[1;31;40mλ \x1b[1;32;40m{cwd} {git}{hg}\x1b[1;30;40m{lamb} \x1b[0m" | |
cmder_prompt = string.gsub(cmder_prompt, "{cwd}", cwd) | |
if env == nil then | |
lambda = "\x1b[1;32;40m❯\x1b[1;33;40m❯\x1b[1;31;40m❯" | |
else | |
lambda = "("..env..") \x1b[1;32;40m❯\x1b[1;33;40m❯\x1b[1;31;40m❯" | |
end | |
clink.prompt.value = string.gsub(cmder_prompt, "{lamb}", lambda) | |
end |
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 characters
if test -f /etc/profile.d/git-sdk.sh | |
then | |
TITLEPREFIX=SDK-${MSYSTEM#MINGW} | |
else | |
TITLEPREFIX=$MSYSTEM | |
fi | |
PS1='\[\033]0;Bash Prompt (Git for Windows) =>${PWD//[^[:ascii:]]/?}\007\]' # set window title | |
PS1="$PS1"'\n' # new line | |
PS1="$PS1"'\[\033[31m\]λ ' | |
PS1="$PS1"'\[\033[32m\]\w' # current working directory | |
if test -z "$WINELOADERNOEXEC" | |
then | |
GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)" | |
COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}" | |
COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}" | |
COMPLETION_PATH="$COMPLETION_PATH/share/git/completion" | |
if test -f "$COMPLETION_PATH/git-prompt.sh" | |
then | |
. "$COMPLETION_PATH/git-completion.bash" | |
. "$COMPLETION_PATH/git-prompt.sh" | |
PS1="$PS1"'\[\033[36m\]' # change color to cyan | |
PS1="$PS1"'`__git_ps1`' # bash function | |
fi | |
fi | |
PS1="$PS1"' \[\033[32m\]❯\[\033[33m\]❯\[\033[31m\]❯ \[\033[37m\]' | |
MSYS2_PS1="$PS1" # for detection by MSYS2 SDK's bash.basrc |
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 characters
ForegroundColour=235,219,178 | |
BackgroundColour=29,32,33 | |
CursorColour=253,157,79 | |
Black=40,40,40 | |
BoldBlack=146,131,116 | |
Red=204,36,29 | |
BoldRed=251,73,52 | |
Green=152,151,26 | |
BoldGreen=184,187,38 | |
Yellow=215,153,33 | |
BoldYellow=250,189,47 | |
Blue=69,133,136 | |
BoldBlue=131,165,152 | |
Magenta=177,98,134 | |
BoldMagenta=211,134,155 | |
Cyan=104,157,106 | |
BoldCyan=142,192,124 | |
White=168,153,132 | |
BoldWhite=235,219,178 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment