From af66c00155010fafa8e87e398a379f862ea63d7d Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 26 Sep 2022 04:10:17 +0900 Subject: [PATCH 01/28] 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/28] 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/28] 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/28] 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/28] 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/28] 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/28] 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/28] 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/28] 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/28] 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/28] 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 3844a9a533cf20ae193c6028e7d17c6822ece4a6 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 3 Oct 2022 03:27:48 +0900 Subject: [PATCH 12/28] new: config.fish & ln script --- bin/install.sh | 1 + dotfiles/fish/config.fish | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 bin/install.sh create mode 100644 dotfiles/fish/config.fish diff --git a/bin/install.sh b/bin/install.sh new file mode 100644 index 0000000..cabc0ff --- /dev/null +++ b/bin/install.sh @@ -0,0 +1 @@ +ln -s (pwd)/dotfiles/fish/config.fish ~/.config/fish/config.fish diff --git a/dotfiles/fish/config.fish b/dotfiles/fish/config.fish new file mode 100644 index 0000000..8347384 --- /dev/null +++ b/dotfiles/fish/config.fish @@ -0,0 +1,23 @@ +# load .bashrc +bass source ~/.bashrc + +# ssh-agent +if not keychain + source $HOME/.keychain/DESKTOP-6DPNBNH-fish + ssh-add ~/.ssh/id_rsa_eccs + ssh-add ~/.ssh/id_ed25519 +end + +# opam configuration +#source /home/urata/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true +# deleted + +# key bindings +bind \b backward-kill-word + +# starship +starship init fish | source +#function set_win_title +# echo -ne "\033]0; (basename "$PWD") \007" +#end +#set tarship_precmd_uesr_func "set_win_title" From c04d5e6dbb168bd23dd9c61de53e25ba6a76db1d Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 3 Oct 2022 03:29:33 +0900 Subject: [PATCH 13/28] add: fish :ssh-agent evaluation --- dotfiles/fish/config.fish | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dotfiles/fish/config.fish b/dotfiles/fish/config.fish index 8347384..6b23632 100644 --- a/dotfiles/fish/config.fish +++ b/dotfiles/fish/config.fish @@ -7,6 +7,9 @@ if not keychain ssh-add ~/.ssh/id_rsa_eccs ssh-add ~/.ssh/id_ed25519 end +# https://wiki.archlinux.jp/index.php/Fish#ssh-agent_.E3.81.AE.E8.A9.95.E4.BE.A1 +eval (ssh-agent -c) + # opam configuration #source /home/urata/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true From ad585e1444c91161ee3dc817296089d44b548dcc Mon Sep 17 00:00:00 2001 From: qwjyh Date: Wed, 5 Oct 2022 02:45:32 +0900 Subject: [PATCH 14/28] 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 15/28] 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} From fe8217cff43a73a849fe176e76bc359bfba12f72 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Thu, 6 Oct 2022 23:20:40 +0900 Subject: [PATCH 16/28] fix: fish keychain --- dotfiles/fish/config.fish | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dotfiles/fish/config.fish b/dotfiles/fish/config.fish index 6b23632..e147f7d 100644 --- a/dotfiles/fish/config.fish +++ b/dotfiles/fish/config.fish @@ -2,14 +2,11 @@ bass source ~/.bashrc # ssh-agent -if not keychain - source $HOME/.keychain/DESKTOP-6DPNBNH-fish - ssh-add ~/.ssh/id_rsa_eccs - ssh-add ~/.ssh/id_ed25519 +if status --is-interactive + set -x SHELL fish + keychain --eval --quiet -Q id_rsa, id_ed25519 | source + set -x SHELL bash end -# https://wiki.archlinux.jp/index.php/Fish#ssh-agent_.E3.81.AE.E8.A9.95.E4.BE.A1 -eval (ssh-agent -c) - # opam configuration #source /home/urata/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true From a5be748c5d6cd81fd25d02959e740bc9624299e0 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Thu, 6 Oct 2022 23:34:12 +0900 Subject: [PATCH 17/28] update: fish: opam init --- dotfiles/fish/config.fish | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dotfiles/fish/config.fish b/dotfiles/fish/config.fish index acbf87c..09b6f19 100644 --- a/dotfiles/fish/config.fish +++ b/dotfiles/fish/config.fish @@ -14,10 +14,11 @@ if status is-interactive set -x SHELL fish keychain --eval --quiet -Q id_rsa, id_ed25519 | source set -x SHELL bash + + # opam + # source ~/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true end -# opam -# source ~/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true # key bindings bind \b backward-kill-word \ No newline at end of file From ffd10f5dfe853cc01df5e2ef6020a60084a828e3 Mon Sep 17 00:00:00 2001 From: qwjyh <62229267+qwjyh@users.noreply.github.com> Date: Thu, 6 Oct 2022 23:52:48 +0900 Subject: [PATCH 18/28] Create README.md --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..fcf5d2d --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# dotfiles +my dotfiles + +# Environments +- Windows 11 + - pwsh + - AHK macro + - etc +- Ubuntu 20.04 on WSL + - fish +- Manjaro + - fish + - tmux + - neovim + +# Installing +## Windows +1. update winget (via MS store) +2. install Git for Windows via winget +3. install pwsh via winget +4. set execution policy +5. install [scoop](https://scoop.sh/) (see scoop website) +6. run `bin/install.ps1` + +## Linux +1. install fish +2. run install.fish + +# TODO +- make install script for Linux +- add rc files of Manjaro +- neovim configs + - lsp-config + - visuals +- termux dotfiles +- raspi dotfiles From 62e1bff8aaa82104ade73d3307e9eb7d3b553219 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Fri, 7 Oct 2022 00:08:25 +0900 Subject: [PATCH 19/28] add README for pwsh PROFILE --- dotfiles/pwsh/README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 dotfiles/pwsh/README.md diff --git a/dotfiles/pwsh/README.md b/dotfiles/pwsh/README.md new file mode 100644 index 0000000..fcd08ab --- /dev/null +++ b/dotfiles/pwsh/README.md @@ -0,0 +1,34 @@ +# PowerShell PROFILE description +some notable features + +## Key-Bindings +- tab completion like fish +- `Ctrl + D` to exit +- `Ctrl + G` to Invoke-FzfTabCompletion +- `Ctrl + t` to select providers with fzf +- `Ctrl + r` to fzf history + +## Aliases +- `~`, `..` +- `epl` = `explorer.exe .` +- `whereis` = `where.exe` + +## Change Encodings Instantly +You can change PowerShell encodings instantly. +Especially useful for piping into linux commands like `less` +- `Set-UTF8`, `Set-UTF16LE` +- `Remove-EncodingSettings` +- `Reset-EncodingSettings` + +## ssh-agent +- `Invoke-SshAdd` + +## `$env:` +- `$env:LESS` + +## Auto Completions +- scoop +- chezmoi +- git +- winget +- chocolatey \ No newline at end of file From 700fa0ba792a888801f06203a3fa1a927ef685b6 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sun, 9 Oct 2022 20:42:38 +0900 Subject: [PATCH 20/28] update: pwsh: PSReadLine version & add CompletionPredictor --- dotfiles/pwsh/README.md | 3 ++- dotfiles/pwsh/powershell_profile.ps1 | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dotfiles/pwsh/README.md b/dotfiles/pwsh/README.md index fcd08ab..70c7973 100644 --- a/dotfiles/pwsh/README.md +++ b/dotfiles/pwsh/README.md @@ -2,6 +2,7 @@ some notable features ## Key-Bindings +- `F2` to toggle InlineView and ListView of predictions - tab completion like fish - `Ctrl + D` to exit - `Ctrl + G` to Invoke-FzfTabCompletion @@ -31,4 +32,4 @@ Especially useful for piping into linux commands like `less` - chezmoi - git - winget -- chocolatey \ No newline at end of file +- chocolatey diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index f1e3b7d..4a2982f 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -1,11 +1,12 @@ # ============================================================== # PSReadLine Settings # ============================================================== -Import-Module PSReadLine -Set-PSReadLineOption -PredictionSource History +Import-Module PSReadLine # >= 2.2.2 +Import-Module CompletionPredictor +Set-PSReadLineOption -PredictionSource HistoryAndPlugin # require PowerShell ≧ 7.2 and PSReadLine ≧ 2.2.2 Set-PSReadlineOption -HistoryNoDuplicates Set-PSReadLineOption -DingTone 880 # beep frequency -Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord # like fish +Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function AcceptSuggestion # like fish Set-PSReadLineKeyHandler -Chord "Tab" MenuComplete Set-PSReadLineKeyHandler -Chord "Ctrl+d" DeleteCharOrExit Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion } From 38928f1e21658d85604cbc0db395f184a1d8e677 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 10 Oct 2022 22:18:04 +0900 Subject: [PATCH 21/28] add: pwsh: emacs keybindings explicit cmd/pwsh PSReadLine mode --- dotfiles/pwsh/powershell_profile.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index 4a2982f..ea5f655 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -3,13 +3,17 @@ # ============================================================== Import-Module PSReadLine # >= 2.2.2 Import-Module CompletionPredictor +Set-PSReadLineOption -EditMode Windows Set-PSReadLineOption -PredictionSource HistoryAndPlugin # require PowerShell ≧ 7.2 and PSReadLine ≧ 2.2.2 Set-PSReadlineOption -HistoryNoDuplicates Set-PSReadLineOption -DingTone 880 # beep frequency +Set-PSReadLineKeyHandler -Chord "Ctrl+u" -Function BackwardKillInput # like emacs +Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory # like emacs +Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function NextHistory # like emacs Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function AcceptSuggestion # like fish Set-PSReadLineKeyHandler -Chord "Tab" MenuComplete Set-PSReadLineKeyHandler -Chord "Ctrl+d" DeleteCharOrExit -Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion } +Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion } -BriefDescription "Fzf tab completion" -Description "Invoke fzf tab completion. Need some input first." # PsFzf Options # 'Ctrl+t' for provider path, 'Ctrl+r' for reverse history From 9e9782357ebccb268bdb4d9caf212dfaa1451ae4 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 11 Oct 2022 18:43:32 +0900 Subject: [PATCH 22/28] update: pwsh: module installs (now use ZLocation instead of z to improve tab completion) --- bin/install.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/install.ps1 b/bin/install.ps1 index 72cda8c..0aa87d8 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -26,8 +26,15 @@ Install-Module -Name posh-git Write-Output "Pscx" Install-Module -Name Pscx -AllowPrerelease Write-Output "z" -Install-Module -Name z +Install-Module -Name ZLocation +Write-Output "PSFzf" Install-Module -Name PSFzf -RequiredVersion 2.5.10 +Write-Output "Latest PSReadLine" +Install-Module -Name PSReadLine -Force # Override default version to get the latest one +Write-Output "CompletionPredictor" +Install-Module -Name CompletionPredictor + + # install scoop if(!(Get-Command scoop -ErrorAction SilentlyContinue)) { From b52d5f4b289fecca30b228b5cb19fff2fd0151be Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sat, 15 Oct 2022 18:41:10 +0900 Subject: [PATCH 23/28] add: fish: function to save custom history file --- dotfiles/fish/config.fish | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dotfiles/fish/config.fish b/dotfiles/fish/config.fish index 09b6f19..921ed94 100644 --- a/dotfiles/fish/config.fish +++ b/dotfiles/fish/config.fish @@ -16,9 +16,17 @@ if status is-interactive set -x SHELL bash # opam - # source ~/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true + source ~/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true end # key bindings -bind \b backward-kill-word \ No newline at end of file +bind \b backward-kill-word + +# save fish log to my custom file +set -gx my_fish_history "$HOME/my_fish_history.txt" +function save_myhistory --on-event fish_prompt -d "Save custom shell log to $my_fish_history" + echo "$(date '+%Y-%m-%d %H:%M:%S') $hostname:$fish_pid $PWD [$status] $(history -1)" \ + >> $my_fish_history +end + From d68e0833dbdafd089a3129f172f0ba8877fa1859 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sat, 15 Oct 2022 19:53:14 +0900 Subject: [PATCH 24/28] fix: fish: exit status logging of my custom history file --- dotfiles/fish/config.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dotfiles/fish/config.fish b/dotfiles/fish/config.fish index 921ed94..aabc101 100644 --- a/dotfiles/fish/config.fish +++ b/dotfiles/fish/config.fish @@ -26,7 +26,8 @@ bind \b backward-kill-word # save fish log to my custom file set -gx my_fish_history "$HOME/my_fish_history.txt" function save_myhistory --on-event fish_prompt -d "Save custom shell log to $my_fish_history" - echo "$(date '+%Y-%m-%d %H:%M:%S') $hostname:$fish_pid $PWD [$status] $(history -1)" \ + set -l prev_status $status + echo "$(date '+%Y-%m-%d %H:%M:%S') $hostname:$fish_pid $PWD [$prev_status] $(history -1)" \ >> $my_fish_history end From 609a2f13ba58a71391cb75a075be6807c7150d65 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sun, 16 Oct 2022 18:14:54 +0900 Subject: [PATCH 25/28] add: ahk: extra remaps --- dotfiles/ahk/extra_remaps.ahk | 25 +++++++++++++++++++++++++ dotfiles/ahk/key_remaps.ahk | 4 ++++ 2 files changed, 29 insertions(+) create mode 100644 dotfiles/ahk/extra_remaps.ahk diff --git a/dotfiles/ahk/extra_remaps.ahk b/dotfiles/ahk/extra_remaps.ahk new file mode 100644 index 0000000..1229096 --- /dev/null +++ b/dotfiles/ahk/extra_remaps.ahk @@ -0,0 +1,25 @@ +; extra key remaps +; mainly for inputting special characters + +; Play/Pause +sc121:: + Send {Media_Play_Pause} + return + + +; Henkan/Muhenkan + - -> en, em dash +vk1D & vkBD:: + Send {U+2013} ; en dash + return +vk1C & vkBD:: + Send {U+2014} ; em dash + return + +; Henkan/Muhenkan + {Space} -> ZWSP, ZWJ +vk1D & Space:: + Send {U+200B} ; ZWSP + return +vk1C & Space:: + Send {U+200D} ; ZWJ + return + diff --git a/dotfiles/ahk/key_remaps.ahk b/dotfiles/ahk/key_remaps.ahk index 4ef1436..3f90df4 100644 --- a/dotfiles/ahk/key_remaps.ahk +++ b/dotfiles/ahk/key_remaps.ahk @@ -62,3 +62,7 @@ return ; HankakuZenkaku to esc sc029:: Send, {Escape} + +; ========================================== +; include extra key remaps +#Include extra_remaps.ahk From 66027b05c248aaf7facf696e2fefe9e7ecf33388 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 17 Oct 2022 15:58:17 +0900 Subject: [PATCH 26/28] fix: ahk: Hankaku/Zenkaku behavior --- dotfiles/ahk/extra_remaps.ahk | 8 ++++---- dotfiles/ahk/key_remaps.ahk | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/dotfiles/ahk/extra_remaps.ahk b/dotfiles/ahk/extra_remaps.ahk index 1229096..5effd07 100644 --- a/dotfiles/ahk/extra_remaps.ahk +++ b/dotfiles/ahk/extra_remaps.ahk @@ -2,10 +2,10 @@ ; mainly for inputting special characters ; Play/Pause -sc121:: - Send {Media_Play_Pause} - return - +;sc121:: +; Send {Media_Play_Pause} +; return +; ; Henkan/Muhenkan + - -> en, em dash vk1D & vkBD:: diff --git a/dotfiles/ahk/key_remaps.ahk b/dotfiles/ahk/key_remaps.ahk index 3f90df4..70722db 100644 --- a/dotfiles/ahk/key_remaps.ahk +++ b/dotfiles/ahk/key_remaps.ahk @@ -57,12 +57,11 @@ vk1C & d:: Send,{Blind}{PgDn} return +; ========================================== +; include extra key remaps +#Include extra_remaps.ahk ; ========================================== ; HankakuZenkaku to esc sc029:: Send, {Escape} - -; ========================================== -; include extra key remaps -#Include extra_remaps.ahk From 745234408a81f0833ef308a478969799d5553fd5 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 17 Oct 2022 16:56:28 +0900 Subject: [PATCH 27/28] add: neovim: lualine --- bin/install.ps1 | 4 ++- dotfiles/neovim/init.lua | 13 ++++++++- dotfiles/neovim/lua/lualine_setup.lua | 40 +++++++++++++++++++++++++++ dotfiles/neovim/lua/plugins.lua | 6 ++++ 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 dotfiles/neovim/lua/lualine_setup.lua diff --git a/bin/install.ps1 b/bin/install.ps1 index 0aa87d8..87905bd 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -49,7 +49,9 @@ scoop import .\bin\scoop_apps\scoop_minimal_apps.json # make symbolic links # neovim -New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\init.vim -Target (Resolve-Path .\dotfiles\neovim\init.vim) -Force +New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\init.lua -Target (Resolve-Path .\dotfiles\neovim\init.lua) -Force +New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\plugins.lua -Target (Resolve-Path .\dotfiles\neovim\lua\plugins.lua) -Force +New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lualine_setup.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lualine_setup.lua) -Force # pwsh New-Item -ItemType SymbolicLink -Path $PROFILE -Target (Resolve-Path .\dotfiles\pwsh\powershell_profile.ps1) -Force New-Item -ItemType SymbolicLink -Path ~\.config\powershell\chezmoi_completion.ps1 -Target (Resolve-Path .\dotfiles\pwsh\chezmoi_completion.ps1) -Force diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index d7bdd8e..4a6db37 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -3,7 +3,8 @@ vim.o.number = true vim.o.relativenumber = true vim.cmd([[ -highlight LineNr cterm=none ctermfg=256 +highlight LineNr cterm=none ctermfg=243 +highlight CursorLineNr cterm=none ctermfg=250 ]]) vim.o.tabstop = 4 vim.o.shiftwidth = 4 @@ -138,3 +139,13 @@ cmp.setup({ vim.api.nvim_set_keymap('n', '', "lua require('fzf-lua').files()", { noremap = true, silent = true }) + + +----------------------------------------------------------- +-- lualine +require('lualine_setup') +lualine = require('lualine') +lualine.setup({ + options = { theme = 'iceberg_dark' } +}) +lualine.setup() diff --git a/dotfiles/neovim/lua/lualine_setup.lua b/dotfiles/neovim/lua/lualine_setup.lua new file mode 100644 index 0000000..6d5017a --- /dev/null +++ b/dotfiles/neovim/lua/lualine_setup.lua @@ -0,0 +1,40 @@ +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '|', right = '|'}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +} diff --git a/dotfiles/neovim/lua/plugins.lua b/dotfiles/neovim/lua/plugins.lua index 86506f7..4ec117b 100644 --- a/dotfiles/neovim/lua/plugins.lua +++ b/dotfiles/neovim/lua/plugins.lua @@ -9,6 +9,12 @@ return require('packer').startup(function(use) --requires = { 'kyazdan142/nvim-web/devicons' } -- not found } + -- lualine(statusline) + use { + 'nvim-lualine/lualine.nvim', + requires = { 'kyazdani42/nvim-web-devicons', opt = true } + } + -- LSP use 'neovim/nvim-lspconfig' use "williamboman/mason.nvim" From 9fef6bf5be56841aa3c941253dcf7e4d287e81bc Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 17 Oct 2022 17:34:30 +0900 Subject: [PATCH 28/28] add: pwsh: save my custom history --- dotfiles/pwsh/powershell_profile.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index ea5f655..9ed7b93 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -31,9 +31,16 @@ Set-Alias whereis where.exe # starship # change window name +# save my history +$My_Pwsh_History = "$HOME\my_pwsh_history.txt" function Invoke-Starship-PreCommand { + # window title $ParentFolder = Split-Path $PWD -Leaf $host.ui.Write("`e]0; $ParentFolder `a") + + # save log + Write-Output "$(Get-Date -UFormat '+%Y-%m-%d %H:%M:%S') $env:COMPUTERNAME`:$PID [$Global:LASTEXITCODE] $(Get-History -Count 1)" + | Out-File -FilePath $My_Pwsh_History -Append -Encoding utf8 } Invoke-Expression (&starship init powershell) $ENV:STARSHIP_CONFIG = "$HOME\.config\starship.toml"