From 46bad57ef85088713d626c64d549b6c3ea0c3fb7 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 26 Nov 2015 09:27:32 -0600 Subject: [PATCH 1/8] 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 0e9e5ec..41ab87b 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 2/8] 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 0000000..e8bb45d --- /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 3/8] 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 e8bb45d..e924684 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 79f8560a24af9fae74f9c1fc594397db1bfe1b3f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 27 Feb 2016 07:40:47 -0600 Subject: [PATCH 4/8] 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 e924684..d4a0147 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 5/8] 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 5c1c250..817bc6a 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 6/8] 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 d4a0147..78dcf1a 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 7/8] --amend --- vendor/cmder_exinit | 97 ++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 49 deletions(-) diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index 78dcf1a..76acaa7 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 8/8] 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 817bc6a..d4e6179 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 76acaa7..6c29423 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