diff --git a/README.md b/README.md index 7630fed..96e78b8 100644 --- a/README.md +++ b/README.md @@ -112,16 +112,39 @@ You can define simple aliases for `cmd.exe` sessions with a command like `alias 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' -Aliases defined using the `alias.bat` command will automatically be saved in the `%CMDER_ROOT%\config\aliases` file +Aliases defined using the `alias.bat` command will automatically be saved in the `%CMDER_ROOT%\config\user-aliases.cmd` file + +To make an alias and/or any other profile settings permanent add it to one of the following: + +Note: These are loaded in this order by '$CMDER_ROOT/vendor/init.bat'. Anyhing stored in '%CMDER_ROOT%' will be a portable setting and will follow cmder to another machine. + +* '%CMDER_ROOT%\\config\\profile.d\\\*.cmd and \*.bat' +* '%CMDER_ROOT%\\config\\user-aliases.cmd' +* '%CMDER_ROOT%\\config\\user-profile.cmd' #### 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`. +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 and/or any other profile settings permanent add it to one of the following: + +Note: These are loaded in this order by '$CMDER_ROOT/vendor/git-for-windows/etc/profile.d/cmder.sh'. Anyhing stored in '$CMDER_ROOT' will be a portable setting and will follow cmder to another machine. + +* '$CMDER_ROOT/config/profile.d/*.sh' +* '$CMDER_ROOT/config/user-profile.sh' +* '$HOME/.bashrc' If you add bash aliases to `$CMDER_ROOT/config/user-profile.sh` they will be 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. +To make an alias and/or any other profile settings permanent add it to one of the following: + +Note: These are loaded in this order by '$ENV:CMDER_ROOT\\vendor\\user-profile.ps1'. Anyhing stored in '$ENV:CMDER_ROOT' will be a portable setting and will follow cmder to another machine. + +* '$ENV:CMDER_ROOT\\config\\profile.d\\\*.ps1' +* '$ENV:CMDER_ROOT\\config\\user-profile.ps1' + ### SSH Agent To start SSH agent simply call `start-ssh-agent`, which is in the `vendor/git-for-windows/cmd` folder. diff --git a/bin/alias.bat b/bin/alias.bat index cf5d07d..69497f6 100644 --- a/bin/alias.bat +++ b/bin/alias.bat @@ -96,7 +96,7 @@ set del_alias=%~1 findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp" type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" doskey %del_alias%= -doskey /macrofile=%ALIASES% +doskey /macrofile="%ALIASES%" goto:eof :p_reload diff --git a/config/ConEmu.xml b/config/ConEmu.xml index af06ef0..0be905d 100644 --- a/config/ConEmu.xml +++ b/config/ConEmu.xml @@ -548,14 +548,14 @@ - + - + diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 42f2902..da97b69 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -95,7 +95,7 @@ bool FileExists(const wchar_t * filePath) return false; } -void StartCmder(std::wstring path, bool is_single_mode) +void StartCmder(std::wstring path, bool is_single_mode, std::wstring taskName = L"") { #if USE_TASKBAR_API wchar_t appId[MAX_PATH] = { 0 }; @@ -180,6 +180,10 @@ void StartCmder(std::wstring path, bool is_single_mode) swprintf_s(args, L"/Icon \"%s\" /Title Cmder", icoPath); } + if (!taskName.empty()) { + swprintf_s(args, L"%s /run {%s}", args, taskName.c_str()); + } + SetEnvironmentVariable(L"CMDER_ROOT", exeDir); if (!streqi(path.c_str(), L"")) { @@ -323,6 +327,10 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, { StartCmder(opt.second, true); } + else if (streqi(opt.first.c_str(), L"/TASK")) + { + StartCmder(L"", false, opt.second); + } else if (streqi(opt.first.c_str(), L"/REGISTER")) { RegisterShellMenu(opt.second, SHELL_MENU_REGISTRY_PATH_BACKGROUND); @@ -335,7 +343,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n /START \n /SINGLE \n /REGISTER [USER/ALL]\n /UNREGISTER [USER/ALL]", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n /START \n /SINGLE \n /TASK \n /REGISTER [USER/ALL]\n /UNREGISTER [USER/ALL]", MB_TITLE, MB_OK); return 1; } diff --git a/vendor/git-prompt.sh b/vendor/git-prompt.sh index 81aedb0..135e994 100644 --- a/vendor/git-prompt.sh +++ b/vendor/git-prompt.sh @@ -1,22 +1,39 @@ -PS1='\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]' # set window title -PS1="$PS1"'\[\033[32m\]' # change to green -PS1="$PS1"'\u@\h ' # user@host -PS1="$PS1"'\[\033[33m\]' # change to brownish yellow -PS1="$PS1"'\w' # current working directory -if test -z "$WINELOADERNOEXEC" +if test -f /etc/profile.d/git-sdk.sh then - GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)" - COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}" - COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}" - COMPLETION_PATH="$COMPLETION_PATH/share/git/completion" - if test -f "$COMPLETION_PATH/git-prompt.sh" - then - . "$COMPLETION_PATH/git-completion.bash" - . "$COMPLETION_PATH/git-prompt.sh" - PS1="$PS1"'\[\033[36m\]' # change color to cyan - PS1="$PS1"'`__git_ps1`' # bash function - fi + TITLEPREFIX=SDK-${MSYSTEM#MINGW} +else + TITLEPREFIX=$MSYSTEM fi -PS1="$PS1"'\[\033[0m\]' # change color -PS1="$PS1"'\n' # new line -PS1="$PS1"'λ ' # prompt: always λ + +if test -f ~/.config/git/git-prompt.sh +then + . ~/.config/git/git-prompt.sh +else + PS1='\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]' # set window title + # PS1="$PS1"'\n' # new line + PS1="$PS1"'\[\033[32m\]' # change to green + PS1="$PS1"'\u@\h ' # user@host + # PS1="$PS1"'\[\033[35m\]' # change to purple + # PS1="$PS1"'$MSYSTEM ' # show MSYSTEM + PS1="$PS1"'\[\033[33m\]' # change to brownish yellow + PS1="$PS1"'\w' # current working directory + if test -z "$WINELOADERNOEXEC" + then + GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)" + COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}" + COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}" + COMPLETION_PATH="$COMPLETION_PATH/share/git/completion" + if test -f "$COMPLETION_PATH/git-prompt.sh" + then + . "$COMPLETION_PATH/git-completion.bash" + . "$COMPLETION_PATH/git-prompt.sh" + PS1="$PS1"'\[\033[36m\]' # change color to cyan + PS1="$PS1"'`__git_ps1`' # bash function + fi + fi + PS1="$PS1"'\[\033[0m\]' # change color + PS1="$PS1"'\n' # new line + PS1="$PS1"'λ ' # prompt: always λ +fi + +MSYS2_PS1="$PS1" # for detection by MSYS2 SDK's bash.basrc diff --git a/vendor/init.bat b/vendor/init.bat index 1fefa10..ef54dfe 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -173,7 +173,14 @@ if exist "%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 :: uncomment this to have the ssh agent load when cmder starts echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd" + echo. + echo :: uncomment this next two lines to use pageant as the ssh authentication agent + echo :: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock + echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-pageant.cmd" + echo. + echo :: you can add your plugins to the cmder path like so echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%" echo. ) > "%CMDER_ROOT%\config\user-profile.cmd" diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index fd94530..98cc3c0 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -21,10 +21,14 @@ if (! $ENV:CMDER_ROOT ) { # Remove trailing '\' $ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\")) +# do not load bundled psget if a module installer is already available +# -> recent PowerShell versions include PowerShellGet out of the box +$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue | Out-Null) + # Add Cmder modules directory to the autoload path. $CmderModulePath = Join-path $PSScriptRoot "psmodules/" -if( -not $env:PSModulePath.Contains($CmderModulePath) ){ +if(-not $moduleInstallerAvailable -and -not $env:PSModulePath.Contains($CmderModulePath) ){ $env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;") } diff --git a/vendor/sources.json b/vendor/sources.json index 124321c..7a5e3e8 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.13.1.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.13.1.windows.1/PortableGit-2.13.1-32-bit.7z.exe" + "version": "v2.13.3.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.13.3.windows.1/PortableGit-2.13.3-32-bit.7z.exe" }, { "name": "clink", @@ -11,8 +11,8 @@ }, { "name": "conemu-maximus5", - "version": "170605", - "url": "https://github.com/Maximus5/ConEmu/releases/download/v17.06.05/ConEmuPack.170605.7z" + "version": "170622", + "url": "https://github.com/Maximus5/ConEmu/releases/download/v17.06.22/ConEmuPack.170622.7z" }, { "name": "clink-completions",