Skip to content

Instantly share code, notes, and snippets.

@syntaxlexx
Last active December 23, 2023 18:54
Show Gist options
  • Save syntaxlexx/01aa790a5567ccfa69890a123ead3f75 to your computer and use it in GitHub Desktop.
Save syntaxlexx/01aa790a5567ccfa69890a123ead3f75 to your computer and use it in GitHub Desktop.
Powershell Windows 10/11 for Devs - Powershell Aliases
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/powerlevel10k_modern.omp.json" | Invoke-Expression
# Make Powershell behave more like ZSH
# You can uncomment this line to view keybindings
# Get-PSReadlineKeyHandler | ? {$_.function -like '*hist*'}
# Documentation
# https://learn.microsoft.com/en-us/powershell/module/psreadline/about/about_psreadline_functions?view=powershell-7.4
Set-PSReadLineKeyHandler -Chord "Tab" -Function AcceptSuggestion
#Set-PSReadLineKeyHandler -Chord "RightArrow" -Function ForwardWord
Set-PSReadLineKeyHandler -Chord "RightArrow" -Function EndOfLine
Set-PSReadLineKeyHandler -Chord "UpArrow" -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Chord "DownArrow" -Function HistorySearchForward
# aliases
Set-Alias -name l -value ls
Set-Alias -name lsa -value Get-Acl
function P-A {
php artisan @args
}
Set-Alias -name pa -value P-A
function G-S {
git status
}
Set-Alias -name gs -value G-S
function G-A {
git add .
}
Set-Alias -name ga -value G-A
function G-P {
git push
}
Set-Alias -name gtp -value G-P
function N-R-D {
npm run dev
}
Set-Alias -name nrd -value N-R-D
function N-R-P {
npm run production
}
Set-Alias -name nrp -value N-R-P
function N-R-W {
npm run watch
}
Set-Alias -name nrw -value N-R-W
function N-R-B {
npm run build
}
Set-Alias -name nrb -value N-R-B
function N-R-L {
npm run lint
}
Set-Alias -name nrl -value N-R-L
function P-N-P-X {
pnpm dlx
}
Set-Alias -name pnpx -value P-N-P-X
function D-S {
cd C:\dev
}
Set-Alias -name ds -value D-S
@syntaxlexx
Copy link
Author

syntaxlexx commented Jan 2, 2023

Powershell Aliases can be set by typing:

nano $PROFILE

or

notepad $PROFILE

NB: Make sure you install oh-my-posh.Link here

AOB

Install Chocolatey for a better developer experience. Chocolatey has amazing software such as:

  • composer
  • nvm -> for npm and stuff

For developing Laravel in windows, use Laragon and activate nginx, redis, mysql. Set nginx to use port 80 instead of 8080. Don't use apache - trust me.

NB: After you change your environment variables, execute the refreshenv command. - You must have the Chocolatey package Installed

@syntaxlexx
Copy link
Author

oh-my-posh init pwsh --config 'C:/dev/powerlevel10k_rainbow.omp.json' | Invoke-Expression

function L-S {
ls
}
Set-Alias -name l -value L-S

function P-A {
php artisan @Args
}
Set-Alias -name pa -value P-A

function G-S {
git status
}
Set-Alias -name gs -value G-S

function G-A {
git add .
}
Set-Alias -name ga -value G-A

function N-R-D {
npm run dev
}
Set-Alias -name nrd -value N-R-D

function N-R-P {
npm run production
}
Set-Alias -name nrp -value N-R-P

function N-R-W {
npm run watch
}
Set-Alias -name nrw -value N-R-W

function N-R-B {
npm run build
}
Set-Alias -name nrb -value N-R-B

function D-S {
cd C:\dev
}
Set-Alias -name ds -value D-S

Import the Chocolatey Profile that contains the necessary code to enable

tab-completions to function for choco.

Be aware that if you are missing these lines from your profile, tab completion

for choco will not function.

See https://ch0.co/tab-completion for details.

$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment