Commit Graph

54 Commits

Author SHA1 Message Date
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
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