-
Notifications
You must be signed in to change notification settings - Fork 154
/
aliases.ps1
78 lines (65 loc) · 2.6 KB
/
aliases.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Easier Navigation: .., ..., ...., ....., and ~
${function:~} = { Set-Location ~ }
# PoSh won't allow ${function:..} because of an invalid path error, so...
${function:Set-ParentLocation} = { Set-Location .. }; Set-Alias ".." Set-ParentLocation
${function:...} = { Set-Location ..\.. }
${function:....} = { Set-Location ..\..\.. }
${function:.....} = { Set-Location ..\..\..\.. }
${function:......} = { Set-Location ..\..\..\..\.. }
# Navigation Shortcuts
${function:drop} = { Set-Location ~\Documents\Dropbox }
${function:dt} = { Set-Location ~\Desktop }
${function:docs} = { Set-Location ~\Documents }
${function:dl} = { Set-Location ~\Downloads }
# Missing Bash aliases
Set-Alias time Measure-Command
# Correct PowerShell Aliases if tools are available (aliases win if set)
# WGet: Use `wget.exe` if available
if (Get-Command wget.exe -ErrorAction SilentlyContinue | Test-Path) {
rm alias:wget -ErrorAction SilentlyContinue
}
# Directory Listing: Use `ls.exe` if available
if (Get-Command ls.exe -ErrorAction SilentlyContinue | Test-Path) {
rm alias:ls -ErrorAction SilentlyContinue
# Set `ls` to call `ls.exe` and always use --color
${function:ls} = { ls.exe --color @args }
# List all files in long format
${function:l} = { ls -lF @args }
# List all files in long format, including hidden files
${function:la} = { ls -laF @args }
# List only directories
${function:lsd} = { Get-ChildItem -Directory -Force @args }
} else {
# List all files, including hidden files
${function:la} = { ls -Force @args }
# List only directories
${function:lsd} = { Get-ChildItem -Directory -Force @args }
}
# curl: Use `curl.exe` if available
if (Get-Command curl.exe -ErrorAction SilentlyContinue | Test-Path) {
rm alias:curl -ErrorAction SilentlyContinue
# Set `ls` to call `ls.exe` and always use --color
${function:curl} = { curl.exe @args }
# Gzip-enabled `curl`
${function:gurl} = { curl --compressed @args }
} else {
# Gzip-enabled `curl`
${function:gurl} = { curl -TransferEncoding GZip }
}
# Create a new directory and enter it
Set-Alias mkd CreateAndSet-Directory
# Determine size of a file or total size of a directory
Set-Alias fs Get-DiskUsage
# Empty the Recycle Bin on all drives
Set-Alias emptytrash Empty-RecycleBin
# Cleanup old files all drives
Set-Alias cleandisks Clean-Disks
# Reload the shell
Set-Alias reload Reload-Powershell
# http://xkcd.com/530/
Set-Alias mute Set-SoundMute
Set-Alias unmute Set-SoundUnmute
# Update installed Ruby Gems, NPM, and their installed packages.
Set-Alias update System-Update
# Set GVim as default vim
Set-Alias vim gvim