Commit Graph

79 Commits

Author SHA1 Message Date
David Refoua
9d76f99dcf
closes #2756 2022-10-16 00:44:58 +03:30
David Refoua
8d4afb0570
fix problem with #2756 2022-10-16 00:02:38 +03:30
David Refoua
7f682653e4
consistency with powershell conventions;
* use "PS" instead of no-width "$([char]0x200B)" character in prompt (credit @skycommand)

* fixes additional space after the lambada and before the path

* display "PS" before path to distinguish between PowerShell and CMD
2022-10-15 12:32:52 +03:30
dgames
357e51acd1 spelling fixes 2022-01-15 11:00:58 -05:00
dgames
004535e0bc remove -all 2021-11-21 13:40:53 -05:00
Dax T Games
9f065a63e8
Ps1 git discovery (#2438)
* Fix start errors in path with ()

* Fix start errors in path with ()

* Fix start errors in path with ()

* Fix start errors in path with ()

* remove quotes from debug_output messages

* remove quotes from debug_output messages

* remove quotes from debug_output messages

* discovery newer git version

* new git path config for powershell

* xxx

* add isGitShim

* fix no git found in path

* debug

* revert not ps1 changes

* cleanup

* final

* spacing

* fixes

* cleanup

* cleanup

* timer for Powershell

* fixes

* fixes for git path settings

* grab vendor/bin/alias.cmd from master

Co-authored-by: Dax T. Games <dtgaes@kinggeek.org>
Co-authored-by: dgames <dgames@dtg.local>
2021-11-16 14:22:17 +00:00
Dax T Games
937874f03c
Revert "Revert "Update profile.ps1"" 2020-08-13 07:29:24 -04:00
Dax T Games
829a65f552
Revert "Update profile.ps1" 2020-08-13 07:08:20 -04:00
mcnubblet
3f6aa3b348 Update profile.ps1
Set utf-8 BOM in profile.ps1 to fix incorrect prompt display in PowerShell
2020-08-13 14:05:49 +10:00
Dax T. Games
c332ab1a34 Fix bug introduced in 1.3.15 2020-07-01 16:24:36 -04:00
Dax T. Games
44bc089ee4 move lambda to cmder prompt method for easier user change 2019-11-03 14:14:47 -05:00
Dax T. Games
6ab4599a4d separate powershell functions from profile.ps1 2019-11-03 13:07:20 -05:00
Dax T. Games
661f59d0fb Fix #2191 profile.ps1: CheckGit does not export $gitLoaded 2019-11-03 12:36:28 -05:00
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