From 46bad57ef85088713d626c64d549b6c3ea0c3fb7 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 26 Nov 2015 09:27:32 -0600 Subject: [PATCH 01/26] Added config/aliases to .gitignore to account for recent changes in dev branch --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0e9e5ec53..41ab87bc1 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ build/ Version v* *.bak config/user-* +config/aliases From b88ea50aef3d2598056efac5e1286a7a8ded94ca Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 26 Nov 2015 09:32:10 -0600 Subject: [PATCH 02/26] Added vendor/cmder_exinit. Allows integrating externally installed Msys/Msys2/Cygwin into Cmder --- vendor/cmder_exinit | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 vendor/cmder_exinit diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit new file mode 100644 index 000000000..e8bb45d20 --- /dev/null +++ b/vendor/cmder_exinit @@ -0,0 +1,50 @@ +# Copy this file to your externally installed meaning not in the cmder/vendor +# folder Cygwin/Msys2/Msys installs '/etc/profile.d/' folder to integrate +# the externally installed Unix like environment into Cmder so it has +# access to settings stored in Cmder/config folder when launched. +# +# The destination file extension depends on the shell you use. For example: +# +# bash - Copy to /etc/profile.d/cmder_exinit.sh +# zsh - Copy to /etc/profile.d/cmder_exinit.zsh +# +# # Uncomment and edit the CMDER_ROOT line to use Cmder/config even when launched +# # from outside Cmder. +# CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder. + +# Add portable user customizations ${CMDER_ROOT}/config/user-profile.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" = "" -a "$ConEmuDir" != "" ] ; then + case "$ConEmuDir" in *\\*) CMDER_ROOT=$( cd "$(cygpath -u "$ConEmuDir")/../.." ; pwd );; esac +elif [ "$CMDER_ROOT" != "" ] ; then + case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac +else + break # This is a HACK to exit this script without exiting all running scripts. +fi >/dev/null 2>&1 # This prevents showing errors when the above HACK happens. + +# Remove any trailing '/' +CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::') + +export CMDER_ROOT + +PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} + +export PATH + +if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then + . ${CMDER_ROOT}/config/user-profile.sh +else + echo Creating user startup file: "${CMDER_ROOT}/config/user-profile.sh" + cat <<-eof >"${CMDER_ROOT}/config/user-profile.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 From 9eb9620966b9ecb391341c5b9d9cca8f61bd3a5b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 16 Dec 2015 12:37:40 -0500 Subject: [PATCH 03/26] Fixed som misc stuff and prevented multi runs --- vendor/cmder_exinit | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index e8bb45d20..e924684c6 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -19,14 +19,23 @@ # Add system specific users customizations to $HOME/.bashrc, these # customizations will not follow Cmder to another machine. +# Check that we haven't already been sourced. +[[ -z ${CMDER_EXINIT} ]] && CMDER_EXINIT="1" || return + # We do this for bash as admin sessions since $CMDER_ROOT is not being set if [ "$CMDER_ROOT" = "" -a "$ConEmuDir" != "" ] ; then case "$ConEmuDir" in *\\*) CMDER_ROOT=$( cd "$(cygpath -u "$ConEmuDir")/../.." ; pwd );; esac + if [ !-d $CMDER_ROOT/vendor ] ; then + echo "Running in ConEmu without Cmder, skipping Cmder integration." + return + fi elif [ "$CMDER_ROOT" != "" ] ; then case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac else - break # This is a HACK to exit this script without exiting all running scripts. -fi >/dev/null 2>&1 # This prevents showing errors when the above HACK happens. + return +fi + +echo "Using \"CMDER_ROOT\" at \"${CMDER_ROOT}\"...\n" # Remove any trailing '/' CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::') @@ -34,14 +43,14 @@ CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::') export CMDER_ROOT PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} - + export PATH if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then - . ${CMDER_ROOT}/config/user-profile.sh + . ${CMDER_ROOT}/config/user-profile.sh else - echo Creating user startup file: "${CMDER_ROOT}/config/user-profile.sh" - cat <<-eof >"${CMDER_ROOT}/config/user-profile.sh" + echo Creating user startup file: "${CMDER_ROOT}/config/user-profile.sh" + cat <<-eof >"${CMDER_ROOT}/config/user-profile.sh" # use this file to run your own startup commands for msys2 bash' # To add a new vendor to the path, do something like: From 78ea063fb0b3e10d2af0b862ddbe6a0a71335afa Mon Sep 17 00:00:00 2001 From: Jan Schulz Date: Tue, 23 Feb 2016 16:45:07 +0100 Subject: [PATCH 04/26] Typo in Readme.md --- config/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/Readme.md b/config/Readme.md index 1ed4f5113..15526c7bb 100644 --- a/config/Readme.md +++ b/config/Readme.md @@ -7,7 +7,7 @@ directly, it has to be hardlinked. `vendor\aliases.example`. * `*.lua`: clink completitions and prompt filters; called from vendor\cmder.lua after all other prompt filter and clink completitons are initialized; add your own. -* `user_profile.{sh|bat|ps1}: startup files for bash|cmd|powershell tasks; called from their +* `user_profile.{sh|bat|ps1}`: startup files for bash|cmd|powershell tasks; called from their respective startup scripts in `vendor\`; autocreated on first start of such a task * `.history`: the current commandline history; autoupdated on close * `settings`: settings for readline; overwritten on update From 0a6b79b9edfb2a48d884e0145b0e9ab47f9e3026 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 25 Feb 2016 07:53:57 -0600 Subject: [PATCH 05/26] Added profile.d like support for all supported shells --- README.md | 10 ++++++++++ vendor/cmder.sh | 13 +++++++++++++ vendor/init.bat | 14 ++++++++++++++ vendor/profile.ps1 | 12 ++++++++++++ 4 files changed, 49 insertions(+) diff --git a/README.md b/README.md index 5c1c250da..99fb51edb 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,16 @@ User specific configuration is possible using the cmder specific shell config fi Note: Bash and Mintty sessions will also source the '$HOME/.bashrc' file it it exists after it sources '$CMDER_ROOT/config/user-profile.sh'. +### Linux like 'profile.d' support for all supported shell types. +You can write *.cmd|*.bat, *.ps1, and *.sh scripts and just drop them in the %CMDER_ROOT%\config\profile.d folder to add startup config to Cmder. + +|Shell|Cmder 'Profile.d' Scripts| +| ------------- |:-------------:| +|Cmder|%CMDER_ROOT%\config\profile.d\*.bat and *.cmd| +|Powershell|$ENV:CMDER_ROOT\config\profile.d\*.ps1| +|Bash/Mintty|$CMDER_ROOT/config/profile.d/*.sh| + + ### Aliases #### Cmder(Cmd.exe) Aliases You can define simple aliases for `cmd.exe` sessions with a command like `alias name=command`. Cmd.exe aliases support optional parameters through the `$1-9` or the `$*` special characters so the alias `vi=vim.exe $*` typed as `vi [filename]` will open `[filename]` in `vim.exe`. diff --git a/vendor/cmder.sh b/vendor/cmder.sh index 4d1da3ac0..f51ace398 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -35,6 +35,19 @@ PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} export PATH +# Drop *.sh files into "%CMDER_ROOT%\config\profile.d" +# to run them at startup. +if [ ! -d ${CMDER_ROOT}/config/profile.d ] ; then + mkdir -p "${CMDER_ROOT}/config/profile.d" +fi + +pushd ${CMDER_ROOT}/config/profile.d >/dev/null +for x in $(ls ${CMDER_ROOT}/config/profile.d/*.sh) ; do + # echo ${x} + . $x +done +popd >/dev/null + if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then . ${CMDER_ROOT}/config/user-profile.sh else diff --git a/vendor/init.bat b/vendor/init.bat index 89e27c00d..72221e695 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -88,6 +88,20 @@ @cd /d "%CMDER_START%" ) +:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d" +:: to run them at startup. +@if not exist "%CMDER_ROOT%\config\profile.d" ( + mkdir "%CMDER_ROOT%\config\profile.d" +} + +@pushd "%CMDER_ROOT%\config\profile.d" +for /f "usebackq" %%x in ( `dir /b *.bat *.cmd` ) do ( + REM @echo Calling %CMDER_ROOT%\config\profile.d\%%x... + @call %%x +) +@popd + + @if exist "%CMDER_ROOT%\config\user-profile.cmd" ( @rem create this file and place your own command in there call "%CMDER_ROOT%\config\user-profile.cmd" diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 5713f761c..1aa037abb 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -91,6 +91,18 @@ if ( $ENV:CMDER_START ) { # Enhance Path $env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT" +# Drop *.ps1 files into "$ENV:CMDER_ROOT\config\profile.d" +# to run them at startup. +if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) { + mkdir "$ENV:CMDER_ROOT\config\profile.d" +} + +pushd $ENV:CMDER_ROOT\config\profile.d +foreach ($x in ls *.ps1) { + # write-host Sourcing $ENV:CMDER_ROOT\config\profile.d\$x + . $x +} + $CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1" if(Test-Path $CmderUserProfilePath) { # Create this file and place your own command in there. From a959409c0f0ba8bcdee55cdab81189fe4d41d473 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 25 Feb 2016 18:22:43 -0600 Subject: [PATCH 06/26] --amend --- vendor/profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 1aa037abb..f549ed4e6 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -92,7 +92,7 @@ if ( $ENV:CMDER_START ) { $env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT" # Drop *.ps1 files into "$ENV:CMDER_ROOT\config\profile.d" -# to run them at startup. +# to source them at startup. if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) { mkdir "$ENV:CMDER_ROOT\config\profile.d" } From aedd078050bb316111ab2fdd43112d351947a475 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Sat, 27 Feb 2016 01:39:06 +0100 Subject: [PATCH 07/26] :arrow_up: Git@2.7.2.windows.1 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index e592752ff..5bf86911b 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.7.1.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.7.1.windows.1/PortableGit-2.7.1-32-bit.7z.exe" + "version": "v2.7.2.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.7.2.windows.1/PortableGit-2.7.2-32-bit.7z.exe" }, { "name": "clink", From 79f8560a24af9fae74f9c1fc594397db1bfe1b3f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 27 Feb 2016 07:40:47 -0600 Subject: [PATCH 08/26] added profile.d stuff --- vendor/cmder_exinit | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index e924684c6..d4a01472e 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -1,7 +1,8 @@ -# Copy this file to your externally installed meaning not in the cmder/vendor -# folder Cygwin/Msys2/Msys installs '/etc/profile.d/' folder to integrate -# the externally installed Unix like environment into Cmder so it has -# access to settings stored in Cmder/config folder when launched. +# Copy this file to your non integrated *nix-like environment, +# Cygwin/MinGW/MSys2/Git for Windows SDK, installs '/etc/profile.d/' +# folder to integrate the externally installed Unix like environment +# into Cmder so it has access to settings stored in Cmder/config +# folder when launched. # # The destination file extension depends on the shell you use. For example: # @@ -12,8 +13,11 @@ # # from outside Cmder. # CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder. -# Add portable user customizations ${CMDER_ROOT}/config/user-profile.sh, -# these customizations will follow Cmder if $CMDER_ROOT is copied +# Add portable user customizations ${CMDER_ROOT}/config/user-profile.sh or +# add whole config scripts to ${CMDER_ROOT}/config/profile.d both will be sourced +# from mthis file and be appied to the environment at startup. +# +# These customizations will follow Cmder if $CMDER_ROOT is copied # to another machine. # # Add system specific users customizations to $HOME/.bashrc, these @@ -46,6 +50,21 @@ PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} export PATH +if [ ! -d ${CMDER_ROOT}/config/profile.d ; then + mkdir -p ${CMDER_ROOT}/config/profile.d +fi + +# Drop *.sh files into "${CMDER_ROOT}\config\profile.d" +# to source them at startup. +if [ -d ${CMDER_ROOT}/config/profile.d ] ; then + pushd ${CMDER_ROOT}/config/profile.d >/dev/null + for x in $(ls ${CMDER_ROOT}/config/profile.d/*.sh) ; do + # echo ${x} + . $x + done + popd >/dev/null +fi + if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then . ${CMDER_ROOT}/config/user-profile.sh else From 6cf62dcdc72a1b6c22419b6183dea6ee381e6588 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 27 Feb 2016 07:42:22 -0600 Subject: [PATCH 09/26] Added details on integrating external *nix like env --- README.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5c1c250da..817bc6a94 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ Note: Bash and Mintty sessions will also source the '$HOME/.bashrc' file it it e ### Aliases #### Cmder(Cmd.exe) Aliases -You can define simple aliases for `cmd.exe` sessions with a command like `alias name=command`. Cmd.exe aliases support optional parameters through the `$1-9` or the `$*` special characters so the alias `vi=vim.exe $*` typed as `vi [filename]` will open `[filename]` in `vim.exe`. +You can define simple aliases for `cmd.exe` sessions with a command like `alias name=command`. Cmd.exe aliases support optional parameters through the `$1-9` or the `$*` special characters so the alias `vi=vim.exe $*` typed as `vi [filename]` will open `[filename]` in `vim.exe`. Cmd.exe aliases can also be more complex. See: [DOSKEY.EXE documentation](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/doskey.mspx?mfr=true) for additional details on complex aliases/macros for 'cmd.exe' @@ -106,7 +106,7 @@ Aliases defined using the `alias.bat` command will automatically be saved in the #### Bash.exe|Mintty.exe Aliases Bash shells support simple and complex aliases with optional parameters natively so they work a little different. Typing `alias name=command` will create an alias only for the current running session. To make an alias permanent add it to either your `$CMDER_ROOT/config/user-profile.sh` or your `$HOME/.bashrc`. -If you add bash aliases to `$CMDER_ROOT/config/user-profile.sh` they will portable and follow your Cmder folder if you copy it to another machine. `$HOME/.bashrc` defined aliases are not portable. +If you add bash aliases to `$CMDER_ROOT/config/user-profile.sh` they will portable and follow your Cmder folder if you copy it to another machine. `$HOME/.bashrc` defined aliases are not portable. #### Powershell.exe Aliases Powershell has native simple alias support, for example `[new-alias | set-alias] alias command`, so complex aliases with optional parameters are not supported in Powershell sessions. Type `get-help [new-alias|set-alias] -full` for help on Powershell aliases. @@ -117,6 +117,25 @@ To start SSH agent simply call `start-ssh-agent`, which is in the `vendor/git-fo If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"` in `%CMDER_ROOT%/config/user-profile.cmd` (usually just uncomment it). +### Using external Cygwin, MinGW, MSys2, or Git for Windows SDK with Cmder + +1. Setup a new task by pressing 'Win +Alt + T' +1. Click the '+' button to add a task. +1. Name the new task in the top text box. +1. Provide task parameters, this is optional. +1. Add ```cmd /c "[path_to_external_env]\bin\bash --login -i" -new_console:d:%USERPROFILE%``` to the Commands text box. + +Recommended Optional Steps: + +Copy the 'vendor/cmder_exinit' file to the Cygwin, MinGW, MSys2, or Git for Windows SDK environments ```/etc/profile.d/``` folder to use portable settings in the $CMDER_ROOT/config folder. + +The destination file extension depends on the shell you use in that environment. For example: + +* bash - Copy to /etc/profile.d/cmder_exinit.sh +* zsh - Copy to /etc/profile.d/cmder_exinit.zsh + +Uncomment and edit the below line to use Cmder/config even when launched from outside Cmder. + ## Todo 1. Check for clink and git before injecting them (Sort of done) From 9e7f860e2d34b5e73704dcb8b68d9534d37b7d9a Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 27 Feb 2016 08:43:39 -0600 Subject: [PATCH 10/26] Fixed and added zsh shell capability --- vendor/cmder_exinit | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index d4a01472e..78dcf1a25 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -50,18 +50,27 @@ PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} export PATH -if [ ! -d ${CMDER_ROOT}/config/profile.d ; then +if [ ! -d "${CMDER_ROOT}/config/profile.d" ] ; then mkdir -p ${CMDER_ROOT}/config/profile.d fi -# Drop *.sh files into "${CMDER_ROOT}\config\profile.d" +# Drop *.sh or *.zsh files into "${CMDER_ROOT}\config\profile.d" # to source them at startup. -if [ -d ${CMDER_ROOT}/config/profile.d ] ; then +if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then + unset profile_d_scripts pushd ${CMDER_ROOT}/config/profile.d >/dev/null - for x in $(ls ${CMDER_ROOT}/config/profile.d/*.sh) ; do - # echo ${x} - . $x - done + if [ ! "x${ZSH_VERSION}" = "x" ]; then + profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.zsh) 2>/dev/null + elif [ ! "x${BASH_VERSION}" = "x" ]; then + profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh) 2>/dev/null + fi + + if [ ! "x${profile_d_scripts}" = "x" ] ; then + for x in ${profile_d_scripts} ; do + # echo Sourcing "${x}"... + . $x + done + fi popd >/dev/null fi From f7a18d4b6e13b9307a912f53d60e0aac00acec4f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 27 Feb 2016 12:00:40 -0600 Subject: [PATCH 11/26] --amend --- vendor/cmder_exinit | 97 ++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 49 deletions(-) diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index 78dcf1a25..76acaa72e 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -1,5 +1,5 @@ # Copy this file to your non integrated *nix-like environment, -# Cygwin/MinGW/MSys2/Git for Windows SDK, installs '/etc/profile.d/' +# Cygwin/MSys2/Git for Windows SDK, installs '/etc/profile.d/' # folder to integrate the externally installed Unix like environment # into Cmder so it has access to settings stored in Cmder/config # folder when launched. @@ -8,11 +8,6 @@ # # bash - Copy to /etc/profile.d/cmder_exinit.sh # zsh - Copy to /etc/profile.d/cmder_exinit.zsh -# -# # Uncomment and edit the CMDER_ROOT line to use Cmder/config even when launched -# # from outside Cmder. -# CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder. - # Add portable user customizations ${CMDER_ROOT}/config/user-profile.sh or # add whole config scripts to ${CMDER_ROOT}/config/profile.d both will be sourced # from mthis file and be appied to the environment at startup. @@ -23,65 +18,69 @@ # Add system specific users customizations to $HOME/.bashrc, these # customizations will not follow Cmder to another machine. +# # Uncomment and edit the CMDER_ROOT line to use Cmder/config even when launched +# # from outside Cmder. +# CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder. + # Check that we haven't already been sourced. [[ -z ${CMDER_EXINIT} ]] && CMDER_EXINIT="1" || return # We do this for bash as admin sessions since $CMDER_ROOT is not being set if [ "$CMDER_ROOT" = "" -a "$ConEmuDir" != "" ] ; then - case "$ConEmuDir" in *\\*) CMDER_ROOT=$( cd "$(cygpath -u "$ConEmuDir")/../.." ; pwd );; esac - if [ !-d $CMDER_ROOT/vendor ] ; then + if [ -d "${ConEmuDir}../../vendor" ] ; then + case "$ConEmuDir" in *\\*) CMDER_ROOT=$( cd "$(cygpath -u "$ConEmuDir")/../.." ; pwd );; esac + else echo "Running in ConEmu without Cmder, skipping Cmder integration." - return fi elif [ "$CMDER_ROOT" != "" ] ; then case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac -else - return fi -echo "Using \"CMDER_ROOT\" at \"${CMDER_ROOT}\"...\n" - -# Remove any trailing '/' -CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::') - -export CMDER_ROOT - -PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} - -export PATH - -if [ ! -d "${CMDER_ROOT}/config/profile.d" ] ; then - mkdir -p ${CMDER_ROOT}/config/profile.d -fi - -# Drop *.sh or *.zsh files into "${CMDER_ROOT}\config\profile.d" -# to source them at startup. -if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then - unset profile_d_scripts - pushd ${CMDER_ROOT}/config/profile.d >/dev/null - if [ ! "x${ZSH_VERSION}" = "x" ]; then - profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.zsh) 2>/dev/null - elif [ ! "x${BASH_VERSION}" = "x" ]; then - profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh) 2>/dev/null +if [ ! "$CMDER_ROOT" = "" ] ; then + # Remove any trailing '/' + CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::') + + echo "Using \"CMDER_ROOT\" at \"${CMDER_ROOT}\"...\n" + + export CMDER_ROOT + + PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} + + export PATH + + # Drop *.sh or *.zsh files into "${CMDER_ROOT}\config\profile.d" + # to source them at startup. + if [ ! -d "${CMDER_ROOT}/config/profile.d" ] ; then + mkdir -p ${CMDER_ROOT}/config/profile.d fi - - if [ ! "x${profile_d_scripts}" = "x" ] ; then - for x in ${profile_d_scripts} ; do - # echo Sourcing "${x}"... - . $x - done + + if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then + unset profile_d_scripts + pushd ${CMDER_ROOT}/config/profile.d >/dev/null + if [ ! "x${ZSH_VERSION}" = "x" ]; then + profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.zsh) 2>/dev/null + elif [ ! "x${BASH_VERSION}" = "x" ]; then + profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh) 2>/dev/null + fi + + if [ ! "x${profile_d_scripts}" = "x" ] ; then + for x in ${profile_d_scripts} ; do + # echo Sourcing "${x}"... + . $x + done + fi + popd >/dev/null fi - popd >/dev/null -fi - -if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then - . ${CMDER_ROOT}/config/user-profile.sh -else - echo Creating user startup file: "${CMDER_ROOT}/config/user-profile.sh" - cat <<-eof >"${CMDER_ROOT}/config/user-profile.sh" + + if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then + . ${CMDER_ROOT}/config/user-profile.sh + else + echo Creating user startup file: "${CMDER_ROOT}/config/user-profile.sh" + cat <<-eof >"${CMDER_ROOT}/config/user-profile.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 fi From 727d6a6abd7917bb0b6854edf6441aa75b027e75 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 27 Feb 2016 12:02:42 -0600 Subject: [PATCH 12/26] Added bits about MinGW integration status --- README.md | 12 +++++++++--- vendor/cmder_exinit | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 817bc6a94..d4e617914 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ To start SSH agent simply call `start-ssh-agent`, which is in the `vendor/git-fo If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"` in `%CMDER_ROOT%/config/user-profile.cmd` (usually just uncomment it). -### Using external Cygwin, MinGW, MSys2, or Git for Windows SDK with Cmder +### Using external Cygwin/Babun, MSys2, or Git for Windows SDK with Cmder. 1. Setup a new task by pressing 'Win +Alt + T' 1. Click the '+' button to add a task. @@ -127,14 +127,20 @@ If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_R Recommended Optional Steps: -Copy the 'vendor/cmder_exinit' file to the Cygwin, MinGW, MSys2, or Git for Windows SDK environments ```/etc/profile.d/``` folder to use portable settings in the $CMDER_ROOT/config folder. +Copy the 'vendor/cmder_exinit' file to the Cygwin/Babun, MSys2, or Git for Windows SDK environments ```/etc/profile.d/``` folder to use portable settings in the $CMDER_ROOT/config folder. + +Note: MinGW could work if the init scripts include profile.d but this has not been tested. The destination file extension depends on the shell you use in that environment. For example: * bash - Copy to /etc/profile.d/cmder_exinit.sh * zsh - Copy to /etc/profile.d/cmder_exinit.zsh -Uncomment and edit the below line to use Cmder/config even when launched from outside Cmder. +Uncomment and edit the below line in the script to use Cmder config even when launched from outside Cmder. + +``` +# CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder. +``` ## Todo diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index 76acaa72e..6c2942309 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -40,7 +40,7 @@ if [ ! "$CMDER_ROOT" = "" ] ; then # Remove any trailing '/' CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::') - echo "Using \"CMDER_ROOT\" at \"${CMDER_ROOT}\"...\n" + echo "Using \"CMDER_ROOT\" at \"${CMDER_ROOT}\"." export CMDER_ROOT From 361a8eae66fb74ade18c403c9fe4885bee1eee77 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 27 Feb 2016 12:19:03 -0600 Subject: [PATCH 13/26] Fixed profile.d support for bash --- vendor/cmder.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/vendor/cmder.sh b/vendor/cmder.sh index f51ace398..2666f5898 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -35,18 +35,25 @@ PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} export PATH -# Drop *.sh files into "%CMDER_ROOT%\config\profile.d" -# to run them at startup. -if [ ! -d ${CMDER_ROOT}/config/profile.d ] ; then - mkdir -p "${CMDER_ROOT}/config/profile.d" +# Drop *.sh or *.zsh files into "${CMDER_ROOT}\config\profile.d" +# to source them at startup. +if [ ! -d "${CMDER_ROOT}/config/profile.d" ] ; then + mkdir -p ${CMDER_ROOT}/config/profile.d fi -pushd ${CMDER_ROOT}/config/profile.d >/dev/null -for x in $(ls ${CMDER_ROOT}/config/profile.d/*.sh) ; do - # echo ${x} - . $x -done -popd >/dev/null +if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then + unset profile_d_scripts + pushd ${CMDER_ROOT}/config/profile.d >/dev/null + profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh) 2>/dev/null + + if [ ! "x${profile_d_scripts}" = "x" ] ; then + for x in ${profile_d_scripts} ; do + # echo Sourcing "${x}"... + . $x + done + fi + popd >/dev/null +fi if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then . ${CMDER_ROOT}/config/user-profile.sh From 434d6f2996613e43e35647975caa98a6e968abeb Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 28 Feb 2016 10:41:10 -0600 Subject: [PATCH 14/26] Fixed profile.d table --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99fb51edb..70be2962d 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,8 @@ You can write *.cmd|*.bat, *.ps1, and *.sh scripts and just drop them in the %CM |Shell|Cmder 'Profile.d' Scripts| | ------------- |:-------------:| -|Cmder|%CMDER_ROOT%\config\profile.d\*.bat and *.cmd| -|Powershell|$ENV:CMDER_ROOT\config\profile.d\*.ps1| +|Cmder|%CMDER_ROOT%\config\profile.d\\*.bat and *.cmd| +|Powershell|$ENV:CMDER_ROOT\config\profile.d\\*.ps1| |Bash/Mintty|$CMDER_ROOT/config/profile.d/*.sh| From bf75f70181c800bc01ed6e3e3225588fbde9b2a9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Tue, 1 Mar 2016 20:35:24 -0600 Subject: [PATCH 15/26] added config/profile.d --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 41ab87bc1..9fa67af69 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ Version v* *.bak config/user-* config/aliases +config/profile.d From 8a5c58e626f6cd2a3397ea1342cda0b1c8a8b32c Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Tue, 1 Mar 2016 20:35:55 -0600 Subject: [PATCH 16/26] fixed cmd profile.d support --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 72221e695..a3e7e7cd0 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -92,7 +92,7 @@ :: to run them at startup. @if not exist "%CMDER_ROOT%\config\profile.d" ( mkdir "%CMDER_ROOT%\config\profile.d" -} +) @pushd "%CMDER_ROOT%\config\profile.d" for /f "usebackq" %%x in ( `dir /b *.bat *.cmd` ) do ( From c904676cf4afdbe856d6dabee39427be868598cc Mon Sep 17 00:00:00 2001 From: Jan Schulz Date: Wed, 2 Mar 2016 18:29:34 +0100 Subject: [PATCH 17/26] Revert "Set CMDER_START to homeprofile" This reverts commit 728e83a85bea6ad7b4ddda0b960c443e3ef9f737. The problem with *always* setting CMDER_START is that this makes the `-new_console:d:%USERPROFILE%` in the conemu task definitions unnecessary, as this is now always overwritten as CMDER_START is set. This also means that a very visible conemu UI for setting the startup dir does not work anymore which might leave the user puzzled why. --- launcher/src/CmderLauncher.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 4982fd08f..b2b0ffabb 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -3,7 +3,6 @@ #include #include "resource.h" #include -#include #pragma comment(lib, "Shlwapi.lib") @@ -156,16 +155,7 @@ void StartCmder(std::wstring path, bool is_single_mode) } SetEnvironmentVariable(L"CMDER_ROOT", exeDir); - if (streqi(path.c_str(), L"")) - { - wchar_t* homeProfile = 0; - SHGetKnownFolderPath(FOLDERID_Profile, 0, NULL, &homeProfile); - if (!SetEnvironmentVariable(L"CMDER_START", homeProfile)) { - MessageBox(NULL, _T("Error trying to set CMDER_START to given path!"), _T("Error"), MB_OK); - } - CoTaskMemFree(static_cast(homeProfile)); - } - else + if (!streqi(path.c_str(), L"")) { if (!SetEnvironmentVariable(L"CMDER_START", path.c_str())) { MessageBox(NULL, _T("Error trying to set CMDER_START to given path!"), _T("Error"), MB_OK); From 32c1d4028ad28372a4a4aadfdaa6ddd86fec4898 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 2 Mar 2016 15:17:43 -0600 Subject: [PATCH 18/26] added fully qualified path to cmd profile.d section --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index a3e7e7cd0..363590626 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -97,7 +97,7 @@ @pushd "%CMDER_ROOT%\config\profile.d" for /f "usebackq" %%x in ( `dir /b *.bat *.cmd` ) do ( REM @echo Calling %CMDER_ROOT%\config\profile.d\%%x... - @call %%x + @call "%CMDER_ROOT%\config\profile.d\%%x" ) @popd From d6eec2f3a5000e69b1e14a9d724cb429576bed8c Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 2 Mar 2016 16:16:27 -0600 Subject: [PATCH 19/26] silence profile.d if profile.d is empty --- vendor/init.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 363590626..442ae9c0f 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -95,8 +95,8 @@ ) @pushd "%CMDER_ROOT%\config\profile.d" -for /f "usebackq" %%x in ( `dir /b *.bat *.cmd` ) do ( - REM @echo Calling %CMDER_ROOT%\config\profile.d\%%x... +@for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do @( + @REM echo Calling %CMDER_ROOT%\config\profile.d\%%x... @call "%CMDER_ROOT%\config\profile.d\%%x" ) @popd From 8dbbb902d989e324590f7c9fa6b8069e63825d53 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 2 Mar 2016 17:52:12 -0600 Subject: [PATCH 20/26] fixed vendor\profile.ps1 profile.d - added post popd --- vendor/profile.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index f549ed4e6..cbe7e19f9 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -99,9 +99,10 @@ if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) { pushd $ENV:CMDER_ROOT\config\profile.d foreach ($x in ls *.ps1) { - # write-host Sourcing $ENV:CMDER_ROOT\config\profile.d\$x + # write-host write-host Sourcing $x . $x } +popd $CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1" if(Test-Path $CmderUserProfilePath) { From 722f8b77453d4cead391e1ccbbaa069b3e9a8b92 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 6 Mar 2016 15:05:40 -0600 Subject: [PATCH 21/26] silenced bash profile.d when profile.d is empty --- vendor/cmder.sh | 2 +- vendor/cmder_exinit | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/cmder.sh b/vendor/cmder.sh index 2666f5898..4fac0becc 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -44,7 +44,7 @@ fi if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then unset profile_d_scripts pushd ${CMDER_ROOT}/config/profile.d >/dev/null - profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh) 2>/dev/null + profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh 2>/dev/null) if [ ! "x${profile_d_scripts}" = "x" ] ; then for x in ${profile_d_scripts} ; do diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index 6c2942309..7e83d649d 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -58,9 +58,9 @@ if [ ! "$CMDER_ROOT" = "" ] ; then unset profile_d_scripts pushd ${CMDER_ROOT}/config/profile.d >/dev/null if [ ! "x${ZSH_VERSION}" = "x" ]; then - profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.zsh) 2>/dev/null + profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.zsh 2>/dev/null) elif [ ! "x${BASH_VERSION}" = "x" ]; then - profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh) 2>/dev/null + profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh 2>/dev/null) fi if [ ! "x${profile_d_scripts}" = "x" ] ; then From 0f4292aa08a7f9b2496e592d4f088a6b4e36bb1a Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 6 Mar 2016 15:40:06 -0600 Subject: [PATCH 22/26] Prefer use of first line @echo off vs. @ per line to turn off echo per line. - Cleaner file, no side efects --- vendor/init.bat | 68 +++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 442ae9c0f..1409b9f0f 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -1,3 +1,5 @@ +@echo off + :: Init Script for cmd.exe :: Created as part of cmder project @@ -5,41 +7,41 @@ :: !!! Use "%CMDER_ROOT%\config\user-profile.cmd" to add your own startup commands :: Find root dir -@if not defined CMDER_ROOT ( - for /f "delims=" %%i in ("%ConEmuDir%\..\..") do @set CMDER_ROOT=%%~fi +if not defined CMDER_ROOT ( + for /f "delims=" %%i in ("%ConEmuDir%\..\..") do set CMDER_ROOT=%%~fi ) :: Remove trailing '\' -@if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1% +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 +prompt $E[1;32;40m$P$S{git}{hg}$S$_$E[1;30;40m{lamb}$S$E[0m :: Pick right version of clink -@if "%PROCESSOR_ARCHITECTURE%"=="x86" ( +if "%PROCESSOR_ARCHITECTURE%"=="x86" ( set architecture=86 ) else ( set architecture=64 ) :: Tell the user about the clink config files... -@if not exist "%CMDER_ROOT%\config\settings" ( +if not exist "%CMDER_ROOT%\config\settings" ( echo Generating clink initial settings in %CMDER_ROOT%\config\settings echo Additional *.lua files in %CMDER_ROOT%\config are loaded on startup. ) :: Run clink -@"%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" +"%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" :: Prepare for git-for-windows :: I do not even know, copypasted from their .bat -@set PLINK_PROTOCOL=ssh -@if not defined TERM set TERM=cygwin +set PLINK_PROTOCOL=ssh +if not defined TERM set TERM=cygwin :: Check if msysgit is installed -@if exist "%ProgramFiles%\Git" ( +if exist "%ProgramFiles%\Git" ( set "GIT_INSTALL_ROOT=%ProgramFiles%\Git" ) else if exist "%ProgramFiles(x86)%\Git" ( set "GIT_INSTALL_ROOT=%ProgramFiles(x86)%\Git" @@ -50,29 +52,29 @@ ) :: Add git to the path -@if defined GIT_INSTALL_ROOT ( +if defined GIT_INSTALL_ROOT ( set "PATH=%GIT_INSTALL_ROOT%\bin;%GIT_INSTALL_ROOT%\usr\bin;%GIT_INSTALL_ROOT%\usr\share\vim\vim74;%PATH%" :: define SVN_SSH so we can use git svn with ssh svn repositories if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe" ) :: Enhance Path -@set "PATH=%CMDER_ROOT%\bin;%PATH%;%CMDER_ROOT%\" +set "PATH=%CMDER_ROOT%\bin;%PATH%;%CMDER_ROOT%\" :: make sure we have an example file -@if not exist "%CMDER_ROOT%\config\aliases" ( +if not exist "%CMDER_ROOT%\config\aliases" ( echo Creating intial aliases in %CMDER_ROOT%\config\aliases copy "%CMDER_ROOT%\vendor\aliases.example" "%CMDER_ROOT%\config\aliases" > null ) :: Add aliases -@doskey /macrofile="%CMDER_ROOT%\config\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" ( +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 @@ -80,39 +82,39 @@ ) :: Set home path -@if not defined HOME set HOME=%USERPROFILE% +if not defined HOME set HOME=%USERPROFILE% :: This is either a env variable set by the user or the result of :: cmder.exe setting this variable due to a commandline argument or a "cmder here" -@if defined CMDER_START ( - @cd /d "%CMDER_START%" +if defined CMDER_START ( + cd /d "%CMDER_START%" ) :: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d" :: to run them at startup. -@if not exist "%CMDER_ROOT%\config\profile.d" ( +if not exist "%CMDER_ROOT%\config\profile.d" ( mkdir "%CMDER_ROOT%\config\profile.d" ) -@pushd "%CMDER_ROOT%\config\profile.d" -@for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do @( - @REM echo Calling %CMDER_ROOT%\config\profile.d\%%x... - @call "%CMDER_ROOT%\config\profile.d\%%x" +pushd "%CMDER_ROOT%\config\profile.d" +for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do ( + REM echo Calling %CMDER_ROOT%\config\profile.d\%%x... + call "%CMDER_ROOT%\config\profile.d\%%x" ) -@popd +popd -@if exist "%CMDER_ROOT%\config\user-profile.cmd" ( - @rem create this file and place your own command in there +if exist "%CMDER_ROOT%\config\user-profile.cmd" ( + rem create this file and place your own command in there call "%CMDER_ROOT%\config\user-profile.cmd" ) else ( - @echo Creating user startup file: "%CMDER_ROOT%\config\user-profile.cmd" + echo Creating user startup file: "%CMDER_ROOT%\config\user-profile.cmd" ( - @echo :: use this file to run your own startup commands - @echo :: use @ in front of the command to prevent printing the command - @echo. - @echo :: @call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd - @echo :: @set PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%% - @echo. + echo :: use this file to run your own startup commands + echo :: use in front of the command to prevent printing the command + echo. + echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd + echo :: set PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%% + echo. ) > "%CMDER_ROOT%\config\user-profile.cmd" ) From 01667a5bf0c675b94184956c7a0c86754418f96a Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 7 Mar 2016 08:12:50 -0600 Subject: [PATCH 23/26] Process profile.d scripts before adding user aliases --- vendor/init.bat | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 1409b9f0f..4fc232c3f 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -61,6 +61,18 @@ if defined GIT_INSTALL_ROOT ( :: Enhance Path set "PATH=%CMDER_ROOT%\bin;%PATH%;%CMDER_ROOT%\" +:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d" +:: to run them at startup. +if not exist "%CMDER_ROOT%\config\profile.d" ( + mkdir "%CMDER_ROOT%\config\profile.d" +) + +pushd "%CMDER_ROOT%\config\profile.d" +for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do ( + REM echo Calling %CMDER_ROOT%\config\profile.d\%%x... + call "%CMDER_ROOT%\config\profile.d\%%x" +) +popd :: make sure we have an example file if not exist "%CMDER_ROOT%\config\aliases" ( @@ -90,20 +102,6 @@ if defined CMDER_START ( cd /d "%CMDER_START%" ) -:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d" -:: to run them at startup. -if not exist "%CMDER_ROOT%\config\profile.d" ( - mkdir "%CMDER_ROOT%\config\profile.d" -) - -pushd "%CMDER_ROOT%\config\profile.d" -for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do ( - REM echo Calling %CMDER_ROOT%\config\profile.d\%%x... - call "%CMDER_ROOT%\config\profile.d\%%x" -) -popd - - if exist "%CMDER_ROOT%\config\user-profile.cmd" ( rem create this file and place your own command in there call "%CMDER_ROOT%\config\user-profile.cmd" From 05c113efeece89136ca2b95dd9ae514bc49b19b5 Mon Sep 17 00:00:00 2001 From: Martin Kemp Date: Thu, 10 Mar 2016 10:50:37 +0000 Subject: [PATCH 24/26] Fix PSReadline clearing directory prompt. If user has PSReadline and is using it be sure to clear 1 less line to prevent the directory prompt from being cleared. Fixes #879 --- vendor/profile.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index cbe7e19f9..0d830f568 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -88,6 +88,10 @@ if ( $ENV:CMDER_START ) { Set-Location -Path "$ENV:CMDER_START" } +if (Get-Module PSReadline -ErrorAction "SilentlyContinue") { + Set-PSReadlineOption -ExtraPromptLineCount 1 +} + # Enhance Path $env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT" From 0de643be4260259ef451aa3677b8d9def8e003a2 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Thu, 17 Mar 2016 03:32:51 +0100 Subject: [PATCH 25/26] :arrow_up: Git@2.7.2.windows.1 Changelog: https://github.com/git-for-windows/git/releases/tag/v2.7.3.windows.1 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 5bf86911b..ca0dd64b0 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.7.2.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.7.2.windows.1/PortableGit-2.7.2-32-bit.7z.exe" + "version": "v2.7.3.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.7.3.windows.1/PortableGit-2.7.3-32-bit.7z.exe" }, { "name": "clink", From 3ca847fc424549947e2f926a3a0d5f35d0470a53 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Fri, 18 Mar 2016 18:20:06 +0100 Subject: [PATCH 26/26] :arrow_up: Git@2.7.4.windows.1 Changelog: https://github.com/git-for-windows/git/releases/tag/v2.7.4.windows.1 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index ca0dd64b0..3a63b22a0 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.7.3.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.7.3.windows.1/PortableGit-2.7.3-32-bit.7z.exe" + "version": "v2.7.4.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.7.4.windows.1/PortableGit-2.7.4-32-bit.7z.exe" }, { "name": "clink",