Skip to content

Commit 8bc7127

Browse files
authored
Import git-aliases -DisableNameChecking & fix PSReadLine double-import
1 parent 456bdf0 commit 8bc7127

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

profile.ps1

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# --- PSReadLine Configuration ---
22
# This enhances the command-line editing experience.
3-
Import-Module PSReadLine -ErrorAction SilentlyContinue
4-
Set-PSReadLineOption -BellStyle None
5-
# Use Tab for menu completion and Shift+Tab to go backward.
6-
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
7-
Set-PSReadLineKeyHandler -Key "Shift+Tab" -Function TabCompletePrevious
3+
if (Get-Module -ListAvailable -Name PSReadLine) {
4+
if (-not (Get-Module -Name PSReadLine)) {
5+
Import-Module PSReadLine -ErrorAction SilentlyContinue
6+
}
7+
Set-PSReadLineOption -BellStyle None
8+
# Use Tab for menu completion and Shift+Tab to go backward.
9+
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
10+
Set-PSReadLineKeyHandler -Key "Shift+Tab" -Function TabCompletePrevious
11+
}
812

913
# --- Add your custom modules directory to the PSModulePath ---
1014
# This ensures PowerShell can find your 'GitAliases.Extras' module.
@@ -21,7 +25,7 @@ if ($env:PSModulePath -notlike "*$dotModules*") {
2125
Import-Module posh-git -ErrorAction Stop
2226

2327
# 2. git-aliases: Provides the standard set of 'g' aliases (gco, gsw, etc.).
24-
Import-Module git-aliases -ErrorAction Stop
28+
Import-Module git-aliases -ErrorAction Stop -DisableNameChecking
2529

2630
# Set the base 'g' alias to 'git' after modules that might define it as a function.
2731
# This ensures 'g<tab>' works correctly.
@@ -34,4 +38,4 @@ Set-Alias -Name g -Value git -Force
3438
# It finds all aliases and registers the proxy completer.
3539
Import-Module GitAliases.Extras -Force -ErrorAction Stop
3640

37-
Write-Host "PowerShell profile loaded. Posh-git and custom alias completion are active." -ForegroundColor Green
41+
# Write-Host "PowerShell profile loaded. Posh-git and custom alias completion are active." -ForegroundColor Green

0 commit comments

Comments
 (0)