Commit Graph

88 Commits

Author SHA1 Message Date
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
Benjamin Staneck
419c785db5 Merge pull request #575 from Bobo1239/enhance-path
Enhance Path in profile.ps1
2015-10-12 13:24:07 +02:00
Benjamin Staneck
3e06fcbf07 First step at converting msysgit support to git-for-windows support. 2015-08-23 20:09:06 +02:00
Boris Zhou
316a42b8f9 Enhance Path in profile.ps1 2015-08-03 16:06:41 +02:00
Bond
2a1a736ceb Remove depreciated Enable-GitColors
The function Enable-GitColors is depreciated in dahlbyk/posh-git@4e778e2480 and should be removed here as well.
2015-06-04 23:25:09 +01:00
Martin Kemp
29d1378d7a Add git to PATH (while in Cmder)
Add bundled git to PATH if we can't find git on PATH.
2015-05-19 15:47:06 +01:00
Martin Kemp
c15e29ecb3 $PSScriptRoot compatibility
$PSScriptRoot is not available on PS version 2 or below.

So we'll set it ourselves.
2015-05-19 15:44:32 +01:00
Martin Kemp
a18320c938 Improve warning text when posh-git is missing. 2015-05-17 22:13:23 +01:00
Jack Bennett
c466698d6b Only write VCS Status if we're in a git repo
In an effort to speed up the prompt we will only call write-vcsstatus if
there is a .git folder in the current or any parent path recursively.

As this function is called every new prompt line it needs to be as fast as
possible.
2015-03-25 12:29:10 +00:00
Jack Bennett
18fc5e37c7 Check that git can really be used as well as posh-git
Explicitly call `import posh-git` because it doesn't have a module
manifest thus powershell can't autoload it when using a cmdlet.

At present the cmder repo doesn't try to download posh-git so it might be
missing from the users session.
2015-03-25 12:22:07 +00:00
Martin Kemp
69eb956d65 Merge pull request #432 from Jackbennett/ps-revert-newline
Revert new line from commit dc834cc28f
2015-03-18 21:14:39 +00:00
Jack Bennett
dfa58acccc Revert new line from commit dc834cc28f
This matches how cmd looks in conemu for cmder and PS seems to add some
padding around command output so I really don't see what the extra new
line is doing.

Saving dat precious vertical space.
2015-03-18 15:47:01 +00:00
Jack Bennett
e811c60ab2 Leverage the Module Autoload path and save doing it ourselves.
This should be faster too as we won't automatically import all functions
to the session. Powershell now knows where to look before declaring they
don't exist.
2015-03-18 15:33:55 +00:00
Martin Kemp
021263d81c Merge pull request #273 from LeoColomb/master
Fixes small Powershell' loader issues
2015-03-18 10:33:58 +00:00
Léo Colombaro
dc834cc28f Fixes Powershell loader issues
* Fix modules order required
* Add newline before prompt
* Fix color name
2014-12-01 20:40:07 +01:00
Szymon Sito
c8193ea368 Lambda color in powershell was changed to DarkGray 2014-10-29 21:27:30 +01:00
Léo Colombaro
98350e14e8 Add custom loader for Powershell, improve its implementation in Cmder
Fixes #104, fixes #53, fixes #65 (my bad), related to #136, and should
fix #139
2014-09-17 09:55:15 +02:00