summaryrefslogtreecommitdiff
path: root/powershell/user_profile.ps1
blob: d0cbd49cce5a4a4d940df07ca9277a3c64422670 (plain)
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
#Prompt
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt star
Import-Module -Name Terminal-Icons
# Alias
Set-Alias vim nvim
Set-Alias ll ls
Set-Alias grep findstr
Set-Alias tig 'C:\Program Files\Git\usr\bin\tig.exe'
Set-Alias less 'C:\Program Files\Git\usr\bin\less.exe'
Set-Alias -Name lv -Value Love2D

## Git Alias
Set-Alias g git
Set-Alias -Name gdiff -Value GitDiff
Set-Alias -Name branch -Value GitCurrentBranch
Set-Alias -Name gg -Value GitGui
Set-Alias -Name gbs -Value GitSearchBranch
Set-Alias -Name push -Value GitPush

function GitDiff {
    $output = (git diff --stat) | Out-String
    if (!$output) {
        Write-Output "NONE"
    } else {
        Write-Output $output
    }
}

function GitCurrentBranch {
    $output = (git branch) | grep '*' | Out-String
    Write-Output $output
}

function GitGui {
    (git gui)
}

function GitSearchBranch {
    $output = (git branch) | grep $args[0] | Out-String
    Write-Output $output
}

function Love2D {
    (love . --console)
}

function GitPush{
    if(($args.Length -lt 2) -or ($args.Length -gt 2)) {
        Write-Output "Usage: push <origin> <branch>"
    } else {
        (git push -u $args[0] $args[1])
    }
}