Merge pull request #702 from daxgames/msys_bash

Msys bash
This commit is contained in:
Martin Kemp 2015-11-23 23:31:02 +00:00
commit 1af65edaec
8 changed files with 199 additions and 34 deletions

View File

@ -1,4 +1,11 @@
@echo off
SET CMDER_ROOT=%~dp0
if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1%
start %~dp0/vendor/conemu-maximus5/ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%CMDER_ROOT%\config\ConEmu.xml"
:: Remove trailing '\'
@if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1%
if exist "%~1" (
start %~dp0/vendor/conemu-maximus5/ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%~1"
) else (
start %~dp0/vendor/conemu-maximus5/ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%CMDER_ROOT%\config\ConEmu.xml"
)

View File

@ -53,6 +53,39 @@ In a file explorer window right click in or on a directory to see "Cmder Here" i
## Features
### Access to multiple shells in one window using tabs
You can open multiple tabs each containing one of the following shells:
* Cmder | Cmder as Admin - Enhanced Windows 'cmd.exe' shell.
* Powershell | Powershell as Admin - Enhanced Windows Powershell.
* Bash/mintty | Bash/mintty as Admin - Unix/Linux like bash shell running on Windows.
Cmder, Powershell, and Bash tabs all run on top of the Windows Console API and work as you might expect in Cmder with access to use ConEmu's color schemes, key bindings and other settings defined in the ConEmu Settings dialog.
Mintty tabs use a program called 'mintty' as the terminal that is not based on the Windows Console API so some differences in functionality are normal, as a result mintty specific config is done via the '[%USERPROFILE%|$HOME]/.minttyrc' file.
Mintty differs from the other tabs in that it supports xterm/xterm-256color TERM types, and does not work with ConEmu settings like color schemes and key bindings. For more on Mintty and its config click [here](https://code.google.com/p/mintty/).
An example of setting Cmder portable terminal colors for mintty:
From a bash/mintty shell:
```
cd $CMDER_ROOT/vendor
git clone https://github.com/karlin/mintty-colors-solarized.git
cd mintty-colors-solarized/
echo source \$CMDER_ROOT/vendor/mintty-colors-solarized/mintty-solarized-dark.sh>>$CMDER_ROOT/config/user-cmder.sh
```
### Cmder Portable Shell User Config
User specific configuration is possible using the cmder specific shell config files. Edit the below files to add your own configuration:
* Cmder - %CMDER_ROOT%\config\user-startup.cmd
* Powershell - $ENV:CMDER_ROOT\config\user-profile.ps1
* Bash/Mintty - $CMDER_ROOT/config/user-cmder.sh
Bash and Mintty sessions will also source the '$HOME/.bashrc' file it it exists before it sources '$CMDER_ROOT/config/user-cmder.sh'.
### Aliases
You can define simple aliases with command `alias name=command`.
@ -68,8 +101,7 @@ If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_R
## Todo
1. Git Bash
2. Check for clink and git before injecting them (Sort of done)
1. Check for clink and git before injecting them (Sort of done)
## License

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2015-05-17 22:10:27" build="150513">
<key name=".Vanilla" modified="2015-11-09 17:04:58" build="151025">
<value name="ColorTable00" type="dword" data="00222827"/>
<value name="ColorTable01" type="dword" data="009e5401"/>
<value name="ColorTable02" type="dword" data="0004aa74"/>
@ -72,7 +72,7 @@
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data=""/>
<value name="StartTasksFile" type="string" data=""/>
<value name="StartTasksName" type="string" data="{cmd}"/>
<value name="StartTasksName" type="string" data="{cmd::Cmder}"/>
<value name="StartFarFolders" type="hex" data="00"/>
<value name="StartFarEditors" type="hex" data="00"/>
<value name="StoreTaskbarkTasks" type="hex" data="00"/>
@ -123,12 +123,12 @@
<value name="ColorKeyTransparent" type="hex" data="00"/>
<value name="ColorKeyValue" type="dword" data="00010101"/>
<value name="UseCurrentSizePos" type="hex" data="01"/>
<value name="WindowMode" type="dword" data="0000051f"/>
<value name="WindowMode" type="dword" data="00000520"/>
<value name="ConWnd Width" type="dword" data="0000006f"/>
<value name="ConWnd Height" type="dword" data="0000001a"/>
<value name="Cascaded" type="hex" data="01"/>
<value name="ConWnd X" type="dword" data="000003f8"/>
<value name="ConWnd Y" type="dword" data="00000143"/>
<value name="ConWnd X" type="dword" data="000000c5"/>
<value name="ConWnd Y" type="dword" data="00000089"/>
<value name="16bit Height" type="dword" data="00000000"/>
<value name="AutoSaveSizePos" type="hex" data="00"/>
<value name="IntegralSize" type="hex" data="00"/>
@ -483,10 +483,19 @@
<value name="DndLKey" type="hex" data="00"/>
<value name="DndRKey" type="hex" data="a2"/>
<value name="WndDragKey" type="dword" data="00121101"/>
<key name="Tasks" modified="2015-05-17 22:10:27" build="150513">
<value name="Count" type="dword" data="00000003"/>
<key name="Task1" modified="2015-05-17 22:10:27" build="150513">
<value name="Name" type="string" data="{cmd}"/>
<key name="Tasks" modified="2015-11-09 17:04:58" build="151025">
<value name="Count" type="dword" data="00000008"/>
<key name="Task1" modified="2015-11-09 17:04:58" build="151025">
<value name="Name" type="string" data="{cmd::Cmder as Admin}"/>
<value name="GuiArgs" type="string" data="/icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
<value name="Cmd1" type="string" data="*cmd /k &quot;%ConEmuDir%\..\init.bat&quot; -new_console:d:%USERPROFILE%"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="Flags" type="dword" data="00000000"/>
</key>
<key name="Task2" modified="2015-11-09 17:04:58" build="151025">
<value name="Name" type="string" data="{cmd::Cmder}"/>
<value name="GuiArgs" type="string" data="/icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
<value name="Cmd1" type="string" data="cmd /k &quot;%ConEmuDir%\..\init.bat&quot; -new_console:d:%USERPROFILE%"/>
<value name="Active" type="dword" data="00000000"/>
@ -494,17 +503,8 @@
<value name="Hotkey" type="dword" data="00000000"/>
<value name="Flags" type="dword" data="00000000"/>
</key>
<key name="Task2" modified="2015-05-17 22:10:27" build="150513">
<value name="Name" type="string" data="{PowerShell}"/>
<value name="GuiArgs" type="string" data="/icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
<value name="Cmd1" type="string" data="PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''&quot; -new_console:d:&quot;%USERPROFILE%&quot;"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="Flags" type="dword" data="00000000"/>
</key>
<key name="Task3" modified="2015-05-17 22:10:27" build="150513">
<value name="Name" type="string" data="{PowerShell as Admin}"/>
<key name="Task3" modified="2015-11-09 17:04:58" build="151025">
<value name="Name" type="string" data="{Powershell::PowerShell as Admin}"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data="/icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
<value name="Cmd1" type="string" data="*PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''&quot; -new_console:d:&quot;%USERPROFILE%&quot;"/>
@ -512,22 +512,60 @@
<value name="Count" type="dword" data="00000001"/>
<value name="Flags" type="dword" data="00000000"/>
</key>
<key name="Task4" modified="2015-02-24 18:49:50" build="140707">
<value name="Name" type="string" data="{git sh}"/>
<key name="Task4" modified="2015-11-09 17:04:58" build="151025">
<value name="Name" type="string" data="{Powershell::Powershell}"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data="/icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
<value name="Cmd1" type="string" data="PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''&quot; -new_console:d:&quot;%USERPROFILE%&quot;"/>
<value name="Cmd2" type="string" data="%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
<value name="Flags" type="dword" data="00000000"/>
</key>
<key name="Task5" modified="2015-11-09 17:04:58" build="151025">
<value name="Name" type="string" data="{bash::mintty as Admin}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=" /icon &amp;quot;%CMDER_ROOT%vendor\git-for-windows\usr\share\git\git-for-windows.ico"/>
<value name="Cmd1" type="string" data="*%ConEmuDir%\..\git-for-windows\usr\bin\mintty.exe /bin/bash -l -new_console:d:%userProfile%"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
</key>
<key name="Task6" modified="2015-11-09 17:04:58" build="151025">
<value name="Name" type="string" data="{bash::mintty}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=" /icon &amp;quot;%CMDER_ROOT%vendor\git-for-windows\usr\share\git\git-for-windows.ico"/>
<value name="Cmd1" type="string" data="%ConEmuDir%\..\git-for-windows\usr\bin\mintty.exe /bin/bash -l -new_console:d:%userProfile%"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
<value name="Cmd2" type="string" data="%CMDER_ROOT%vendor\git-for-windows\usr\bin\mintty.exe /bin/bash -l -new_console:d:%userProfile%"/>
</key>
<key name="Task7" modified="2015-11-09 22:01:25" build="151025">
<value name="Name" type="string" data="{bash::bash as Admin}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
<value name="Cmd1" type="string" data="cmd /k &quot;%ConEmuDir%\..\init.bat &amp; %CMDER_ROOT%\vendor\git-for-windows\bin\bash --login -i&quot; -new_console:d:%USERPROFILE%"/>
<value name="Cmd2" type="string" data="%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
<value name="Cmd1" type="string" data="*cmd /c &quot;%ConEmuDir%\..\git-for-windows\bin\bash --login -i&quot; -new_console:d:%USERPROFILE%"/>
</key>
<key name="Task8" modified="2015-11-09 22:01:25" build="151025">
<value name="Name" type="string" data="{bash::bash}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
<value name="Cmd1" type="string" data="cmd /c &quot;%ConEmuDir%\..\git-for-windows\bin\bash --login -i&quot; -new_console:d:%USERPROFILE%"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
</key>
</key>
<key name="Apps" modified="2015-05-17 22:10:27" build="150513">
<key name="Apps" modified="2015-11-09 22:01:25" build="151025">
<value name="Count" type="dword" data="00000000"/>
</key>
<key name="Colors" modified="2015-05-17 22:10:27" build="150513">
<key name="Palette1" modified="2015-05-17 22:10:27" build="150513">
<key name="Colors" modified="2015-11-09 22:01:25" build="151025">
<key name="Palette1" modified="2015-11-09 22:01:25" build="151025">
<value name="Name" type="string" data="Monokai"/>
<value name="ExtendColors" type="hex" data="00"/>
<value name="ExtendColorIdx" type="hex" data="0e"/>
@ -628,7 +666,7 @@
<value name="StatusBar.Hide.Dpi" type="hex" data="01"/>
<value name="TabFlashChanged" type="dword" data="00000008"/>
<value name="TabModifiedSuffix" type="string" data="[*]"/>
<key name="HotKeys" modified="2015-05-17 22:10:27" build="150513">
<key name="HotKeys" modified="2015-11-09 17:04:58" build="151025">
<value name="KeyMacroVersion" type="hex" data="02"/>
<value name="Multi.Modifier" type="dword" data="00000011"/>
<value name="Multi.ArrowsModifier" type="dword" data="0000005b"/>
@ -805,7 +843,16 @@
<value name="DndLKey" type="hex" data="00"/>
<value name="DndRKey" type="hex" data="a2"/>
<value name="WndDragKey" type="dword" data="00121101"/>
<value name="Multi.Unfasten" type="dword" data="00000000"/>
</key>
<value name="StartCreateDelay" type="dword" data="00000064"/>
<value name="DefaultTerminalDebugLog" type="hex" data="00"/>
<value name="LastMonitor" type="dword" data="0018f054"/>
<value name="Restore2ActiveMon" type="hex" data="00"/>
<value name="DownShowExOnTopMessage" type="hex" data="00"/>
<value name="EnvironmentSet" type="multi"/>
<value name="Update.InetTool" type="hex" data="00"/>
<value name="Update.InetToolCmd" type="string" data=""/>
</key>
</key>
</key>

View File

@ -16,3 +16,4 @@ icons\icon_256.png
Cmder.bat
vendor\tmp
appveyor.yml
vendor\cmder.sh

View File

@ -111,4 +111,10 @@ if($Compile) {
Write-Warning "This cannot be a release. Test build only!"
}
# Put vendor\cmder.sh in /etc/profile.d so it runs when we start bash or mintty
if ( (Test-Path $($SaveTo + "git-for-windows/etc/profile.d") ) ) {
write-verbose "Adding cmder.sh /etc/profile.d"
Copy-Item $($SaveTo + "cmder.sh") $($SaveTo + "git-for-windows/etc/profile.d/cmder.sh")
}
Write-Verbose "All good and done!"

53
vendor/cmder.sh vendored Normal file
View File

@ -0,0 +1,53 @@
# DO NOT EDIT THIS FILE IT WILL BE OVERWRITTEN ON UPDATE
#
# Add portable user customizations ${CMDER_ROOT}/config/user-cmder.sh,
# these customizations will follow Cmder if $CMDER_ROOT is copied
# to another machine.
#
# Add system specific users customizations to $HOME/.bashrc, these
# customizations will not follow Cmder to another machine.
# We do this for bash as admin sessions since $CMDER_ROOT is not being set
if [ "$CMDER_ROOT" == "" ] ; then
case "$ConEmuDir" in *\\*) CMDER_ROOT=$( cd "$(cygpath -u "$ConEmuDir")/../.." ; pwd );; esac
else
case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac
fi
# Remove any trailing '/'
CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::')
export CMDER_ROOT
if [ -d "/c/Program Files/Git" ] ; then
GIT_INSTALL_ROOT="/c/Program Files/Git"
elif [ -d "/c/Program Files(x86)/Git" ] ; then
GIT_INSTALL_ROOT="/c/Program Files(x86)/Git"
elif [ -d "${CMDER_ROOT}/vendor/git-for-windows" ] ; then
GIT_INSTALL_ROOT=${CMDER_ROOT}/vendor/git-for-windows
fi
if [[ ! "$PATH" =~ "${GIT_INSTALL_ROOT}/bin:" ]] ; then
PATH=${GIT_INSTALL_ROOT}/bin:$PATH
fi
PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT}
export PATH
if [ -f ${CMDER_ROOT}/config/user-cmder.sh ] ; then
. ${CMDER_ROOT}/config/user-cmder.sh
else
echo Creating user startup file: "${CMDER_ROOT}/config/user-cmder.sh"
cat <<-eof >"${CMDER_ROOT}/config/user-cmder.sh"
# use this file to run your own startup commands for msys2 bash'
# To add a new vendor to the path, do something like:
# export PATH=\${CMDER_ROOT}/vendor/whatever:\${PATH}
eof
fi
# Source the users .bashrc file if it exists
if [ -f "${HOME}/.bashrc" ] ; then
. "${HOME}/.bashrc"
fi

