mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
commit
8fa151d1db
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,3 +13,4 @@ build/
|
||||
Version v*
|
||||
*.bak
|
||||
config/user-*
|
||||
config/aliases
|
||||
|
29
README.md
29
README.md
@ -107,7 +107,7 @@ You can write *.cmd|*.bat, *.ps1, and *.sh scripts and just drop them in the %CM
|
||||
|
||||
### 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'
|
||||
|
||||
@ -116,7 +116,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.
|
||||
@ -127,6 +127,31 @@ 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/Babun, MSys2, or Git for Windows SDK with Cmder.
|
||||
|
||||
1. Setup a new task by pressing '<kbd>Win</kbd> +<kbd>Alt</kbd> + <kbd>T</kbd>'
|
||||
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/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 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
|
||||
|
||||
1. Check for clink and git before injecting them (Sort of done)
|
||||
|
86
vendor/cmder_exinit
vendored
Normal file
86
vendor/cmder_exinit
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
# Copy this file to your non integrated *nix-like environment,
|
||||
# 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.
|
||||
#
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
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."
|
||||
fi
|
||||
elif [ "$CMDER_ROOT" != "" ] ; then
|
||||
case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac
|
||||
fi
|
||||
|
||||
if [ ! "$CMDER_ROOT" = "" ] ; then
|
||||
# Remove any trailing '/'
|
||||
CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::')
|
||||
|
||||
echo "Using \"CMDER_ROOT\" at \"${CMDER_ROOT}\"."
|
||||
|
||||
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 [ -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
|
||||
|
||||
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
|
Loading…
Reference in New Issue
Block a user