mirror of
https://github.com/cmderdev/cmder.git
synced 2025-01-11 08:49:08 +08:00
Merge branch 'master' of https://github.com/cmderdev/cmder
This commit is contained in:
commit
711c436f04
59
.github/issue_template.md
vendored
59
.github/issue_template.md
vendored
@ -10,16 +10,18 @@
|
|||||||
|
|
||||||
• Searched for existing issues (including the **closed** ones)
|
• Searched for existing issues (including the **closed** ones)
|
||||||
for the similar problems here:
|
for the similar problems here:
|
||||||
|
|
||||||
https://github.com/cmderdev/cmder/issues?q=is:issue
|
https://github.com/cmderdev/cmder/issues?q=is:issue
|
||||||
|
|
||||||
• Read the README.md and the Wiki:
|
• Read both the README.md and the Wiki:
|
||||||
|
|
||||||
- https://github.com/cmderdev/cmder/blob/master/README.md
|
- https://github.com/cmderdev/cmder/blob/master/README.md
|
||||||
- https://github.com/cmderdev/cmder/wiki
|
- https://github.com/cmderdev/cmder/wiki
|
||||||
|
|
||||||
(What you may be asking here could already be explained there!)
|
(What you may be asking here could already be explained there!)
|
||||||
|
|
||||||
• Please understand that Cmder by default uses ConEmu as the
|
• Please understand that Cmder uses ConEmu as the default
|
||||||
underlying Terminal Emulator. If your issue is regarding
|
underlying Terminal Emulator. If your issue is regarding
|
||||||
the **Terminal Emulator**, please visit the ConEmu issues page:
|
the **Terminal Emulator**, please visit the ConEmu issues page:
|
||||||
|
|
||||||
https://github.com/Maximus5/ConEmu/issues?q=is:issue
|
https://github.com/Maximus5/ConEmu/issues?q=is:issue
|
||||||
@ -31,9 +33,10 @@
|
|||||||
|
|
||||||
more info: https://conemu.github.io/en/ThirdPartyProblems.html
|
more info: https://conemu.github.io/en/ThirdPartyProblems.html
|
||||||
|
|
||||||
• If you are asking for guides on how to integrate Cmder into
|
• If you would like to ask for guides on how to integrate Cmder with
|
||||||
your favorite IDE of choice, or how to perform an specific
|
your favorite IDE of choice, or how to perform a specific task
|
||||||
task with Cmder, make sure you visit our label section first!
|
with Cmder, make sure you visit our label section first.
|
||||||
|
|
||||||
You may already have an answer under the Guides or Questions section.
|
You may already have an answer under the Guides or Questions section.
|
||||||
|
|
||||||
For a list of labels, visit:
|
For a list of labels, visit:
|
||||||
@ -41,24 +44,46 @@
|
|||||||
|
|
||||||
(Be sure to also check “Closed” issues in the labels section!)
|
(Be sure to also check “Closed” issues in the labels section!)
|
||||||
|
|
||||||
• If the issue is regarding the other upstream technologies that
|
• If you have a request to provide auto-complete support for a new tool,
|
||||||
Cmder uses (e.g. Clink, Git, etc), please make sure that the
|
please post your request here:
|
||||||
bug you are reporting only applies when they are used in
|
|
||||||
combination with Cmder. If the bug applies when the mentioned
|
https://github.com/vladimir-kotikov/clink-completions/issues
|
||||||
tools are NOT used within Cmder, there's a good chance that
|
|
||||||
you should open the bug at the corresponding repo instead.
|
• If you are having an issue with any of the **upstream technologies**
|
||||||
|
that are used by Cmder, please make sure that the issue is reproducible
|
||||||
|
_only_ when used in combination with Cmder.
|
||||||
|
|
||||||
|
We may not directly address the issues related to the following tools:
|
||||||
|
- Clink, the default shell in Cmder
|
||||||
|
- ConEmu, the terminal emulator
|
||||||
|
- Git/MinGW, which also provide *NIX tools
|
||||||
|
- clink-completions, which provide autocompletion
|
||||||
|
|
||||||
|
The issues related to upstream technologies are labeled as 👆 [name].
|
||||||
|
|
||||||
|
We'll try our best to help you -- but we recommend creating an issue
|
||||||
|
specifically at each of the corresponding repositories for the best
|
||||||
|
result.
|
||||||
|
|
||||||
|
► Try to reproduce the bug you're reporting, on a stand-alone edition
|
||||||
|
of each tool, without using Cmder. If the bug applies when the
|
||||||
|
mentioned tools are NOT used within Cmder, there's a good chance that
|
||||||
|
you should open the bug at the corresponding repo instead.
|
||||||
|
|
||||||
|
• Lastly, have a look at official documentation for Cmder over
|
||||||
|
our website, and our wiki.
|
||||||
|
|
||||||
Read more on about Cmder on ConEmu docs:
|
Read more on about Cmder on ConEmu docs:
|
||||||
https://conemu.github.io/en/cmder.html
|
https://conemu.github.io/en/cmder.html
|
||||||
|
|
||||||
|
|
||||||
Thank you for making sure you are opening a new valid issue!
|
Thank you for making sure you are opening a new valid issue! ♥
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Some tips on how to write a better report:
|
Some tips on how to write a better report:
|
||||||
- Put an `x` into all the boxes [ ] relevant to your issue (example: [x]).
|
- Put an `x` into all the boxes [ ] relevant to your issue (correct example: [x] -- not like this: [ x] or [x ]).
|
||||||
- Use the *Preview* tab to see how your issue will actually look like, before sending it.
|
- Use the *Preview* tab to see how your issue will actually look like, before sending it.
|
||||||
- Make sure the description is worded well enough to be understood, and with as much context and examples as possible.
|
- Make sure the description is worded well enough to be understood, and with as much context and examples as possible.
|
||||||
- Post a screenshot or the command the triggered the problem, if applicable.
|
- Post a screenshot or the command the triggered the problem, if applicable.
|
||||||
@ -66,6 +91,7 @@
|
|||||||
Help us reproduce the issue by explaining what went wrong, and what did you expect to happen.
|
Help us reproduce the issue by explaining what went wrong, and what did you expect to happen.
|
||||||
- Please keep the ticket language to English only here.
|
- Please keep the ticket language to English only here.
|
||||||
We can't process your issue if it's written in Russian or Chinese as we can't understand them.
|
We can't process your issue if it's written in Russian or Chinese as we can't understand them.
|
||||||
|
- You can find the version of Cmder.exe and ConEmu.exe binaries using Right Click → Properties → Details menu.
|
||||||
- ⚠ Read the following page to avoid posting a bad issue: https://conemu.github.io/en/BadIssue.html
|
- ⚠ Read the following page to avoid posting a bad issue: https://conemu.github.io/en/BadIssue.html
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -74,5 +100,10 @@
|
|||||||
- [ ] Feature request (request for new functionality)
|
- [ ] Feature request (request for new functionality)
|
||||||
- [ ] Question
|
- [ ] Question
|
||||||
|
|
||||||
|
### Version Information
|
||||||
|
<!-- Please write your Cmder and ConEmu version here -->
|
||||||
|
|
||||||
|
<!-- If applicable, write down your Windows edition too (e.g. Windows 10 Pro 1809) -->
|
||||||
|
|
||||||
### Description of the issue
|
### Description of the issue
|
||||||
<!-- Provide a clear, simple description of your issue here -->
|
<!-- Provide a clear, simple description of your issue here -->
|
||||||
|
18
.github/stale.yml
vendored
Normal file
18
.github/stale.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Number of days of inactivity before an issue becomes stale
|
||||||
|
daysUntilStale: 30
|
||||||
|
# Number of days of inactivity before a stale issue is closed
|
||||||
|
daysUntilClose: 7
|
||||||
|
# Issues with these labels will never be considered stale
|
||||||
|
exemptLabels:
|
||||||
|
- "📌 Pinned"
|
||||||
|
# Label to use when marking an issue as stale
|
||||||
|
staleLabel: "👀 Awaiting Response"
|
||||||
|
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||||
|
markComment: >
|
||||||
|
This issue has been automatically marked as stale because it has not had
|
||||||
|
recent activity. It will be closed in a week if no further activity occurs.
|
||||||
|
Thank you for your contribution.
|
||||||
|
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||||
|
closeComment: >
|
||||||
|
This issue has been automatically closed due to it not having any
|
||||||
|
activity since it was marked as stale. Thank you for your contribution.
|
19
CHANGELOG.md
19
CHANGELOG.md
@ -2,8 +2,17 @@
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
* Question issue: [#2094](https://github.com/cmderdev/cmder/issues/2094)
|
||||||
|
* Pull Request : [#2096](https://github.com/cmderdev/cmder/pull/2096)
|
||||||
|
* New argument created to ConEmu forwarding arguments.
|
||||||
|
* Syntax: `/x [ConEmu extras arguments]`
|
||||||
|
* e.g.: `Cmder.exe /x "-min -tsa"`
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
|
* Pull Request: [#2106](https://github.com/cmderdev/cmder/pull/2106)
|
||||||
|
* Portable Git requires running `post-install.bat` which deletes itself when done. This was not happening.
|
||||||
|
* Resolves [#2105](https://github.com/cmderdev/cmder/issues/2105)
|
||||||
* Pull Request: [#2002](https://github.com/cmderdev/cmder/pull/2002)
|
* Pull Request: [#2002](https://github.com/cmderdev/cmder/pull/2002)
|
||||||
* Updated the HG prompt code to use the '-ib' option to 'hg id' so the branch name is always available, regardless of the state of the working copy
|
* Updated the HG prompt code to use the '-ib' option to 'hg id' so the branch name is always available, regardless of the state of the working copy
|
||||||
|
|
||||||
@ -14,6 +23,16 @@
|
|||||||
* Provide default settings for Clink that updates the history file in real time
|
* Provide default settings for Clink that updates the history file in real time
|
||||||
* Turn this on in existing Cmder using `clink set history_io 1`
|
* Turn this on in existing Cmder using `clink set history_io 1`
|
||||||
* Allow clink disable by setting CMDER_CLINK=0 before starting task
|
* Allow clink disable by setting CMDER_CLINK=0 before starting task
|
||||||
|
* Pull Request: [#2068](https://github.com/cmderdev/cmder/pull/2068)
|
||||||
|
* Print Index in History Command Output.
|
||||||
|
* Sets default `history_expand_mode = 3` in initial Clink Settings.
|
||||||
|
|
||||||
|
### Adds
|
||||||
|
|
||||||
|
* Pull Request: [#2072](https://github.com/cmderdev/cmder/pull/2072)
|
||||||
|
* New alias create [alias] [alias command] syntax
|
||||||
|
* Based on [#1750](https://github.com/cmderdev/cmder/pull/1750)
|
||||||
|
* Syntax: `alias create [alias] [alias command]`
|
||||||
|
|
||||||
## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22)
|
## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22)
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can
|
|||||||
| `/SINGLE` | Start Cmder in single mode. |
|
| `/SINGLE` | Start Cmder in single mode. |
|
||||||
| `/START [start_path]` | Folder path to start in. |
|
| `/START [start_path]` | Folder path to start in. |
|
||||||
| `/TASK [task_name]` | Task to start after launch. |
|
| `/TASK [task_name]` | Task to start after launch. |
|
||||||
|
| `/X [ConEmu extras pars]` | Forwads parameters to ConEmu |
|
||||||
|
|
||||||
## Context Menu Integration
|
## Context Menu Integration
|
||||||
|
|
||||||
@ -146,6 +147,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/
|
|||||||
| `/c [user cmder root]` | Enables user bin and config folders for 'Cmder as admin' sessions due to non-shared environment. | not set |
|
| `/c [user cmder root]` | Enables user bin and config folders for 'Cmder as admin' sessions due to non-shared environment. | not set |
|
||||||
| `/d` | Enables debug output. | not set |
|
| `/d` | Enables debug output. | not set |
|
||||||
| `/f` | Enables Cmder Fast Init Mode. This disables some features, see pull request [#1492](https://github.com/cmderdev/cmder/pull/1942) for more details. | not set |
|
| `/f` | Enables Cmder Fast Init Mode. This disables some features, see pull request [#1492](https://github.com/cmderdev/cmder/pull/1942) for more details. | not set |
|
||||||
|
| `/t` | Enables Cmder Timed Init Mode. This displays the time taken run init scripts | not set |
|
||||||
| `/git_install_root [file path]` | User specified Git installation root path. | `%CMDER_ROOT%\vendor\Git-for-Windows` |
|
| `/git_install_root [file path]` | User specified Git installation root path. | `%CMDER_ROOT%\vendor\Git-for-Windows` |
|
||||||
| `/home [home folder]` | User specified folder path to set `%HOME%` environment variable. | `%userprofile%` |
|
| `/home [home folder]` | User specified folder path to set `%HOME%` environment variable. | `%userprofile%` |
|
||||||
| `/max_depth [1-5]` | Define max recurse depth when adding to the path for `%cmder_root%\bin` and `%cmder_user_bin%` | 1 |
|
| `/max_depth [1-5]` | Define max recurse depth when adding to the path for `%cmder_root%\bin` and `%cmder_user_bin%` | 1 |
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#define MB_TITLE L"Cmder Launcher"
|
#define MB_TITLE L"Cmder Launcher"
|
||||||
#define SHELL_MENU_REGISTRY_PATH_BACKGROUND L"Directory\\Background\\shell\\Cmder"
|
#define SHELL_MENU_REGISTRY_PATH_BACKGROUND L"Directory\\Background\\shell\\Cmder"
|
||||||
#define SHELL_MENU_REGISTRY_PATH_LISTITEM L"Directory\\shell\\Cmder"
|
#define SHELL_MENU_REGISTRY_PATH_LISTITEM L"Directory\\shell\\Cmder"
|
||||||
|
#define SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND L"Drive\\Background\\shell\\Cmder"
|
||||||
|
#define SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM L"Drive\\shell\\Cmder"
|
||||||
|
|
||||||
#define streqi(a, b) (_wcsicmp((a), (b)) == 0)
|
#define streqi(a, b) (_wcsicmp((a), (b)) == 0)
|
||||||
|
|
||||||
@ -69,7 +71,7 @@ bool FileExists(const wchar_t * filePath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true)
|
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"")
|
||||||
{
|
{
|
||||||
#if USE_TASKBAR_API
|
#if USE_TASKBAR_API
|
||||||
wchar_t appId[MAX_PATH] = { 0 };
|
wchar_t appId[MAX_PATH] = { 0 };
|
||||||
@ -96,6 +98,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
|
|
||||||
std::wstring cmderStart = path;
|
std::wstring cmderStart = path;
|
||||||
std::wstring cmderTask = taskName;
|
std::wstring cmderTask = taskName;
|
||||||
|
std::wstring cmderConEmuArgs = conemu_args;
|
||||||
|
|
||||||
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
|
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
|
||||||
userConfigDirPath[cfgRoot.length()] = 0;
|
userConfigDirPath[cfgRoot.length()] = 0;
|
||||||
@ -389,6 +392,11 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
|
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!streqi(cmderConEmuArgs.c_str(), L""))
|
||||||
|
{
|
||||||
|
swprintf_s(args, L"%s %s", args, cmderConEmuArgs.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
|
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
|
||||||
if (wcscmp(userConfigDirPath, configDirPath) != 0)
|
if (wcscmp(userConfigDirPath, configDirPath) != 0)
|
||||||
{
|
{
|
||||||
@ -525,6 +533,7 @@ struct cmderOptions
|
|||||||
std::wstring cmderStart = L"";
|
std::wstring cmderStart = L"";
|
||||||
std::wstring cmderTask = L"";
|
std::wstring cmderTask = L"";
|
||||||
std::wstring cmderRegScope = L"USER";
|
std::wstring cmderRegScope = L"USER";
|
||||||
|
std::wstring cmderConEmuArgs = L"";
|
||||||
bool cmderSingle = false;
|
bool cmderSingle = false;
|
||||||
bool cmderUserCfg = true;
|
bool cmderUserCfg = true;
|
||||||
bool registerApp = false;
|
bool registerApp = false;
|
||||||
@ -618,6 +627,12 @@ cmderOptions GetOption()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Used for passing arguments to conemu prog */
|
||||||
|
else if (_wcsicmp(L"/x", szArgList[i]) == 0)
|
||||||
|
{
|
||||||
|
cmderOptions.cmderConEmuArgs = szArgList[i + 1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
else if (cmderOptions.cmderStart == L"")
|
else if (cmderOptions.cmderStart == L"")
|
||||||
{
|
{
|
||||||
int len = wcslen(szArgList[i]);
|
int len = wcslen(szArgList[i]);
|
||||||
@ -633,13 +648,13 @@ cmderOptions GetOption()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
||||||
cmderOptions.error = true;
|
cmderOptions.error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
||||||
cmderOptions.error = true;
|
cmderOptions.error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -665,11 +680,15 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
{
|
{
|
||||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||||
|
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||||
|
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||||
}
|
}
|
||||||
else if (cmderOptions.unRegisterApp == true)
|
else if (cmderOptions.unRegisterApp == true)
|
||||||
{
|
{
|
||||||
UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
|
UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
|
||||||
UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM);
|
UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM);
|
||||||
|
UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND);
|
||||||
|
UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM);
|
||||||
}
|
}
|
||||||
else if (cmderOptions.error == true)
|
else if (cmderOptions.error == true)
|
||||||
{
|
{
|
||||||
@ -677,7 +696,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg);
|
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
102
vendor/bin/alias.cmd
vendored
102
vendor/bin/alias.cmd
vendored
@ -22,10 +22,15 @@ goto parseargument
|
|||||||
|
|
||||||
if /i "%currentarg%" equ "/f" (
|
if /i "%currentarg%" equ "/f" (
|
||||||
set ALIASES=%~2
|
set ALIASES=%~2
|
||||||
|
set _f=%~2
|
||||||
shift
|
shift
|
||||||
goto :do_shift
|
goto :do_shift
|
||||||
) else if /i "%currentarg%" == "/reload" (
|
) else if /i "%currentarg%" == "/reload" (
|
||||||
goto :p_reload
|
goto :p_reload
|
||||||
|
) else if "%currentarg%" equ "/H" (
|
||||||
|
goto :p_help
|
||||||
|
) else if "%currentarg%" equ "/h" (
|
||||||
|
goto :p_help
|
||||||
) else if "%currentarg%" equ "/?" (
|
) else if "%currentarg%" equ "/?" (
|
||||||
goto :p_help
|
goto :p_help
|
||||||
) else if /i "%currentarg%" equ "/d" (
|
) else if /i "%currentarg%" equ "/d" (
|
||||||
@ -43,11 +48,31 @@ goto parseargument
|
|||||||
doskey /macros | %WINDIR%\System32\findstr /b %currentarg%= && exit /b
|
doskey /macros | %WINDIR%\System32\findstr /b %currentarg%= && exit /b
|
||||||
echo insufficient parameters.
|
echo insufficient parameters.
|
||||||
goto :p_help
|
goto :p_help
|
||||||
) else (
|
) else if "%currentarg%" == "create" (
|
||||||
:: handle quotes within command definition, e.g. quoted long file names
|
|
||||||
set _x=%*
|
set _x=%*
|
||||||
|
|
||||||
|
set _x=!_x:^^=^^^^!
|
||||||
|
set action=create
|
||||||
|
if ["%_f%"] neq [""] (
|
||||||
|
for /f "tokens=1,2,3,* usebackq" %%G in (`echo !_x!`) do (
|
||||||
|
set _x=%%J
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
for /f "tokens=1,2,* usebackq" %%G in (`echo !_x!`) do (
|
||||||
|
set _x=%%H %%I
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
set _x=%*
|
||||||
|
if ["%_f%"] neq [""] (
|
||||||
|
set _x=!_x:^^=^^^^!
|
||||||
|
for /f "tokens=1,2,* usebackq" %%G in (`echo !_x!`) do (
|
||||||
|
set _x=%%I
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
rem #endregion parseargument
|
rem #endregion parseargument
|
||||||
|
|
||||||
if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" (
|
if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" (
|
||||||
@ -63,25 +88,33 @@ if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" (
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
:: validate alias
|
:: create with multiple parameters
|
||||||
for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do (
|
if [%action%] == [create] (
|
||||||
set alias_name=%%G
|
for /f "tokens=1,* usebackq" %%G in (`echo !_x!`) do (
|
||||||
set alias_value=%%H
|
set alias_name=%%G
|
||||||
|
set alias_value=%%H
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
:: validate alias
|
||||||
|
for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do (
|
||||||
|
set alias_name=%%G
|
||||||
|
set alias_value=%%H
|
||||||
|
)
|
||||||
|
|
||||||
|
:: leading quotes added while validating
|
||||||
|
set alias_name=!alias_name:~1!
|
||||||
|
|
||||||
|
:: trailing quotes added while validating
|
||||||
|
set alias_value=!alias_value:~0,-1!
|
||||||
)
|
)
|
||||||
|
|
||||||
:: leading quotes added while validating
|
|
||||||
set alias_name=%alias_name:~1%
|
|
||||||
|
|
||||||
:: trailing quotes added while validating
|
|
||||||
set alias_value=%alias_value:~0,-1%
|
|
||||||
|
|
||||||
::remove spaces
|
::remove spaces
|
||||||
set _temp=%alias_name: =%
|
set _temp=%alias_name: =%
|
||||||
|
|
||||||
if not ["%_temp%"] == ["%alias_name%"] (
|
if not ["%_temp%"] == ["%alias_name%"] (
|
||||||
echo Your alias name can not contain a space
|
echo Your alias name can not contain a space
|
||||||
endlocal
|
endlocal
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: replace already defined alias
|
:: replace already defined alias
|
||||||
@ -111,21 +144,36 @@ exit /b
|
|||||||
:p_help
|
:p_help
|
||||||
echo.Usage:
|
echo.Usage:
|
||||||
echo.
|
echo.
|
||||||
echo. alias [options] [alias=full command]
|
echo. alias [options] [alias=alias command]
|
||||||
|
echo.
|
||||||
|
echo OR
|
||||||
|
echo.
|
||||||
|
echo. alias create [alias] [alias command]
|
||||||
echo.
|
echo.
|
||||||
echo.Options:
|
echo.Options:
|
||||||
echo.
|
echo.
|
||||||
echo. /d [alias] Delete an [alias].
|
echo. Note: Options MUST precede the alias definition.
|
||||||
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
|
|
||||||
echo. Default: %cmder_root%\config\user_aliases.cmd
|
|
||||||
echo. /reload Reload the aliases file. Can be used with /f argument.
|
|
||||||
echo. Default: %cmder_root%\config\user_aliases.cmd
|
|
||||||
echo.
|
echo.
|
||||||
echo. If alias is called with no parameters, it will display the list of existing aliases.
|
echo. /d [alias] Delete an [alias].
|
||||||
|
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
|
||||||
|
echo. Default: %cmder_root%\config\user_aliases.cmd
|
||||||
|
echo. /reload Reload the aliases file. Can be used with /f argument.
|
||||||
|
echo. Default: %cmder_root%\config\user_aliases.cmd
|
||||||
echo.
|
echo.
|
||||||
echo. In the command, you can use the following notations:
|
echo. If alias is called with no parameters, it will display the list of existing
|
||||||
echo. $* allows the alias to assume all the parameters of the supplied command.
|
echo. aliases.
|
||||||
echo. $1-$9 Allows you to seperate parameter by number, much like %%1 in batch.
|
echo.
|
||||||
echo. $T is the command seperator, allowing you to string several commands together into one alias.
|
echo. In the alias command, you can use the following notations:
|
||||||
echo. For more information, read DOSKEY/?
|
echo.
|
||||||
|
echo. ^^^^^^^^%% - %% signs in env vars must be escaped if preserving the variable
|
||||||
|
echo. in he alias is desired. Variables in aliases surrounded by double
|
||||||
|
echo. quotes only require '^^%%' vs '^^^^^^^^%%'
|
||||||
|
echo. $* - allows the alias to assume all the parameters of the supplied
|
||||||
|
echo. command.
|
||||||
|
echo. $1-$9 - Allows you to seperate parameter by number, much like %%1 in
|
||||||
|
echo. batch.
|
||||||
|
echo. $T - Command seperator, allowing you to string several commands
|
||||||
|
echo. together into one alias.
|
||||||
|
echo.
|
||||||
|
echo. For more information, read DOSKEY /?
|
||||||
exit /b
|
exit /b
|
||||||
|
10
vendor/clink.lua
vendored
10
vendor/clink.lua
vendored
@ -189,12 +189,15 @@ end
|
|||||||
-- @return {false|mercurial branch name}
|
-- @return {false|mercurial branch name}
|
||||||
---
|
---
|
||||||
local function get_hg_branch()
|
local function get_hg_branch()
|
||||||
for line in io.popen("hg branch 2>nul"):lines() do
|
local file = io.popen("hg branch 2>nul")
|
||||||
|
for line in file:lines() do
|
||||||
local m = line:match("(.+)$")
|
local m = line:match("(.+)$")
|
||||||
if m then
|
if m then
|
||||||
|
file:close()
|
||||||
return m
|
return m
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
file:close()
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -204,12 +207,15 @@ end
|
|||||||
-- @return {false|svn branch name}
|
-- @return {false|svn branch name}
|
||||||
---
|
---
|
||||||
local function get_svn_branch(svn_dir)
|
local function get_svn_branch(svn_dir)
|
||||||
for line in io.popen("svn info 2>nul"):lines() do
|
local file = io.popen("svn info 2>nul")
|
||||||
|
for line in file:lines() do
|
||||||
local m = line:match("^Relative URL:")
|
local m = line:match("^Relative URL:")
|
||||||
if m then
|
if m then
|
||||||
|
file:close()
|
||||||
return line:sub(line:find("/")+1,line:len())
|
return line:sub(line:find("/")+1,line:len())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
file:close()
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
2
vendor/clink_settings.default
vendored
2
vendor/clink_settings.default
vendored
@ -87,7 +87,7 @@ history_io = 1
|
|||||||
# from the history. This can be enabled and disable by setting this value to 1
|
# from the history. This can be enabled and disable by setting this value to 1
|
||||||
# or 0. Values or 2, 3 or 4 will skip any ! character quoted in single, double,
|
# or 0. Values or 2, 3 or 4 will skip any ! character quoted in single, double,
|
||||||
# or both quotes respectively.
|
# or both quotes respectively.
|
||||||
history_expand_mode = 4
|
history_expand_mode = 3
|
||||||
|
|
||||||
# name: Support Windows' Ctrl-Alt substitute for AltGr
|
# name: Support Windows' Ctrl-Alt substitute for AltGr
|
||||||
# type: bool
|
# type: bool
|
||||||
|
12
vendor/init.bat
vendored
12
vendor/init.bat
vendored
@ -51,9 +51,7 @@ call "%cmder_root%\vendor\lib\lib_profile"
|
|||||||
) else if /i "%1"=="/v" (
|
) else if /i "%1"=="/v" (
|
||||||
set verbose_output=1
|
set verbose_output=1
|
||||||
) else if /i "%1"=="/d" (
|
) else if /i "%1"=="/d" (
|
||||||
if not defined VSCODE_CWD (
|
set debug_output=1
|
||||||
set debug_output=1
|
|
||||||
)
|
|
||||||
) else if /i "%1" == "/max_depth" (
|
) else if /i "%1" == "/max_depth" (
|
||||||
if "%~2" geq "1" if "%~2" leq "5" (
|
if "%~2" geq "1" if "%~2" leq "5" (
|
||||||
set "max_depth=%~2"
|
set "max_depth=%~2"
|
||||||
@ -235,7 +233,7 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do (
|
|||||||
:VENDORED_GIT
|
:VENDORED_GIT
|
||||||
if exist "%CMDER_ROOT%\vendor\git-for-windows" (
|
if exist "%CMDER_ROOT%\vendor\git-for-windows" (
|
||||||
set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
|
set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
|
||||||
%lib_console% debug_output "Using vendored Git from '!GIT_INSTALL_ROOT!..."
|
%lib_console% debug_output "Using vendored Git '!GIT_VERSION_VENDORED!' from '!GIT_INSTALL_ROOT!..."
|
||||||
goto :CONFIGURE_GIT
|
goto :CONFIGURE_GIT
|
||||||
) else (
|
) else (
|
||||||
goto :NO_GIT
|
goto :NO_GIT
|
||||||
@ -246,7 +244,7 @@ if exist "%CMDER_ROOT%\vendor\git-for-windows" (
|
|||||||
goto :CONFIGURE_GIT
|
goto :CONFIGURE_GIT
|
||||||
|
|
||||||
:FOUND_GIT
|
:FOUND_GIT
|
||||||
%lib_console% debug_output "Using found Git from '%GIT_INSTALL_ROOT%..."
|
%lib_console% debug_output "Using found Git '!GIT_VERSION_USER!' from '%GIT_INSTALL_ROOT%..."
|
||||||
goto :CONFIGURE_GIT
|
goto :CONFIGURE_GIT
|
||||||
|
|
||||||
:CONFIGURE_GIT
|
:CONFIGURE_GIT
|
||||||
@ -371,9 +369,9 @@ call "%user_aliases%"
|
|||||||
:: Basically we need to execute this post-install.bat because we are
|
:: Basically we need to execute this post-install.bat because we are
|
||||||
:: manually extracting the archive rather than executing the 7z sfx
|
:: manually extracting the archive rather than executing the 7z sfx
|
||||||
if exist "%GIT_INSTALL_ROOT%\post-install.bat" (
|
if exist "%GIT_INSTALL_ROOT%\post-install.bat" (
|
||||||
%lib_console% verbose_output "Running Git for Windows one time Post Install...."
|
echo Running Git for Windows one time Post Install....
|
||||||
pushd "%GIT_INSTALL_ROOT%\"
|
pushd "%GIT_INSTALL_ROOT%\"
|
||||||
"%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
|
"%GIT_INSTALL_ROOT%\git-cmd.exe" --no-needs-console --no-cd --command=post-install.bat
|
||||||
popd
|
popd
|
||||||
)
|
)
|
||||||
|
|
||||||
|
6
vendor/lib/lib_git.cmd
vendored
6
vendor/lib/lib_git.cmd
vendored
@ -88,8 +88,11 @@ exit /b
|
|||||||
::: [SCOPE]_BUILD <out> Scoped Build version.
|
::: [SCOPE]_BUILD <out> Scoped Build version.
|
||||||
:::-------------------------------------------------------------------------------
|
:::-------------------------------------------------------------------------------
|
||||||
|
|
||||||
setlocal enabledelayedexpansion
|
|
||||||
:: process a `x.x.x.xxxx.x` formatted string
|
:: process a `x.x.x.xxxx.x` formatted string
|
||||||
|
set "%~1_MAJOR="
|
||||||
|
set "%~1_MINOR="
|
||||||
|
set "%~1_PATCH="
|
||||||
|
set "%~1_BUILD="
|
||||||
%lib_console% debug_output :parse_version "ARGV[1]=%~1, ARGV[2]=%~2"
|
%lib_console% debug_output :parse_version "ARGV[1]=%~1, ARGV[2]=%~2"
|
||||||
for /F "tokens=1-3* delims=.,-" %%A in ("%2") do (
|
for /F "tokens=1-3* delims=.,-" %%A in ("%2") do (
|
||||||
set "%~1_MAJOR=%%A"
|
set "%~1_MAJOR=%%A"
|
||||||
@ -98,7 +101,6 @@ exit /b
|
|||||||
set "%~1_BUILD=%%D"
|
set "%~1_BUILD=%%D"
|
||||||
)
|
)
|
||||||
|
|
||||||
endlocal & set "%~1_MAJOR=!%~1_MAJOR!" & set "%~1_MINOR=!%~1_MINOR!" & set "%~1_PATCH=!%~1_PATCH!" & set "%~1_BUILD=!%~1_BUILD!"
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:validate_version
|
:validate_version
|
||||||
|
135
vendor/profile.ps1
vendored
135
vendor/profile.ps1
vendored
@ -25,9 +25,9 @@ if (! $ENV:CMDER_ROOT ) {
|
|||||||
# Remove trailing '\'
|
# Remove trailing '\'
|
||||||
$ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\"))
|
$ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\"))
|
||||||
|
|
||||||
# do not load bundled psget if a module installer is already available
|
# Do not load bundled psget if a module installer is already available
|
||||||
# -> recent PowerShell versions include PowerShellGet out of the box
|
# -> recent PowerShell versions include PowerShellGet out of the box
|
||||||
$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue | Out-Null)
|
$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue)
|
||||||
|
|
||||||
# Add Cmder modules directory to the autoload path.
|
# Add Cmder modules directory to the autoload path.
|
||||||
$CmderModulePath = Join-path $PSScriptRoot "psmodules/"
|
$CmderModulePath = Join-path $PSScriptRoot "psmodules/"
|
||||||
@ -36,26 +36,21 @@ if(-not $moduleInstallerAvailable -and -not $env:PSModulePath.Contains($CmderMod
|
|||||||
$env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;")
|
$env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;")
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
function Configure-Git($GIT_INSTALL_ROOT){
|
||||||
Get-command -Name "vim" -ErrorAction Stop >$null
|
$env:Path += $(";" + $GIT_INSTALL_ROOT + "\cmd")
|
||||||
} catch {
|
|
||||||
# # You could do this but it may be a little drastic and introduce a lot of
|
|
||||||
# # unix tool overlap with powershel unix like aliases
|
|
||||||
# $env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\usr\bin")
|
|
||||||
# set-alias -name "vi" -value "vim"
|
|
||||||
# # I think the below is safer.
|
|
||||||
|
|
||||||
new-alias -name "vim" -value $($ENV:CMDER_ROOT + "\vendor\git-for-windows\usr\bin\vim.exe")
|
# Add "$GIT_INSTALL_ROOT\usr\bin" to the path if exists and not done already
|
||||||
new-alias -name "vi" -value vim
|
$GIT_INSTALL_ROOT_ESC=$GIT_INSTALL_ROOT.replace('\','\\')
|
||||||
}
|
if ((test-path "$GIT_INSTALL_ROOT\usr\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\usr\\bin")) {
|
||||||
|
$env:path = "$env:path;$GIT_INSTALL_ROOT\usr\bin"
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
# Add "$GIT_INSTALL_ROOT\mingw[32|64]\bin" to the path if exists and not done already
|
||||||
# Check if git is on PATH, i.e. Git already installed on system
|
if ((test-path "$GIT_INSTALL_ROOT\mingw32\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw32\\bin")) {
|
||||||
Get-command -Name "git" -ErrorAction Stop >$null
|
$env:path = "$env:path;$GIT_INSTALL_ROOT\mingw32\bin"
|
||||||
} catch {
|
} elseif ((test-path "$GIT_INSTALL_ROOT\mingw64\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw64\\bin")) {
|
||||||
$env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\cmd")
|
$env:path = "$env:path;$GIT_INSTALL_ROOT\mingw64\bin"
|
||||||
# for bash.exe, which in the cmd version is found as <GIT>\usr\bin\bash.exe
|
}
|
||||||
$env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\bin")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$gitLoaded = $false
|
$gitLoaded = $false
|
||||||
@ -84,6 +79,19 @@ function checkGit($Path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
# Check if git is on PATH, i.e. Git already installed on system
|
||||||
|
Get-command -Name "git" -ErrorAction Stop >$null
|
||||||
|
} catch {
|
||||||
|
if (test-path "$env:CMDER_ROOT\vendor\git-for-windows") {
|
||||||
|
Configure-Git "$env:CMDER_ROOT\vendor\git-for-windows"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( Get-command -Name "vim" -ErrorAction silentlycontinue) {
|
||||||
|
new-alias -name "vi" -value vim
|
||||||
|
}
|
||||||
|
|
||||||
if (Get-Module PSReadline -ErrorAction "SilentlyContinue") {
|
if (Get-Module PSReadline -ErrorAction "SilentlyContinue") {
|
||||||
Set-PSReadlineOption -ExtraPromptLineCount 1
|
Set-PSReadlineOption -ExtraPromptLineCount 1
|
||||||
}
|
}
|
||||||
@ -91,36 +99,6 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") {
|
|||||||
# Enhance Path
|
# Enhance Path
|
||||||
$env:Path = "$Env:CMDER_ROOT\bin;$Env:CMDER_ROOT\vendor\bin;$env:Path;$Env:CMDER_ROOT"
|
$env:Path = "$Env:CMDER_ROOT\bin;$Env:CMDER_ROOT\vendor\bin;$env:Path;$Env:CMDER_ROOT"
|
||||||
|
|
||||||
#
|
|
||||||
# Prompt Section
|
|
||||||
# Users should modify their user_profile.ps1 as it will be safe from updates.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Pre assign the hooks so the first run of cmder gets a working prompt.
|
|
||||||
[ScriptBlock]$PrePrompt = {}
|
|
||||||
[ScriptBlock]$PostPrompt = {}
|
|
||||||
[ScriptBlock]$CmderPrompt = {
|
|
||||||
$Host.UI.RawUI.ForegroundColor = "White"
|
|
||||||
Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green
|
|
||||||
checkGit($pwd.ProviderPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
<#
|
|
||||||
This scriptblock runs every time the prompt is returned.
|
|
||||||
Explicitly use functions from MS namespace to protect from being overridden in the user session.
|
|
||||||
Custom prompt functions are loaded in as constants to get the same behaviour
|
|
||||||
#>
|
|
||||||
[ScriptBlock]$Prompt = {
|
|
||||||
$realLASTEXITCODE = $LASTEXITCODE
|
|
||||||
$host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf
|
|
||||||
PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
|
|
||||||
CmderPrompt
|
|
||||||
Microsoft.PowerShell.Utility\Write-Host "`nλ " -NoNewLine -ForegroundColor "DarkGray"
|
|
||||||
PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
|
|
||||||
$global:LASTEXITCODE = $realLASTEXITCODE
|
|
||||||
return " "
|
|
||||||
}
|
|
||||||
|
|
||||||
# Drop *.ps1 files into "$ENV:CMDER_ROOT\config\profile.d"
|
# Drop *.ps1 files into "$ENV:CMDER_ROOT\config\profile.d"
|
||||||
# to source them at startup.
|
# to source them at startup.
|
||||||
if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) {
|
if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) {
|
||||||
@ -185,11 +163,54 @@ if (! (Test-Path $CmderUserProfilePath) ) {
|
|||||||
Copy-Item "$env:CMDER_ROOT\vendor\user_profile.ps1.default" -Destination $CmderUserProfilePath
|
Copy-Item "$env:CMDER_ROOT\vendor\user_profile.ps1.default" -Destination $CmderUserProfilePath
|
||||||
}
|
}
|
||||||
|
|
||||||
# Once Created these code blocks cannot be overwritten
|
#
|
||||||
Set-Item -Path function:\PrePrompt -Value $PrePrompt -Options Constant
|
# Prompt Section
|
||||||
Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant
|
# Users should modify their user_profile.ps1 as it will be safe from updates.
|
||||||
Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant
|
#
|
||||||
|
|
||||||
# Functions can be made constant only at creation time
|
# Only set the prompt if it is currently set to the default
|
||||||
# ReadOnly at least requires `-force` to be overwritten
|
# This allows users to configure the prompt in their user_profile.ps1 or config\profile.d\*.ps1
|
||||||
Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly
|
if ( $(get-command prompt).Definition -match 'PS \$\(\$executionContext.SessionState.Path.CurrentLocation\)\$\(' -and `
|
||||||
|
$(get-command prompt).Definition -match '\(\$nestedPromptLevel \+ 1\)\) ";') {
|
||||||
|
# Pre assign the hooks so the first run of cmder gets a working prompt.
|
||||||
|
[ScriptBlock]$PrePrompt = {}
|
||||||
|
[ScriptBlock]$PostPrompt = {}
|
||||||
|
[ScriptBlock]$CmderPrompt = {
|
||||||
|
$Host.UI.RawUI.ForegroundColor = "White"
|
||||||
|
Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green
|
||||||
|
if (get-command git -erroraction silentlycontinue) {
|
||||||
|
checkGit($pwd.ProviderPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
This scriptblock runs every time the prompt is returned.
|
||||||
|
Explicitly use functions from MS namespace to protect from being overridden in the user session.
|
||||||
|
Custom prompt functions are loaded in as constants to get the same behaviour
|
||||||
|
#>
|
||||||
|
[ScriptBlock]$Prompt = {
|
||||||
|
$realLASTEXITCODE = $LASTEXITCODE
|
||||||
|
$host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf
|
||||||
|
PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
|
||||||
|
CmderPrompt
|
||||||
|
Microsoft.PowerShell.Utility\Write-Host "`nλ " -NoNewLine -ForegroundColor "DarkGray"
|
||||||
|
PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
|
||||||
|
$global:LASTEXITCODE = $realLASTEXITCODE
|
||||||
|
return " "
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Once Created these code blocks cannot be overwritten
|
||||||
|
# if (-not $(get-command PrePrompt).Options -match 'Constant') {Set-Item -Path function:\PrePrompt -Value $PrePrompt -Options Constant}
|
||||||
|
# if (-not $(get-command CmderPrompt).Options -match 'Constant') {Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant}
|
||||||
|
# if (-not $(get-command PostPrompt).Options -match 'Constant') {Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant}
|
||||||
|
|
||||||
|
Set-Item -Path function:\PrePrompt -Value $PrePrompt -Options Constant
|
||||||
|
Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant
|
||||||
|
Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant
|
||||||
|
|
||||||
|
# Functions can be made constant only at creation time
|
||||||
|
# ReadOnly at least requires `-force` to be overwritten
|
||||||
|
# if (!$(get-command Prompt).Options -match 'ReadOnly') {Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly}
|
||||||
|
Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly
|
||||||
|
}
|
||||||
|
2
vendor/user_aliases.cmd.default
vendored
2
vendor/user_aliases.cmd.default
vendored
@ -9,7 +9,7 @@ gl=git log --oneline --all --graph --decorate $*
|
|||||||
ls=ls --show-control-chars -F --color $*
|
ls=ls --show-control-chars -F --color $*
|
||||||
pwd=cd
|
pwd=cd
|
||||||
clear=cls
|
clear=cls
|
||||||
history=cat "%CMDER_ROOT%\config\.history"
|
history=cat -n "%CMDER_ROOT%\config\.history"
|
||||||
unalias=alias /d $1
|
unalias=alias /d $1
|
||||||
vi=vim $*
|
vi=vim $*
|
||||||
cmderr=cd /d "%CMDER_ROOT%"
|
cmderr=cd /d "%CMDER_ROOT%"
|
||||||
|
16
vendor/user_profile.ps1.default
vendored
16
vendor/user_profile.ps1.default
vendored
@ -23,3 +23,19 @@
|
|||||||
|
|
||||||
## <Continue to add your own>
|
## <Continue to add your own>
|
||||||
|
|
||||||
|
# # Delete default powershell aliases that conflict with bash commands
|
||||||
|
# if (get-command git) {
|
||||||
|
# del -force alias:cat
|
||||||
|
# del -force alias:clear
|
||||||
|
# del -force alias:cp
|
||||||
|
# del -force alias:diff
|
||||||
|
# del -force alias:echo
|
||||||
|
# del -force alias:kill
|
||||||
|
# del -force alias:ls
|
||||||
|
# del -force alias:mv
|
||||||
|
# del -force alias:ps
|
||||||
|
# del -force alias:pwd
|
||||||
|
# del -force alias:rm
|
||||||
|
# del -force alias:sleep
|
||||||
|
# del -force alias:tee
|
||||||
|
# }
|
||||||
|
Loading…
Reference in New Issue
Block a user