11
vendor/init.bat vendored
View File

@ -9,6 +9,7 @@
for /f "delims=" %%i in ("%ConEmuDir%\..\..") do @set CMDER_ROOT=%%~fi
)
:: Remove trailing '\'
@if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1%
:: Change the prompt style
@ -53,6 +54,16 @@
:: Add aliases
@doskey /macrofile="%CMDER_ROOT%\config\aliases"
:: See vendor\git-for-windows\README.portable for why we do this
:: Basically we need to execute this post-install.bat because we are
:: manually extracting the archive rather than executing the 7z sfx
@if exist "%CMDER_ROOT%\vendor\git-for-windows\post-install.bat" (
echo Running Git for Windows one time Post Install....
cd /d "%CMDER_ROOT%\vendor\git-for-windows\"
"%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
cd /d %USERPROFILE%
)
:: Set home path
@if not defined HOME set HOME=%USERPROFILE%

12
vendor/profile.ps1 vendored
View File

@ -4,6 +4,14 @@
# !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
# !!! Use "%CMDER_ROOT%\config\user-profile.ps1" to add your own startup commands
# We do this for Powershell as Admin Sessions because CMDER_ROOT is not beng set.
if (! $ENV:CMDER_ROOT ) {
$ENV:CMDER_ROOT = resolve-path( $ENV:ConEmuDir + "\..\.." )
}
# Remove trailing '\'
$ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\"))
# Compatibility with PS major versions <= 2
if(!$PSScriptRoot) {
$PSScriptRoot = Split-Path $Script:MyInvocation.MyCommand.Path
@ -26,7 +34,7 @@ try {
# Check if git is on PATH, i.e. Git already installed on system
Get-command -Name "git" -ErrorAction Stop >$null
} catch {
$env:Path += ";$env:CMDER_ROOT\vendor\git-for-windows\bin"
$env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\bin")
}
try {
@ -92,7 +100,7 @@ if ( $cmderStart ) {
$env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT"
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config/user-profile.ps1"
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1"
if(Test-Path $CmderUserProfilePath) {
# Create this file and place your own command in there.
. "$CmderUserProfilePath"