Skip to content

Instantly share code, notes, and snippets.

@AbiruzzamanMolla
Last active February 3, 2024 05:46
Show Gist options
  • Save AbiruzzamanMolla/239116c79e16b91198d76cad4533a4f0 to your computer and use it in GitHub Desktop.
Save AbiruzzamanMolla/239116c79e16b91198d76cad4533a4f0 to your computer and use it in GitHub Desktop.
Powershell profile
Import-Module -Name Terminal-Icons
#Import-Module oh-my-posh
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/quick-term.omp.json" | Invoke-Expression
Import-Module gsudoModule
Import-Module posh-git
#Set-Alias Prompt gsudoPrompt
## behaviour of Tab key autocomplete
# Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
## From docs:
## With these bindings, up arrow/down arrow will work like PowerShell/cmd if the
## current command line is blank. If you've entered some text though, it will
## search the history for commands that start with the currently entered text.
##
## Like zsh completion.
# Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
# Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
#Install-Module PSReadLine -AllowPrerelease -Force
Import-Module PSReadLine
# Shows navigable menu of all options when hitting Tab
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
# Autocompleteion for Arrow keys
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineOption -ShowToolTips
Set-PSReadLineOption -PredictionSource History
#Install-Module PowerType -AllowPrerelease
Set-PSReadLineOption -PredictionSource HistoryAndPlugin -PredictionViewStyle ListView # Optional
#Set the color for Prediction (auto-suggestion)
#Set-PSReadlineOption -Colors @{"Prediction" = 'DarkGreen' }
#Install-Module PSFzf
Import-Module PSFzf
Set-PsFzfOption -PSReadLineChordProvider 'Ctrl+f' -PSReadLineChordReverseHistory 'Ctrl+r'
# $env:POSH_PATH
# Import-Module oh-my-posh
#Set-PoshPrompt -Theme clean-detailed
# Import-Module -Name Terminal-Icons
Set-Alias ll ls
Set-Alias grep findstr
# Laravel Artisan Commands Shortcut
function artisanServer($arg1, $arg2, $arg3) { php artisan server $arg1 $arg2 $arg3 }
Set-Alias pas artisanServer
function art($arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7,$arg8,$arg9) { php artisan $arg1 $arg2 $arg3 $arg4 $arg5 $arg6 $arg7 $arg8 $arg9}
Set-Alias pa art
# Git Commands Shortcut
Set-Alias g git
# Remove Defaults
rename-item alias:\gc gk -force
# Git Commit Commands Shortcut
function gitcommit($arg1) { git commit -m "$arg1"}
Set-Alias gc gitcommit
# Git Commit Commands Shortcut
function gitadd { git add .}
Set-Alias gaa gitadd
function gcf { git commit -a --no-verify }
Set-Alias gcf gcf
function pserve { php -S 127.0.0.1:8080 -t ./ }
Set-Alias phpserver pserve
function gacp($arg1) { git commit -a -m "$arg1" && git push }
Set-Alias gacp gacp
#### Use as by default Alias #####
# ge:r => generate:resource
# ge:c => generate:controller
# ge:s => generate:seed
# ge:m => generate:model
# ge:sc => generate:scaffold
# m:m => migrate:make
# m:f => migrate:refresh
# m:re => migrate:reset
# m:b => migrate:rollback
# Try it
## PS c:\laravel_proj> a ge:r post
# For CodeCept
## Assuming codecept.phar file is in your current working Directory
Set-Alias c composer
# *** Other *** #
function www($arg1) {
$arg="C:\laragon\www" + $arg1
cd $arg
}
## Try it:
# PS C:\> www
# OR,
# PS C:\> www laravel_proj
# Useful shortcuts for traversing directories
function cd... { cd ..\.. }
function cd.... { cd ..\..\.. }
# Quick shortcut to start notepad
function n { notepad $args }
# We don't need these any more; they were just temporary variables to get to $isAdmin.
$env:PYTHONIOENCODING="utf-8"
iex "$(thefuck --alias durrr)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment