From af66c00155010fafa8e87e398a379f862ea63d7d Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 26 Sep 2022 04:10:17 +0900 Subject: [PATCH 01/13] pwsh whereis --- dotfiles/pwsh/powershell_profile.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index ff955e0..a8881e9 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -10,6 +10,7 @@ function ~ { cd ~ } function .. { cd .. } function epl {explorer.exe .} Set-Alias touch New-Item +Set-Alias whereis where.exe # starship From 09628f088d0c800ff903251051b5fe2bec7685b8 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 26 Sep 2022 08:15:37 +0900 Subject: [PATCH 02/13] update: use Requires to simplify install.ps1 --- bin/install.ps1 | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/bin/install.ps1 b/bin/install.ps1 index 0e09de8..ff7b579 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -2,22 +2,11 @@ # dotfiles install script for Windows # check administration role -$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) -$bool_admin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -if (!$bool_admin) { - Write-Warning -Message "require Admin privilage - please run as Administrator" - exit 1 -} +#Requires -RunAsAdministrator # check pwsh version # ≧ 7 -if ($PSVersionTable.PSVersion.Major -lt 7) { - Write-Warning -Message "pwsh version must be greater than 7 - please install powershell 7 (Core) - you can install via winget" - exit 1 -} +#Requires -Version 7 # check working directory if (!( From 1959ffc7f573d2bc17c3e58973854d8c6499bb5a Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 27 Sep 2022 06:27:23 +0900 Subject: [PATCH 03/13] add: pwsh module PSFzf, scoop packages installation, executionpolicy notification --- bin/install.ps1 | 14 +++++ bin/scoop_apps/scoop_apps.json | 89 ++++++++++++++++++++++++++++ bin/scoop_apps/update_scoop_list.ps1 | 7 +++ dotfiles/pwsh/powershell_profile.ps1 | 2 +- 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 bin/scoop_apps/scoop_apps.json create mode 100644 bin/scoop_apps/update_scoop_list.ps1 diff --git a/bin/install.ps1 b/bin/install.ps1 index ff7b579..548cb9f 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -1,5 +1,8 @@ #!/usr/bin/pwsh # dotfiles install script for Windows +# Execute +# Set-ExecutionPolicy RemoteSigned -Scope CurrentUser +# first to run pwsh scripts # check administration role #Requires -RunAsAdministrator @@ -21,6 +24,17 @@ if (!( Install-Module -Name posh-git Install-Module -Name Pscx -AllowPrerelease Install-Module -Name z +Install-Module -Name PSFzf -RequiredVersion 2.5.10 + +# install scoop +if(!(Get-Command scoop -ErrorAction SilentlyContinue)) { + Write-Output "Installing scoop..." + irm get.scoop.sh | iex +} +# install basic scoop apps +# import from exported json file +# to update the json file, execute ./bin/scoop_apps/update_scoop_list.ps1 +scoop import .\bin\scoop_apps\scoop_apps.json # make symbolic links diff --git a/bin/scoop_apps/scoop_apps.json b/bin/scoop_apps/scoop_apps.json new file mode 100644 index 0000000..4576430 --- /dev/null +++ b/bin/scoop_apps/scoop_apps.json @@ -0,0 +1,89 @@ +{ + "apps": [ + { + "Info": "", + "Source": "main", + "Name": "7zip", + "Updated": "2022-09-24T06:50:10.362148+09:00", + "Version": "22.01" + }, + { + "Info": "", + "Source": "main", + "Name": "bat", + "Updated": "2022-09-24T06:45:30.615827+09:00", + "Version": "0.22.1" + }, + { + "Info": "", + "Source": "main", + "Name": "ffmpeg", + "Updated": "2022-09-26T04:52:36.3416759+09:00", + "Version": "5.1.1" + }, + { + "Info": "", + "Source": "main", + "Name": "fzf", + "Updated": "2022-09-23T17:54:45.7302151+09:00", + "Version": "0.33.0" + }, + { + "Info": "", + "Source": "main", + "Name": "gcc", + "Updated": "2022-09-25T00:18:14.5435972+09:00", + "Version": "11.2.0" + }, + { + "Info": "", + "Source": "main", + "Name": "grep", + "Updated": "2022-09-24T06:50:11.9515886+09:00", + "Version": "3.7" + }, + { + "Info": "", + "Source": "main", + "Name": "hexyl", + "Updated": "2022-09-24T06:43:31.7789266+09:00", + "Version": "0.10.0" + }, + { + "Info": "", + "Source": "main", + "Name": "less", + "Updated": "2022-09-23T17:59:11.0595712+09:00", + "Version": "608" + }, + { + "Info": "", + "Source": "main", + "Name": "make", + "Updated": "2022-09-25T00:17:18.2293504+09:00", + "Version": "4.3" + }, + { + "Info": "", + "Source": "main", + "Name": "sudo", + "Updated": "2022-09-22T23:40:06.1651065+09:00", + "Version": "0.2020.01.26" + }, + { + "Info": "", + "Source": "main", + "Name": "ugrep", + "Updated": "2022-09-24T06:53:20.806641+09:00", + "Version": "3.9.2" + } + ], + "buckets": [ + { + "Name": "main", + "Source": "https://github.com/ScoopInstaller/Main", + "Updated": "2022-09-27T05:30:16+09:00", + "Manifests": 1086 + } + ] +} diff --git a/bin/scoop_apps/update_scoop_list.ps1 b/bin/scoop_apps/update_scoop_list.ps1 new file mode 100644 index 0000000..1c32958 --- /dev/null +++ b/bin/scoop_apps/update_scoop_list.ps1 @@ -0,0 +1,7 @@ +# update scoop list +if(!(Get-Command scoop -ErrorAction SilentlyContinue)) { + Write-Output "scoop does not exists!" + exit 1 +} + +scoop export | Out-File scoop_apps.json -Encoding utf8 diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index a8881e9..477235d 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -116,7 +116,7 @@ function Enable-SshAgent { # less options -$env:LESS = "-M -R -S -W -z-4 -x4" +$env:LESS = "-i -M -R -S -W -z-4 -x4" From b1b029a808a5bddaa570454cd9116734abb4af15 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 27 Sep 2022 06:38:05 +0900 Subject: [PATCH 04/13] add: pwsh psfzf startup in PROFILE --- dotfiles/pwsh/powershell_profile.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index 477235d..7497e2a 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -6,6 +6,10 @@ Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord # like fish Set-PSReadLineKeyHandler -Chord "Tab" MenuComplete Set-PSReadLineKeyHandler -Chord "Ctrl+d" DeleteCharOrExit +# PsFzf Options +# 'Ctrl+t' for provider path, 'Ctrl+r' for reverse history +Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r' + function ~ { cd ~ } function .. { cd .. } function epl {explorer.exe .} From cf51a57ed0ec6dfe06c72bedaed9a893a9ce0dde Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 27 Sep 2022 08:24:23 +0900 Subject: [PATCH 05/13] new: pwsh : create minimal scoop list and import --- bin/install.ps1 | 2 +- bin/scoop_apps/scoop_apps.json | 27 ++++++++++ bin/scoop_apps/scoop_minimal_apps.json | 74 ++++++++++++++++++++++++++ bin/scoop_apps/update_scoop_list.ps1 | 24 ++++++++- 4 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 bin/scoop_apps/scoop_minimal_apps.json diff --git a/bin/install.ps1 b/bin/install.ps1 index 548cb9f..d5f9a10 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -34,7 +34,7 @@ if(!(Get-Command scoop -ErrorAction SilentlyContinue)) { # install basic scoop apps # import from exported json file # to update the json file, execute ./bin/scoop_apps/update_scoop_list.ps1 -scoop import .\bin\scoop_apps\scoop_apps.json +scoop import .\bin\scoop_apps\scoop_minimal_apps.json # make symbolic links diff --git a/bin/scoop_apps/scoop_apps.json b/bin/scoop_apps/scoop_apps.json index 4576430..f62b40d 100644 --- a/bin/scoop_apps/scoop_apps.json +++ b/bin/scoop_apps/scoop_apps.json @@ -49,6 +49,20 @@ "Updated": "2022-09-24T06:43:31.7789266+09:00", "Version": "0.10.0" }, + { + "Info": "", + "Source": "main", + "Name": "jid", + "Updated": "2022-09-27T07:30:16.5298145+09:00", + "Version": "0.7.6" + }, + { + "Info": "", + "Source": "main", + "Name": "jq", + "Updated": "2022-09-27T07:29:37.5227478+09:00", + "Version": "1.6" + }, { "Info": "", "Source": "main", @@ -63,6 +77,13 @@ "Updated": "2022-09-25T00:17:18.2293504+09:00", "Version": "4.3" }, + { + "Info": "", + "Source": "extras", + "Name": "spacesniffer", + "Updated": "2022-09-27T07:27:52.6696127+09:00", + "Version": "1.3.0.2" + }, { "Info": "", "Source": "main", @@ -79,6 +100,12 @@ } ], "buckets": [ + { + "Name": "extras", + "Source": "https://github.com/ScoopInstaller/Extras", + "Updated": "2022-09-27T05:32:10+09:00", + "Manifests": 1691 + }, { "Name": "main", "Source": "https://github.com/ScoopInstaller/Main", diff --git a/bin/scoop_apps/scoop_minimal_apps.json b/bin/scoop_apps/scoop_minimal_apps.json new file mode 100644 index 0000000..8c611d9 --- /dev/null +++ b/bin/scoop_apps/scoop_minimal_apps.json @@ -0,0 +1,74 @@ +{ + "apps": [ + { + "Info": "", + "Source": "main", + "Name": "7zip", + "Updated": "2022-09-24T06:50:10.362148+09:00", + "Version": "22.01" + }, + { + "Info": "", + "Source": "main", + "Name": "bat", + "Updated": "2022-09-24T06:45:30.615827+09:00", + "Version": "0.22.1" + }, + { + "Info": "", + "Source": "main", + "Name": "fzf", + "Updated": "2022-09-23T17:54:45.7302151+09:00", + "Version": "0.33.0" + }, + { + "Info": "", + "Source": "main", + "Name": "grep", + "Updated": "2022-09-24T06:50:11.9515886+09:00", + "Version": "3.7" + }, + { + "Info": "", + "Source": "main", + "Name": "hexyl", + "Updated": "2022-09-24T06:43:31.7789266+09:00", + "Version": "0.10.0" + }, + { + "Info": "", + "Source": "main", + "Name": "less", + "Updated": "2022-09-23T17:59:11.0595712+09:00", + "Version": "608" + }, + { + "Info": "", + "Source": "main", + "Name": "sudo", + "Updated": "2022-09-22T23:40:06.1651065+09:00", + "Version": "0.2020.01.26" + }, + { + "Info": "", + "Source": "main", + "Name": "ugrep", + "Updated": "2022-09-24T06:53:20.806641+09:00", + "Version": "3.9.2" + } + ], + "buckets": [ + { + "Name": "extras", + "Source": "https://github.com/ScoopInstaller/Extras", + "Updated": "2022-09-27T05:32:10+09:00", + "Manifests": 1691 + }, + { + "Name": "main", + "Source": "https://github.com/ScoopInstaller/Main", + "Updated": "2022-09-27T05:30:16+09:00", + "Manifests": 1086 + } + ] +} diff --git a/bin/scoop_apps/update_scoop_list.ps1 b/bin/scoop_apps/update_scoop_list.ps1 index 1c32958..bdfcb4f 100644 --- a/bin/scoop_apps/update_scoop_list.ps1 +++ b/bin/scoop_apps/update_scoop_list.ps1 @@ -1,7 +1,29 @@ # update scoop list + +# scoop need to be installed if(!(Get-Command scoop -ErrorAction SilentlyContinue)) { Write-Output "scoop does not exists!" exit 1 } -scoop export | Out-File scoop_apps.json -Encoding utf8 +# execution location +if(!((Test-Path bin) -and (Test-Path dotfiles))) { + Write-Warning "This script need to be executed in dotfiles root" + exit 2 +} + + +# export to JSON +scoop export | Out-File .\bin\scoop_apps\scoop_apps.json -Encoding utf8 + +# create minimal JSON +$minimal_list = @("7zip", "bat", "fzf", "grep", "hexyl", "less", "sudo", "ugrep") +$parsed_json = Get-Content -Path .\bin\scoop_apps\scoop_apps.json | ConvertFrom-Json +$buckets = ($parsed_json | Select-Object buckets).buckets +$apps = ($parsed_json | Select-Object apps).apps +$selected_apps = $apps | Where-Object Name -In $minimal_list +$new_json = [PSCustomObject]@{ + "apps" = $selected_apps + "buckets" = $buckets +} +ConvertTo-Json -InputObject $new_json | Out-File .\bin\scoop_apps\scoop_minimal_apps.json -Encoding utf8 \ No newline at end of file From 5ee5aa585b837479599a04b14f72551bee95cf60 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 27 Sep 2022 18:30:30 +0900 Subject: [PATCH 06/13] new: pwsh : luajit installation script --- bin/windows/luajit/install_luajit.ps1 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 bin/windows/luajit/install_luajit.ps1 diff --git a/bin/windows/luajit/install_luajit.ps1 b/bin/windows/luajit/install_luajit.ps1 new file mode 100644 index 0000000..8396594 --- /dev/null +++ b/bin/windows/luajit/install_luajit.ps1 @@ -0,0 +1,22 @@ +# installing luajit under %localappdata%\Programs + +# download and build +git clone https://luajit.org/git/luajit.git +cd luajit +make + +# installing +$luajit_location = Join-Path $env:LOCALAPPDATA "Programs\luajit" +mkdir $luajit_location +cp .\src\luajit.exe, .\src\lua51.dll $luajit_location +mkdir $luajit_location\lua +mkdir $luajit_location\lua\jit +cp .\src\jit\* $luajit_location\lua\jit + +# add to path +while($true) { + $input = Read-Host "add $env:LOCALAPPDATA\Programs\luajit to `$PATH. (Y)" + if ($input = 'Y') { + break + } +} From 89b39204c02a1c795cc38ce419a6faa53db08fd1 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 27 Sep 2022 19:25:41 +0900 Subject: [PATCH 07/13] new: pwsh : set Ctrl+g for `Invoke-FzfTabCompletion` --- dotfiles/pwsh/powershell_profile.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index 7497e2a..efdd151 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -5,6 +5,7 @@ Set-PSReadlineOption -HistoryNoDuplicates Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord # like fish Set-PSReadLineKeyHandler -Chord "Tab" MenuComplete Set-PSReadLineKeyHandler -Chord "Ctrl+d" DeleteCharOrExit +Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion } # PsFzf Options # 'Ctrl+t' for provider path, 'Ctrl+r' for reverse history From 91cfe97f93deaff411ae2346420a34bd1b66e19a Mon Sep 17 00:00:00 2001 From: qwjyh Date: Wed, 28 Sep 2022 23:53:27 +0900 Subject: [PATCH 08/13] update: win : scoop list update (add scoop-completion) --- bin/scoop_apps/scoop_apps.json | 62 +++++++++++++++++++------- bin/scoop_apps/scoop_minimal_apps.json | 22 ++++----- 2 files changed, 56 insertions(+), 28 deletions(-) diff --git a/bin/scoop_apps/scoop_apps.json b/bin/scoop_apps/scoop_apps.json index f62b40d..3ffae3d 100644 --- a/bin/scoop_apps/scoop_apps.json +++ b/bin/scoop_apps/scoop_apps.json @@ -1,101 +1,129 @@ { "apps": [ { + "Updated": "2022-09-24T06:50:10.362148+09:00", "Info": "", "Source": "main", "Name": "7zip", - "Updated": "2022-09-24T06:50:10.362148+09:00", "Version": "22.01" }, { + "Updated": "2022-09-24T06:45:30.615827+09:00", "Info": "", "Source": "main", "Name": "bat", - "Updated": "2022-09-24T06:45:30.615827+09:00", "Version": "0.22.1" }, { + "Updated": "2022-09-26T04:52:36.3416759+09:00", "Info": "", "Source": "main", "Name": "ffmpeg", - "Updated": "2022-09-26T04:52:36.3416759+09:00", "Version": "5.1.1" }, { + "Updated": "2022-09-23T17:54:45.7302151+09:00", "Info": "", "Source": "main", "Name": "fzf", - "Updated": "2022-09-23T17:54:45.7302151+09:00", "Version": "0.33.0" }, { + "Updated": "2022-09-25T00:18:14.5435972+09:00", "Info": "", "Source": "main", "Name": "gcc", - "Updated": "2022-09-25T00:18:14.5435972+09:00", "Version": "11.2.0" }, { + "Updated": "2022-09-24T06:50:11.9515886+09:00", "Info": "", "Source": "main", "Name": "grep", - "Updated": "2022-09-24T06:50:11.9515886+09:00", "Version": "3.7" }, { + "Updated": "2022-09-24T06:43:31.7789266+09:00", "Info": "", "Source": "main", "Name": "hexyl", - "Updated": "2022-09-24T06:43:31.7789266+09:00", "Version": "0.10.0" }, { + "Updated": "2022-09-27T19:03:11.6544132+09:00", + "Info": "", + "Source": "main", + "Name": "innounp", + "Version": "0.50" + }, + { + "Updated": "2022-09-27T07:30:16.5298145+09:00", "Info": "", "Source": "main", "Name": "jid", - "Updated": "2022-09-27T07:30:16.5298145+09:00", "Version": "0.7.6" }, { + "Updated": "2022-09-27T07:29:37.5227478+09:00", "Info": "", "Source": "main", "Name": "jq", - "Updated": "2022-09-27T07:29:37.5227478+09:00", "Version": "1.6" }, { + "Updated": "2022-09-23T17:59:11.0595712+09:00", "Info": "", "Source": "main", "Name": "less", - "Updated": "2022-09-23T17:59:11.0595712+09:00", "Version": "608" }, { + "Updated": "2022-09-27T08:37:26.471311+09:00", + "Info": "", + "Source": "main", + "Name": "lua", + "Version": "5.4.2" + }, + { + "Updated": "2022-09-25T00:17:18.2293504+09:00", "Info": "", "Source": "main", "Name": "make", - "Updated": "2022-09-25T00:17:18.2293504+09:00", "Version": "4.3" }, { + "Updated": "2022-09-27T19:03:31.678283+09:00", + "Info": "", + "Source": "main", + "Name": "r", + "Version": "4.2.1" + }, + { + "Updated": "2022-09-28T23:47:33.9083455+09:00", + "Info": "", + "Source": "extras", + "Name": "scoop-completion", + "Version": "0.2.3" + }, + { + "Updated": "2022-09-27T07:27:52.6696127+09:00", "Info": "", "Source": "extras", "Name": "spacesniffer", - "Updated": "2022-09-27T07:27:52.6696127+09:00", "Version": "1.3.0.2" }, { + "Updated": "2022-09-22T23:40:06.1651065+09:00", "Info": "", "Source": "main", "Name": "sudo", - "Updated": "2022-09-22T23:40:06.1651065+09:00", "Version": "0.2020.01.26" }, { + "Updated": "2022-09-24T06:53:20.806641+09:00", "Info": "", "Source": "main", "Name": "ugrep", - "Updated": "2022-09-24T06:53:20.806641+09:00", "Version": "3.9.2" } ], @@ -103,14 +131,14 @@ { "Name": "extras", "Source": "https://github.com/ScoopInstaller/Extras", - "Updated": "2022-09-27T05:32:10+09:00", + "Updated": "2022-09-28T21:31:14+09:00", "Manifests": 1691 }, { "Name": "main", "Source": "https://github.com/ScoopInstaller/Main", - "Updated": "2022-09-27T05:30:16+09:00", - "Manifests": 1086 + "Updated": "2022-09-28T21:32:26+09:00", + "Manifests": 1091 } ] } diff --git a/bin/scoop_apps/scoop_minimal_apps.json b/bin/scoop_apps/scoop_minimal_apps.json index 8c611d9..fd88203 100644 --- a/bin/scoop_apps/scoop_minimal_apps.json +++ b/bin/scoop_apps/scoop_minimal_apps.json @@ -1,59 +1,59 @@ { "apps": [ { + "Updated": "2022-09-24T06:50:10.362148+09:00", "Info": "", "Source": "main", "Name": "7zip", - "Updated": "2022-09-24T06:50:10.362148+09:00", "Version": "22.01" }, { + "Updated": "2022-09-24T06:45:30.615827+09:00", "Info": "", "Source": "main", "Name": "bat", - "Updated": "2022-09-24T06:45:30.615827+09:00", "Version": "0.22.1" }, { + "Updated": "2022-09-23T17:54:45.7302151+09:00", "Info": "", "Source": "main", "Name": "fzf", - "Updated": "2022-09-23T17:54:45.7302151+09:00", "Version": "0.33.0" }, { + "Updated": "2022-09-24T06:50:11.9515886+09:00", "Info": "", "Source": "main", "Name": "grep", - "Updated": "2022-09-24T06:50:11.9515886+09:00", "Version": "3.7" }, { + "Updated": "2022-09-24T06:43:31.7789266+09:00", "Info": "", "Source": "main", "Name": "hexyl", - "Updated": "2022-09-24T06:43:31.7789266+09:00", "Version": "0.10.0" }, { + "Updated": "2022-09-23T17:59:11.0595712+09:00", "Info": "", "Source": "main", "Name": "less", - "Updated": "2022-09-23T17:59:11.0595712+09:00", "Version": "608" }, { + "Updated": "2022-09-22T23:40:06.1651065+09:00", "Info": "", "Source": "main", "Name": "sudo", - "Updated": "2022-09-22T23:40:06.1651065+09:00", "Version": "0.2020.01.26" }, { + "Updated": "2022-09-24T06:53:20.806641+09:00", "Info": "", "Source": "main", "Name": "ugrep", - "Updated": "2022-09-24T06:53:20.806641+09:00", "Version": "3.9.2" } ], @@ -61,14 +61,14 @@ { "Name": "extras", "Source": "https://github.com/ScoopInstaller/Extras", - "Updated": "2022-09-27T05:32:10+09:00", + "Updated": "2022-09-28T21:31:14+09:00", "Manifests": 1691 }, { "Name": "main", "Source": "https://github.com/ScoopInstaller/Main", - "Updated": "2022-09-27T05:30:16+09:00", - "Manifests": 1086 + "Updated": "2022-09-28T21:32:26+09:00", + "Manifests": 1091 } ] } From d5103f03675124a6d7e5853da0bb0d8d6b4db047 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Thu, 29 Sep 2022 19:14:50 +0900 Subject: [PATCH 09/13] add: pwsh :improve comments & add scoop completion --- dotfiles/pwsh/powershell_profile.ps1 | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index efdd151..d098d57 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -1,4 +1,6 @@ -# auto completion +# ============================================================== +# PSReadLine Settings +# ============================================================== Import-Module PSReadLine Set-PSReadLineOption -PredictionSource History Set-PSReadlineOption -HistoryNoDuplicates @@ -11,13 +13,16 @@ Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion # 'Ctrl+t' for provider path, 'Ctrl+r' for reverse history Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r' + +# ============================================================== +# alias and functions +# ============================================================== function ~ { cd ~ } function .. { cd .. } function epl {explorer.exe .} Set-Alias touch New-Item Set-Alias whereis where.exe - # starship # change window name function Invoke-Starship-PreCommand { @@ -33,7 +38,11 @@ function home_util { & (Join-Path -Path $home_util_path -ChildPath "home_util.exe") } -# change encoding + + +# -------------------------------------------------------------- +# change encoding +# -------------------------------------------------------------- # ref: https://qiita.com/e4rfx/items/3772ecb58b6918ed5348 # 文字エンコードをUTF8に設定する function Set-UTF8 { @@ -125,6 +134,15 @@ $env:LESS = "-i -M -R -S -W -z-4 -x4" +# ============================================================== +# auto completions for modules +# ============================================================== + +# scoop +# enable completion in current shell, use absolute path because PowerShell Core not respect $env:PSModulePath +Import-Module scoop-completion +#Import-Module "$($(Get-Item $(Get-Command scoop.ps1).Path).Directory.Parent.FullName)\modules\scoop-completion" + # chezmoi completion $script = "$HOME\.config\powershell\chezmoi_completion.ps1" if (Test-Path $script) { From 2657b96fad9cd6a5cd8680bac6726f20945a1410 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Thu, 29 Sep 2022 19:29:22 +0900 Subject: [PATCH 10/13] add: pwsh :Invoke-SshAdd --- dotfiles/pwsh/powershell_profile.ps1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index d098d57..5f1253c 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -126,6 +126,19 @@ function Enable-SshAgent { #> sudo Set-Service -Name ssh-agent -StartupType Manual && Start-Service ssh-agent } +# auto start ssh-agent and do ssh-add +function Invoke-SshAdd { + <# + .SYNOPSIS + Starts ssh-agent and do ssh-add + + .DESCRIPTION + Starts ssh-agent as admin and do ssh-add, to add sshkeys to ssh-agent. + #> + + Enable-SshAgent + ssh-add +} # execute "ssh-add" to add keys From 1d201c0f6b5d3510372e4bcf519ca3e113877ce4 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Fri, 30 Sep 2022 17:30:00 +0900 Subject: [PATCH 11/13] add: pwsh :PSReadLine ding tone to 880 --- dotfiles/pwsh/powershell_profile.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index 5f1253c..b756192 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -4,6 +4,7 @@ Import-Module PSReadLine Set-PSReadLineOption -PredictionSource History Set-PSReadlineOption -HistoryNoDuplicates +Set-PSReadLineOption -DingTone 880 # beep frequency Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord # like fish Set-PSReadLineKeyHandler -Chord "Tab" MenuComplete Set-PSReadLineKeyHandler -Chord "Ctrl+d" DeleteCharOrExit From ad585e1444c91161ee3dc817296089d44b548dcc Mon Sep 17 00:00:00 2001 From: qwjyh Date: Wed, 5 Oct 2022 02:45:32 +0900 Subject: [PATCH 12/13] remove: pwsh :home_util shortcut solved by adding home_util.exe to startup folder --- dotfiles/pwsh/powershell_profile.ps1 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index b756192..f1e3b7d 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -33,12 +33,6 @@ function Invoke-Starship-PreCommand { Invoke-Expression (&starship init powershell) $ENV:STARSHIP_CONFIG = "$HOME\.config\starship.toml" -# home_util shortcut -$home_util_path = "~\Documents\macro\ahk" -function home_util { - & (Join-Path -Path $home_util_path -ChildPath "home_util.exe") -} - # -------------------------------------------------------------- From 10de79427e991c4fdfdd4982adac4cc7d1062a0e Mon Sep 17 00:00:00 2001 From: qwjyh Date: Thu, 6 Oct 2022 22:20:08 +0900 Subject: [PATCH 13/13] add: ahk & install script --- bin/windows/install_key_remaps.ps1 | 31 +++++++++++++++ dotfiles/ahk/.gitignore | 1 + dotfiles/ahk/key_remaps.ahk | 64 ++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 bin/windows/install_key_remaps.ps1 create mode 100644 dotfiles/ahk/.gitignore create mode 100644 dotfiles/ahk/key_remaps.ahk diff --git a/bin/windows/install_key_remaps.ps1 b/bin/windows/install_key_remaps.ps1 new file mode 100644 index 0000000..fd53087 --- /dev/null +++ b/bin/windows/install_key_remaps.ps1 @@ -0,0 +1,31 @@ +# Install script for AHK key remapping +# Be sure to install AutoHotKey first + + +# check working directory +if (!( + (Test-Path bin) -and (Test-Path dotfiles) + )) { + Write-Warning -Message "wrong current path + please execute at repo root" + exit 1 +} + +# set Ahk2Exe.exe path +# example "C:\Program Files\AutoHotKey\Compiler\Ahk2Exe.exe" +$ahk2exe_path = "C:\Program Files\AutoHotKey\Compiler\Ahk2Exe.exe" + +## end config + +if ($null -eq $ahk2exe_path) { + exit +} + +# compile +& $ahk2exe_path /in .\dotfiles\ahk\key_remaps.ahk /out dotfiles\ahk\key_remaps.exe + +# add to startup folder +$startup = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\" +Copy-Item .\dotfiles\ahk\key_remaps.exe $startup + +Write-Output "Finished!" diff --git a/dotfiles/ahk/.gitignore b/dotfiles/ahk/.gitignore new file mode 100644 index 0000000..b883f1f --- /dev/null +++ b/dotfiles/ahk/.gitignore @@ -0,0 +1 @@ +*.exe diff --git a/dotfiles/ahk/key_remaps.ahk b/dotfiles/ahk/key_remaps.ahk new file mode 100644 index 0000000..4ef1436 --- /dev/null +++ b/dotfiles/ahk/key_remaps.ahk @@ -0,0 +1,64 @@ +; basic key remapping for windows(JIS keyboard) +; using AutoHotKey +#SingleInstance, Force +SendMode Input +SetWorkingDir, %A_ScriptDir%1 + +; KeyHistory + +#UseHook + +; ========================================== +; 変換/無変換 + ASDF/HJKLのショートカット +vk1D:: +Send, {vk1D} +Return + +vk1C:: +Send, {vk1C} +Return + +; 十字キーの設定 +; hjkl like vim +vk1D & h:: +vk1C & h:: +Send,{Blind}{Left} +return +vk1D & j:: +vk1C & j:: +Send,{Blind}{Down} +return +vk1D & k:: +vk1C & k:: +Send,{Blind}{Up} +return +vk1D & l:: +vk1C & l:: +Send,{Blind}{Right} +return + +; Home,End,PgUp,PgDnの設定 +; a s d f +; Home PgUp PgDn End +vk1D & a:: +vk1C & a:: +Send,{Blind}{Home} +return +vk1D & f:: +vk1C & f:: +Send,{Blind}{End} +return +vk1D & s:: +vk1C & s:: +Send,{Blind}{PgUp} +return +vk1D & d:: +vk1C & d:: +Send,{Blind}{PgDn} +return + + +; ========================================== +; HankakuZenkaku to esc +sc029:: + Send, {Escape}