diff --git a/RdzeN-Profile.ps1 b/RdzeN-Profile.ps1 index 9a14e03..80a8b7f 100644 --- a/RdzeN-Profile.ps1 +++ b/RdzeN-Profile.ps1 @@ -51,4 +51,3 @@ Test-Profile Override-Profile # 6. Reload Profile Reload-Profile - diff --git a/functions/Find-Notepadpp.ps1 b/functions/Find-Notepadpp.ps1 new file mode 100644 index 0000000..755821a --- /dev/null +++ b/functions/Find-Notepadpp.ps1 @@ -0,0 +1,26 @@ +# gitea.RdzeN.net +# Find notepad++ +# use notepad++ as editor + +function find-notepadpp { + $a = Get-ChildItem -Path $env:ProgramFiles -Filter "notepad++.exe" -Recurse -File -ErrorAction SilentlyContinue + $b = Get-ChildItem -Path ${env:ProgramFiles(x86)} -Filter "notepad++.exe" -Recurse -File -ErrorAction SilentlyContinue + + if ($a -ne $null) { + $notepadpp = $a[0].FullName + } else { + $notepadpp = $b[0].FullName + } + if ($notepadpp -ne $null) { + return $notepadpp + } +} +$notepadpp = find-notepadpp +if ($notepadpp -ne $null) { + function editn { + param ( + $filepath + ) + Start-Process $notepadpp -ArgumentList $filepath + } +} \ No newline at end of file diff --git a/functions/Find-VSCode.ps1 b/functions/Find-VSCode.ps1 new file mode 100644 index 0000000..06e3f90 --- /dev/null +++ b/functions/Find-VSCode.ps1 @@ -0,0 +1,26 @@ +# gitea.RdzeN.net +# Find notepad++ +# use notepad++ as editor + +function find-vscode { + $a = Get-ChildItem -Path $env:ProgramFiles -Filter "Code.exe" -Recurse -File -ErrorAction SilentlyContinue + $b = Get-ChildItem -Path ${env:ProgramFiles(x86)} -Filter "Code.exe" -Recurse -File -ErrorAction SilentlyContinue + + if ($a -ne $null) { + $vscode = $a[0].FullName + } else { + $vscode = $b[0].FullName + } + if ($vscode -ne $null) { + return $vscode + } +} +$vscode = find-vscode +if ($vscode -ne $null) { + function editv { + param ( + $filepath + ) + Start-Process $vscode -ArgumentList $filepath + } +} \ No newline at end of file