Commit Graph

66 Commits

Author SHA1 Message Date
Greg Lucas
7f69f15637 Fix #2192: Set default prompt hooks before loading user profile 2019-10-22 11:17:13 -04:00
Dax T Games
19a2fd11e3 Clink Completions 0.3.4 (#2177)
* update Changelog, clink-completions 0.3.4, fix ps fg color

* Update CHANGELOG.md

* Update CHANGELOG.md
2019-09-28 02:21:47 +02:00
Dax T. Games
345562dbd0 Merge branch 'ps1_prompt' of https://github.com/daxgames/cmder into ps1_prompt 2019-03-31 16:48:10 -04:00
Dax T. Games
13de4924ca make powershell use of bash commands more bash like 2019-03-31 16:47:36 -04:00
Dax T. Games
081624d88e cleanup 2019-03-23 15:03:44 -04:00
Dax T. Games
98a64b71b2 Allow full ps1 prompt customization by 'config/*.ps1' scripts 2019-03-16 13:52:47 -04:00
Cody Ray Hoeft
0c9e0e2f8c Use default files for default user profiles 2018-12-13 12:13:17 -08:00
Dax T. Games
7203671fc9 fix powershell profile.d 2018-11-17 19:55:24 -05:00
Merlin
cb78f0486a Remove duplicate Install-Module detection
Block was inserted twice.
2018-11-03 02:15:03 +01:00
Dax T Games
3a11d45552 add diag helper scripts and adds to the path (#1918)
These scripts are to help us help our users by getting a relative picture of their environment that they can submit with an incident.
2018-11-02 14:00:40 +01:00
Dax T Games
49da3745bc Fix #1806 #1675 (#1870)
## Rename user-profile.* user_profile.* to resolve #1806, #1675

* This is a backward compatible fix and will automatically and silently rename users '%cmder_root%/config/user-profile.\*' to '%cmder_root%/config/user_profile.\*' and '[user_specified_config_root]/user-profile.\*' to '[user_specified_config_root]/user_profile.\*' if the sources exist.

  * Cmder.exe does this for cmd.exe sessions.
  * The init scripts for bash and Powershell handles it for these shells
2018-09-01 00:02:56 +02:00
Dmitri S. Guskov
34bb62409a
Update profile.ps1
Fixes Powershell 5.1 error when Windows Software Restriction Policy is enabled:

bin\vendor\profile.ps1 : Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.'  operator.
At line:1 char:1
+ . 'bin\vendor\conemu-maximus5\..\profi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [profile.ps1], NotSupportedException
    + FullyQualifiedErrorId : DotSourceNotSupported,profile.ps1
2018-08-29 14:38:59 +03:00
Dax T Games
27f51f48a4 Profile.ps1 (#1796)
* Fix GIT_INSTALL_ROOT again

* fix profile.ps1
2018-06-03 00:15:33 +02:00
Dax T. Games
65bf25f1d0 fix bash and powershell init scripts 2018-04-03 14:17:34 -04:00
Dax T Games
997e799138 New cmder.exe args and shared install capability (#1696)
@MartiUK: Squashing to avoid adding multiple "fixed" commits

* add args to init.bat

* adding args to cmder launcher

* reworked command line parsing and added a /C [path] arg for individual user config location

* removed unnecessary includes

* make shell init scripts work with CMDER_USER_CONFIG

* update tasks and readme.md

* fix git version check

* readme updates

* add register/unregister back in

* fixed git version again

* removed error if user defines user-aliases store file was not present an init.bat launch

* added enhance_path method to only update path if required

* added enhance_path method to only update path if required

* fixed a path prepend issue in enhance path

* init.bat with args is executed outside cmder/conemu sets cmder_root properly. Thanks @DRSDavidSoft

* fixed enhance path append issue

* implements recursive `/bin` path enhancing.

https://github.com/cmderdev/cmder/issues/1624

* added max depth

* changes command line arg to max_depth

* set max_depth default

* readme.md updates

* add back cmder /c [path] arg so it can be used with admin sessions since the env is not shared.

* readme.md updates

* fix /c setting of cmder_user_config

* changelog and readme

* remove bad arg

* fixed command line parsing and updated command line help on error

* Fixed ConEmu.xml file handling so it works again

* Added default user config root location if '/c' is specified and next arg is not another arg
2018-03-13 16:38:27 +01:00
David Driscoll
badb027c24 use /dir Switch instead of CMDER_START 2018-01-09 14:50:46 +01:00
Jack
7479d620b1
Merge pull request #1417 from gucong3000/patch-2
Compatible with Visual Studio Code (PowerShell) integrated terminal.
2017-10-31 21:09:23 +00:00
Pero Pejovic
68d9425c89 Avoid using aliases in profile.ps1
Aliases such as `ls` may have been overridden in the user's profile script and the resulting behavior may be different from `Get-ChildItem`. For example binding `ls` to GNU `ls.exe` generates an error if there are no matching files.
2017-10-28 14:18:09 +02:00
刘祺
7ca2f5503a Merge branch 'master' into patch-2
# Conflicts:
#	vendor/profile.ps1
2017-08-03 18:32:44 +08:00
Benjamin Staneck
8077c1a612 Merge pull request #1441 from pyranja/fix-psget-clobbering
Avoid clobbering Install-Module
2017-07-15 02:08:09 +02:00
Chrs Borckholder
815b99b98b Avoid clobbering Install-Module
If the Install-Module command is available, do not include the bundled
module path containing a deprecated version of PSGet. Recent powershell
versions include PowerShellGet as standard module installer.

Resolve #1318.
2017-07-14 12:06:48 +02:00
刘祺
a7237370e3 Compatible with Visual Studio Code (PowerShell) 2017-06-23 18:39:36 +08:00
Brian Dukes
7f4a4d34d6
Allow user-profile.ps1 and profile.d/*.ps1 files to override prompt
This defines the default prompt variables ($PrePrompt, $PostPrompt,
$CmderPrompt, and $Prompt) before running the custom scripts (user-profile.ps1
and profile.d/*.ps1), and then saves those prompt values after running the
custom scripts.  This gives the custom scripts and opportunity to override the
prompt code blocks.

This now opens the possibility for profile.d/*.ps1 scripts to affect the
prompt, and also allows both user-profile.ps1 and profile.d/*.ps1 scripts to
overwrite the $Prompt script block and overwrite the prompt behavior entirely.
2017-03-08 14:14:35 -06:00
Jackbennett
db909451c9 Version Check the Posh-Git module to allow module autoloading
Posh-Git before this release does not export `Write-VcsStatus` thus
powershell's autoloading cannot find the reqired module for the function.

note that `get-module -listAvailable` can return an array of multiple
versions.
2016-10-10 12:01:55 +01:00
Jackbennett
b349b19869 Describe why PS functions are called by namespace
As the prompt function is called all the time, specifically namespace the
cmldets it uses to avoid them being hijacked in the user session.
2016-10-10 10:30:01 +01:00
Jackbennett
010049a849 Set window title to current folder unless there's git information.
Unfortunately doesn't apply to conEmu's tab name.
2016-05-27 09:47:34 +01:00
Jackbennett
7a0a1adc02 Use checkGit to hold the git state. Import posh-git at the last minute.
Import-Git now finds if the module isn't installed at all and alerts the
user. But only when in a git folder.
2016-05-23 14:53:34 +01:00
Jackbennett
76b2ed510d If you start doing remote work you can fire off your own start-sshAgent command. 2016-05-23 14:51:55 +01:00
Jackbennett
31c8c620c7 Custom prompt hooks protected from later overwriting
Add a pre and post function hook around the Cmder prompt.
Specify the cmder prompt as a function that could be replaced by a user.
Write a friendly message when the user profile template is created.
Create the user profile with cmder prompt hooks ready to use.

It was concerning to run any function with a specific name every prompt
with no guarantee it remains what it was initally created as.

Core functions have been explicitly called from their
namespace like Microsoft.PowerShell.Utility\Write-Host to try and prevent
clobbering.

User supplied functions are passed in as script blocks, created as the
session runs the profile script. By creating them as constants these
function names cannot be declared again for the duration of the process.

Since the prompt function already exists by this time, set the readOnly
flag so to re-declare the prompt requires the use of -force.

It is hoped these changes limit what could be the risk of any script
redefining functions that are called automatically without user intent or
input.
2016-05-12 13:59:33 +01:00
Jan Schulz
1e7f15100f PS: also add cmd and bin version of git to the path
This ensures that the "normal" path entry (cmd) is first and bash is still reachable via the bin path.
2016-04-08 16:53:38 +02:00
Martin Kemp
05c113efee 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
2016-03-10 10:50:37 +00:00
Dax T. Games
8dbbb902d9 fixed vendor\profile.ps1 profile.d - added post popd 2016-03-02 18:04:25 -06:00
Dax T. Games
a959409c0f --amend 2016-02-25 18:22:43 -06:00
Dax T. Games
0a6b79b9ed Added profile.d like support for all supported shells 2016-02-25 08:01:16 -06:00
Gregory Pakosz
95bbb8edbb Fixed checkGit() in case of submodules
Since Git 1.7.8, submodules don't contain a .git/ folder anymore.
Instead, the submodule directory is populated with a .git text file
which contains a git-dir: /path/to/superproject/git_dir/modules/name.

See,
https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.8.txt#L109-L114
2016-02-10 16:33:01 +01:00
Jan Schulz
2c0c6ed416 Make "cmder here" work again
The new system works by setting "CMDER_START" if a cmder.exe gets a
startup path. The rest is then implemented in the profile.ps1 and init.bat.
The new system works as follows:

1.If a startup path is given, cmder.exe sets this as `CMDER_START` and the
  startup scripts change to that directory.
2.If the usere sets a `CMDER_START` environment variable and this is not
  overwritten by cmder.exe, this variable is taken as the startup
  directory by the startup scripts.
3.If not such path is give, the conemu startup dirs is the winner, as the
  startup scripts don't change anything.
2016-01-11 22:19:10 +01:00
Dax T. Games
9b25544c05 Fixed - Powershell vim/vim alias opening a new tab when editin a file 2015-11-24 10:58:58 -06:00
Dax T. Games
8566b6f6ca Added vi/vim aliases and fixed powershell startup errors 2015-11-23 19:10:22 -05:00
Martin Kemp
1af65edaec Merge pull request #702 from daxgames/msys_bash
Msys bash
2015-11-23 23:31:02 +00:00
Martin Kemp
6d215f58c6 Merge pull request #673 from DoCode/development
Enable the '/single' switch (#577)
2015-11-20 10:50:44 +00:00
Dax T. Games
7f43014b68 pulled in upstream development branch 2015-11-14 12:15:42 -06:00
Dax T. Games
cf15dcffc7 Added/enhanced bash with cmder.sh/user-cmder.sh, organized tasks menu
added personal files to .gitignore so they never get uploaded to the repo and added support for msys2 bash in the new git for windows

added autocreate of config/user-cmder.sh if iot does not exist and added it to the .gitignore

Added tasks: cmd::Cmder, cmd::Cmder as Admin, bash::bash, bash::bash as Admin, bash::mintty, bash::mintty as admin, powershell::powershell, powershell::powershell as Admin. Set default task to cmd::Cmder.  Cot rid of init.bat running before /bin/bash, fixes double exit requirement

Added running git for windows post-install.bat on first cmder launch

fixed file/path not found  errors when launching powershell as admin

fixed file/path not found errors when launching bash/mintty as admin

fixed PATH in vendor/cmder.sh

Added sourcing ~/.bashrc if it exists.

changed .gitignore to ignore anything with path of config/user-*

removed my personal files from .gitignore, left in config/user-*

Make sure $CMDER_ROOT does not have a trailing '/'

%CMDER_ROOT% does not have trailing '\'. allow user to specify a conemu.xml on the command line

Removed '\' from %CMDER_ROOT%
2015-11-14 12:07:56 -06:00
Benjamin Staneck
87bc4178e6 fix vim path in powershell profile 2015-11-12 15:18:21 +01:00
Alec Wenzowski
b018f2cc50 add bundled vim to path 2015-11-11 23:28:04 -05:00
Manuel Tanzer
a57c11e171 Enable the '/single' switch by using the registry as statemachine for the current location ('CMDER_START')
Fixed issue #577
2015-10-20 16:49:08 +02:00
Pireax
1d47a98329 lambda was encoded with UTF-8 without BOM, didn't show properly 2015-10-15 19:57:05 +02:00
Pireax
07180effac Fixed problem with Invoke-Expression 2015-10-15 19:56:38 +02:00
Jack Bennett
7ebfffc9da Remove incorrect charater at start of line. 2015-10-14 19:24:54 +01:00
Benjamin Staneck
5a1aa7e25b add overwrite notice to posh profile, too 2015-10-14 19:50:49 +02:00
Pireax
0ab9b74013 Add user startup file for powershell 2015-10-14 18:50:52 +02:00