mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
Added/enhanced bash with cmder.sh/user-cmder.sh, organized tasks menu
added personal files to .gitignore so they never get uploaded to the repo and added support for msys2 bash in the new git for windows added autocreate of config/user-cmder.sh if iot does not exist and added it to the .gitignore Added tasks: cmd::Cmder, cmd::Cmder as Admin, bash::bash, bash::bash as Admin, bash::mintty, bash::mintty as admin, powershell::powershell, powershell::powershell as Admin. Set default task to cmd::Cmder. Cot rid of init.bat running before /bin/bash, fixes double exit requirement Added running git for windows post-install.bat on first cmder launch fixed file/path not found errors when launching powershell as admin fixed file/path not found errors when launching bash/mintty as admin fixed PATH in vendor/cmder.sh Added sourcing ~/.bashrc if it exists. changed .gitignore to ignore anything with path of config/user-* removed my personal files from .gitignore, left in config/user-* Make sure $CMDER_ROOT does not have a trailing '/' %CMDER_ROOT% does not have trailing '\'. allow user to specify a conemu.xml on the command line Removed '\' from %CMDER_ROOT%
This commit is contained in:
parent
ffd61db30e
commit
cf15dcffc7
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ Thumbs.db
|
||||
build/
|
||||
Version v*
|
||||
*.bak
|
||||
config/user-*
|
||||
|
10
Cmder.bat
10
Cmder.bat
@ -1,3 +1,11 @@
|
||||
@echo off
|
||||
SET CMDER_ROOT=%~dp0
|
||||
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"
|
||||
)
|
@ -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 "%CMDER_ROOT%\cmder.exe""/>
|
||||
<value name="Cmd1" type="string" data="*cmd /k "%ConEmuDir%\..\init.bat" -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 "%CMDER_ROOT%\cmder.exe""/>
|
||||
<value name="Cmd1" type="string" data="cmd /k "%ConEmuDir%\..\init.bat" -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 "%CMDER_ROOT%\cmder.exe""/>
|
||||
<value name="Cmd1" type="string" data="PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command "Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''" -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="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 "%CMDER_ROOT%\cmder.exe""/>
|
||||
<value name="Cmd1" type="string" data="*PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command "Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''" -new_console:d:"%USERPROFILE%""/>
|
||||
@ -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 "%CMDER_ROOT%\cmder.exe""/>
|
||||
<value name="Cmd1" type="string" data="PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command "Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''" -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="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 &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 &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 "%CMDER_ROOT%\cmder.exe""/>
|
||||
<value name="Cmd1" type="string" data="cmd /k "%ConEmuDir%\..\init.bat & %CMDER_ROOT%\vendor\git-for-windows\bin\bash --login -i" -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 "%ConEmuDir%\..\git-for-windows\bin\bash --login -i" -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 "%CMDER_ROOT%\cmder.exe""/>
|
||||
<value name="Cmd1" type="string" data="cmd /c "%ConEmuDir%\..\git-for-windows\bin\bash --login -i" -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>
|
||||
|
@ -16,3 +16,4 @@ icons\icon_256.png
|
||||
Cmder.bat
|
||||
vendor\tmp
|
||||
appveyor.yml
|
||||
vendor\cmder.sh
|
||||
|
@ -110,4 +110,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
53
vendor/cmder.sh
vendored
Normal 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
|
13
vendor/init.bat
vendored
13
vendor/init.bat
vendored
@ -9,6 +9,9 @@
|
||||
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
|
||||
:: Mmm tasty lamb
|
||||
@prompt $E[1;32;40m$P$S{git}{hg}$S$_$E[1;30;40m{lamb}$S$E[0m
|
||||
@ -51,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%
|
||||
|
||||
|
14
vendor/profile.ps1
vendored
14
vendor/profile.ps1
vendored
@ -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
|
||||
@ -20,7 +28,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 {
|
||||
@ -71,11 +79,11 @@ if (Test-Path Env:\CMDER_START) {
|
||||
$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"
|
||||
} else {
|
||||
Write-Host "Creating user startup file: $CmderUserProfilePath"
|
||||
"# Use this file to run your own startup commands" | Out-File $CmderUserProfilePath
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user