Created
July 18, 2017 03:57
-
-
Save bhank/007dbf09a98921e38ae58ce5950f2118 to your computer and use it in GitHub Desktop.
Tweaked version of ConEmu CmdInit.cmd to move the prompt to a new line
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
@rem Copied from C:\Program Files\ConEmu\ConEmu | |
@echo off | |
rem Simple "ver" prints empty line before Windows version | |
rem Use this construction to print just a version info | |
cmd /d /c ver | "%windir%\system32\find.exe" "Windows" | |
rem Now we form the command prompt | |
rem This will start prompt with `User@PC ` | |
:: set ConEmuPrompt0=$E[m$E[32m$E]9;8;"USERNAME"$E\@$E]9;8;"COMPUTERNAME"$E\$S | |
rem Followed by colored `Path` | |
set ConEmuPrompt1=%ConEmuPrompt0%$E[92m$P$E[90m | |
if NOT "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( | |
if "%PROCESSOR_ARCHITEW6432%" == "AMD64" if "%PROCESSOR_ARCHITECTURE%" == "x86" ( | |
rem Use another text color if cmd was run from SysWow64 | |
set ConEmuPrompt1=%ConEmuPrompt0%$E[93m$P$E[90m | |
) | |
) | |
rem Carriage return and `$` or `>` | |
rem Spare `$E[90m` was specially added because of GitShowBranch.cmd | |
::if "%ConEmuIsAdmin%" == "ADMIN" ( | |
:: set ConEmuPrompt2=$_$E[90m$$ | |
::) else ( | |
set ConEmuPrompt2=$_$E[90m$G | |
::) | |
rem Finally reset color and add space | |
set ConEmuPrompt3=$E[m$S$E]9;12$E\ | |
if /I "%~1" == "/git" goto git | |
if /I "%~1" == "-git" goto git | |
goto no_git | |
:git | |
call "%~dp0GitShowBranch.cmd" /i | |
goto :EOF | |
:no_git | |
rem Set new prompt | |
PROMPT %ConEmuPrompt1%%ConEmuPrompt2%%ConEmuPrompt3% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment