From 40bbb8e19f6e22e12a82df3e97c3dc4d91cb4860 Mon Sep 17 00:00:00 2001 From: Tomasz Kostrzewa Date: Tue, 5 Mar 2024 21:34:21 +0100 Subject: [PATCH] modified: RdzeN-Profile.ps1 new file: functions/Find-Notepadpp.ps1 new file: functions/Find-VSCode.ps1 --- RdzeN-Profile.ps1 | 1 - functions/Find-Notepadpp.ps1 | 26 ++++++++++++++++++++++++++ functions/Find-VSCode.ps1 | 26 ++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 functions/Find-Notepadpp.ps1 create mode 100644 functions/Find-VSCode.ps1 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