1
1
# #######################################################
2
- #
2
+ # Chris Pattersons Powershell Profile
3
3
# #######################################################
4
4
# Load any custom Powershell Snapins that we want
5
5
function LoadSnapin ($name )
@@ -10,25 +10,19 @@ function LoadSnapin($name)
10
10
Add-PSSnapin $name
11
11
}
12
12
}
13
+
13
14
14
15
# ####################################################
15
16
# Various helper globals
16
17
if (-not $global :home ) { $global :home = (resolve-path ~) }
17
18
18
19
$dl = " ~\Downloads" ;
19
- $dev = " C:\Development" ;
20
20
$programs = [System.Environment ]::GetFolderPath([System.Environment + SpecialFolder ]" ProgramFiles" );
21
21
$scripts = (split-path $profile ); # I keep my personal .PS1 files in the same folder as my $profile
22
22
$documents = [System.Environment ]::GetFolderPath(" Personal" )
23
23
$framework = Join-Path $Env: windir " Microsoft.NET\Framework"
24
24
$framework = Join-Path $framework ([Reflection.Assembly ]::GetExecutingAssembly().ImageRuntimeVersion)
25
25
26
- # ####################################################
27
- # Helper scripts we will want
28
- . (resolve-path $scripts \gitutils.ps1)
29
- . (resolve-path $scripts \svnutils.ps1)
30
- . (resolve-path $scripts \hgutils.ps1)
31
-
32
26
# #######################################################
33
27
# Helper Functions
34
28
function ff ([string ] $glob ) { get-childitem - recurse - filter $glob }
@@ -42,23 +36,29 @@ function strip-extension ([string] $filename) { [system.io.path]::getfilenamewit
42
36
function cd.. { cd .. }
43
37
function lsf { get-childitem | ? { $_.PSIsContainer -eq $false } }
44
38
function lsd { get-childitem | ? { $_.PSIsContainer -eq $true } }
45
- function ie { & ' C:\program files\Internet Explorer\iexplore.exe' $args }
46
- function firefox { & " C:\Program Files\Mozilla Firefox\firefox.exe" $args }
47
- function google { ie " http://www.google.com/search?q=$args " }
48
- function gitbash { & cmd.exe / c $env: userprofile + " \utils\git\bin\sh.exe" - login - i }
39
+ function ie { & ' C:\Program Files (x86)\Internet Explorer\iexplore.exe' $args }
40
+ function firefox { & " C:\Program Files (x86)\Mozilla Firefox\firefox.exe" $args }
41
+ function bing { ie " http://www.bing.com/search?q=$args " }
49
42
function prepend-path { $oldPath = get-content Env:\Path; $newPath = $args + " ;" + $oldPath ; set-content Env:\Path $newPath ; }
50
43
function append-path { $oldPath = get-content Env:\Path; $newPath = $oldPath + " ;" + $args ; set-content Env:\Path $newPath ; }
51
44
52
45
# #######################################################
53
46
# Environmental stuff I like...
47
+ # ####################################################
48
+ # Helper scripts we will want
49
+
50
+ New-PSDrive - Name Scripts - PSProvider FileSystem - Root $scripts
51
+ Get-ChildItem scripts:\Lib* .ps1 | % {
52
+ . $_
53
+ write-host " Loading library file:`t $ ( $_.name ) "
54
+ }
54
55
55
56
# Customize the path for PS shells
56
57
append- path (split-path $profile ) # I put my scripts in the same dir as my profile script
57
58
append- path ($env: userprofile + " \utils\bin" )
58
59
append- path ($env: userprofile + " \utils\sysinternals" )
59
- append- path ' C:\Program Files (x86)\GnuWin32\bin'
60
60
61
- # Tell UNIX utilities (particulary svn.exe) to use VIM for its editor
61
+ # Tell UNIX utilities (particulary svn.exe) to use Notepad2 for its editor
62
62
set-content Env:\VISUAL ' notepad2.exe' ;
63
63
64
64
# Aliases
@@ -121,13 +121,6 @@ function elevate-process
121
121
[System.Diagnostics.Process ]::Start($psi );
122
122
}
123
123
124
- function gvim {
125
- if ($args.Count -gt 0 ) {
126
- & gvim.exe -- remote- tab- silent " ${args} "
127
- } else {
128
- & gvim.exe
129
- }
130
- }
131
124
132
125
filter Format-Bytes {
133
126
$units = ' B ' , ' KiB' , ' MiB' , ' GiB' , ' TiB' ;
@@ -249,65 +242,10 @@ function prompt {
249
242
Write-Host (' ]' ) - nonewline - foregroundcolor Yellow
250
243
}
251
244
252
- if (Test-SvnWorkingDirectory ) {
253
- $info = get-SvnInfo
254
- $status = get-SvnStatus
255
-
256
- Write-Host ' svn:[' - nonewline - foregroundColor Yellow
257
- Write-Host (' +' + $status.added ) - nonewline - foregroundcolor Yellow
258
- Write-Host (' ~' + $status.modified ) - nonewline - foregroundcolor Yellow
259
- Write-Host (' -' + $status.deleted ) - nonewline - foregroundcolor Yellow
260
-
261
- if ($status.untracked -gt 0 ) {
262
- Write-Host (' !' ) - nonewline - foregroundcolor Red
263
- }
264
-
265
- Write-Host (' ]' ) - nonewline - foregroundcolor Yellow
266
-
267
- }
268
-
269
245
return " > "
270
246
}
271
247
272
- function old_prompt
273
- {
274
-
275
- $nextId = (get-history - count 1 ).Id + 1 ;
276
- $promptText = " [" + $nextId + " ]" ;
277
-
278
- $wi = [System.Security.Principal.WindowsIdentity ]::GetCurrent();
279
- $wp = new-object ' System.Security.Principal.WindowsPrincipal' $wi ;
280
248
281
- if ( $wp.IsInRole (" Administrators" ) -eq 1 )
282
- {
283
- $color = " Red" ;
284
- $title = " **ADMIN** - " + (get-location ).Path;
285
- }
286
- else
287
- {
288
- $color = " Green" ;
289
- $title = (get-location ).Path;
290
- }
291
-
292
- if (test-path .git) {
293
- $promptText = $promptText + " (git)"
294
- }
295
-
296
- if (test-path .svn) {
297
- $promptText = $promptText + " (svn)"
298
- }
299
-
300
- if (test-path env:RazzleToolPath) {
301
- $title = $title + " [Branch: `$ /$env: _BuildBranchPrefix$env: _BuildBranch ]"
302
- }
303
-
304
- $promptText = $promptText + " »"
305
-
306
- write-host $promptText - NoNewLine - ForegroundColor $color
307
- $host.UI.RawUI.WindowTitle = $title ;
308
-
309
- return " "
310
- }
311
249
312
250
# #######################################################
313
251
# Custom 'cd' command to maintain directory history
0 commit comments