Created
February 23, 2020 12:57
-
-
Save thluiz/4f62f22162c50195daa2924e69a32a7d to your computer and use it in GitHub Desktop.
Powershell basic profile and alias
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#$GitPromptSettings.DefaultPromptWriteStatusFirst = $true | |
#$GitPromptSettings.DefaultPromptBeforeSuffix.Text = '`n' | |
#$GitPromptSettings.DefaultPromptEnableTiming = $true | |
#$GitPromptSettings.DefaultPromptPrefix = "" | |
New-Alias -Name vi -Value 'C:\Program Files (x86)\vim\vim80\vim.exe' | |
New-Alias -Name vim -Value 'C:\Program Files (x86)\vim\vim80\vim.exe' | |
# Include this if you like a vim command line experience | |
# Set-PSReadlineOption -EditMode vi -BellStyle None | |
############### SHORTCUTS ############ | |
function clone($target, | |
[Parameter(Mandatory=$false)]$folder = '') { | |
Import-Module posh-git | |
Import-Module oh-my-posh | |
Set-Location "C:\Git" | |
invoke-expression "git clone $target $folder" | |
Set-Location "C:\Git\$($folder)" | |
} | |
function gg { | |
Import-Module posh-git | |
Import-Module oh-my-posh | |
Set-Location "C:\Git" | |
} | |
function sam_server { | |
$env:LOAD_ENV="true" | |
Set-Location "C:\Git\sam-apinode" | |
invoke-expression "nodemon server.js --config .\nodemon.config.json" | |
} | |
function node_server { | |
$env:LOAD_ENV="true" | |
invoke-expression "nodemon server.js --config .\nodemon.config.json" | |
} | |
function sam_web { | |
$env:LOAD_ENV="true" | |
Set-Location "C:\Git\sam-apex" | |
invoke-expression "ng serve" | |
} | |
function cdd { Set-Location "~\Desktop" } | |
function pg { | |
invoke-expression "ping google.com /t" | |
} | |
function hosts { | |
invoke-expression 'notepad C:\windows\System32\drivers\etc\hosts' | |
} | |
############### GIT ############ | |
function paz() { | |
<# | |
.SYNOPSIS | |
Publica o branche master do diretório git atual na azure | |
#> | |
invoke-expression "git push azure master" | |
} | |
function g_c($a) { | |
invoke-expression "git add . -A" | |
invoke-expression "git commit -m '$a' " | |
} | |
function g_b($a) { | |
invoke-expression "git branch $a " | |
} | |
function g_ck($a) { | |
invoke-expression "git checkout $a " | |
} | |
function g_ckt($remote, $branch) { | |
invoke-expression "git checkout -b $branch --track $remote/$branch" | |
} | |
function g_m($a) { | |
invoke-expression "git merge $a " | |
} | |
function ph() { | |
invoke-expression "git push heroku master" | |
} | |
function pch($a) { | |
invoke-expression "git add . -A" | |
invoke-expression "git commit -m '$a' " | |
invoke-expression "git push heroku master" | |
} | |
function g_p($a) { | |
<# | |
.SYNOPSIS | |
Envia o branche $a no remote origin | |
#> | |
invoke-expression "git pull" | |
invoke-expression "git push -u origin $a" | |
} | |
function g_pl($a) { | |
<# | |
.SYNOPSIS | |
Puxa o branche $a do remote origin | |
#> | |
invoke-expression "git pull origin $a" | |
} | |
function g_ri($commits) { | |
<# | |
.SYNOPSIS | |
faz o rebase interativo com a quantidade $commits | |
#> | |
invoke-expression "git rebase -i HEAD~$commits" | |
} | |
function GenerateSymLink ($target, $linkPath) { | |
New-Item -Path $linkPath -ItemType SymbolicLink -Value $target | |
} | |
function GenerateStagingConfig() { | |
$directories = @("C:\staging-wcf") | |
foreach($dir in $directories) { | |
$config = "C:\Git\BTCorretora\Configuracoes" | |
$link = "$($dir)\config" | |
$linkExists = Test-Path $link | |
If ( $linkExists ) { (Get-Item $link).Delete() } | |
New-Item -Path $link -ItemType SymbolicLink -Value $config | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment