Sync from Windows

This commit is contained in:
js0ny 2024-08-09 16:16:17 +08:00
parent 6c98bed099
commit 29c17de18f
3 changed files with 60 additions and 61 deletions

3
.npmrc
View file

@ -1,2 +1 @@
proxy=http://127.0.0.1:7890 registry=https://registry.npmmirror.com
https-proxy=http://127.0.0.1:7890

View file

@ -48,7 +48,13 @@ ${function:doku} = { Set-Location -Path ~\MyDocuments && Get-ChildItem }
# Shell Equivalents # # Shell Equivalents #
Set-Alias "touch" "New-Item" Set-Alias "touch" "New-Item"
Set-Alias "open" "explorer.exe" function open {
if ($args.Count -eq 0) {
explorer.exe .
} else {
explorer.exe $args[0]
}
}
# Shell Configurations # # Shell Configurations #
@ -63,20 +69,20 @@ ${function:csi} = { dotnet script }
# C & C++ # # C & C++ #
Set-Alias "cl" "clang" # Set-Alias "cl" "clang"
Set-Alias "clpp" "clang++" # Set-Alias "clpp" "clang++"
Set-Alias "clang" "clang -std=c99" # ${function:clang} = { clang -std=c99 $args[0] }
Set-Alias "clang++" "clang++ -std=c++2b" # ${function:clang++} = { clang -std=c++2b $args[0] }
# Python & Conda # # Python & Conda #
Set-Alias "python3" "python" Set-Alias "python3" "python"
Set-Alias "pip3" "pip" Set-Alias "pip3" "pip"
Set-Alias "py" "python" Set-Alias "py" "python"
Set-Alias "pyact" "conda activate" ${function:pyact} = { conda activate $args[0] }
Set-Alias "pylsenv" "conda env list" ${function:pylsenvs} = { conda env list }
Set-Alias "pydeact" "conda deactivate" ${function:pydact} = { conda deactivate }
Set-Alias "pymkenv" "conda create --name" ${function:pymkenv} = { conda create --name $args[0] }
# # Git # # # Git #
@ -106,33 +112,23 @@ Set-Alias "gvi" "neovide"
# Miscs # # Miscs #
Set-Alias mcd CreateAndSet-Directory
### Functions ### ### Functions ###
function tc { param ( [string] $filename) function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname}
New-Item $filename && code $filename function tc { param ( [string] $filename) New-Item $filename && code $filename }
} function tv { param ( [string] $filename) New-Item $filename && nvim $filename }
function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem }
function tv { param ( [string] $filename)
New-Item $filename && nvim $filename
}
function cdls { param( [string] $dirname)
Set-Location $dirname && Get-ChildItem
}
### Modules ### ### Modules ###
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" }
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58 Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
Import-Module CompletionPredictor Import-Module CompletionPredictor
### Misc ### ### Misc ###
## Conda ##
#region conda initialize #region conda initialize
# !! Contents within this block are managed by 'conda init' !! # !! Contents within this block are managed by 'conda init' !!
If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") { If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
@ -140,19 +136,15 @@ If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
} }
#endregion #endregion
### Check Start Up ### ## Check Start Up ##
$SystemlogFilePath = "$env:USERPROFILE\.PowerShellStartup.log" $SystemlogFilePath = "$env:USERPROFILE\.PowerShellStartup.log"
# 检查日志文件是否存在 # 检查日志文件是否存在
if (-not (Test-Path $SystemlogFilePath)) { if (-not (Test-Path $SystemlogFilePath)) {
New-Item -Path $SystemlogFilePath -ItemType File -Force | Out-Null New-Item -Path $SystemlogFilePath -ItemType File -Force | Out-Null
} }
# 读取日志文件的最后一行(即上次启动日期) # 读取日志文件的最后一行(即上次启动日期)
$__lastStartup = Get-Content -Path $SystemlogFilePath -Tail 1 -ErrorAction SilentlyContinue $__lastStartup = Get-Content -Path $SystemlogFilePath -Tail 1 -ErrorAction SilentlyContinue
$_currentDate = (Get-Date).ToString("yyyy-MM-dd") $_currentDate = (Get-Date).ToString("yyyy-MM-dd")
if (-not ($__lastStartup -eq $_currentDate)) { if (-not ($__lastStartup -eq $_currentDate)) {
Get-Date Get-Date
Update-ForexData & Update-ForexData &
@ -160,3 +152,8 @@ if (-not ($__lastStartup -eq $_currentDate)) {
# 记录当前日期到日志文件 # 记录当前日期到日志文件
$_currentDate | Out-File -FilePath $SystemlogFilePath -Append $_currentDate | Out-File -FilePath $SystemlogFilePath -Append
} }
## Chocolatey ##
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" }

View file

@ -3,6 +3,14 @@
"$schema": "https://aka.ms/terminal-profiles-schema", "$schema": "https://aka.ms/terminal-profiles-schema",
"actions": "actions":
[ [
{
"command":
{
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
},
{ {
"command": "unbound", "command": "unbound",
"keys": "alt+shift+plus" "keys": "alt+shift+plus"
@ -39,22 +47,6 @@
"command": "unbound", "command": "unbound",
"keys": "alt+shift+left" "keys": "alt+shift+left"
}, },
{
"command":
{
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
},
{
"command":
{
"action": "moveFocus",
"direction": "up"
},
"keys": "ctrl+k"
},
{ {
"command": "paste", "command": "paste",
"keys": "ctrl+v" "keys": "ctrl+v"
@ -68,8 +60,12 @@
"keys": "ctrl+shift+k" "keys": "ctrl+shift+k"
}, },
{ {
"command": "find", "command":
"keys": "ctrl+shift+f" {
"action": "moveFocus",
"direction": "up"
},
"keys": "ctrl+k"
}, },
{ {
"command": "command":
@ -79,6 +75,10 @@
}, },
"keys": "ctrl+shift+h" "keys": "ctrl+shift+h"
}, },
{
"command": "find",
"keys": "ctrl+shift+f"
},
{ {
"command": "command":
{ {
@ -88,14 +88,6 @@
}, },
"keys": "alt+shift+d" "keys": "alt+shift+d"
}, },
{
"command":
{
"action": "splitPane",
"split": "right"
},
"keys": "alt+shift+/"
},
{ {
"command": "command":
{ {
@ -104,6 +96,14 @@
}, },
"keys": "ctrl+j" "keys": "ctrl+j"
}, },
{
"command":
{
"action": "splitPane",
"split": "right"
},
"keys": "alt+shift+/"
},
{ {
"command": "command":
{ {
@ -158,7 +158,9 @@
"font": "font":
{ {
"face": "CaskaydiaCove Nerd Font" "face": "CaskaydiaCove Nerd Font"
} },
"opacity": 95,
"useAcrylic": true
}, },
"list": "list":
[ [
@ -169,9 +171,10 @@
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"hidden": false, "hidden": false,
"name": "PowerShell", "name": "PowerShell",
"opacity": 100, "opacity": 30,
"scrollbarState": "hidden", "scrollbarState": "hidden",
"source": "Windows.Terminal.PowershellCore" "source": "Windows.Terminal.PowershellCore",
"useAcrylic": true
}, },
{ {
"guid": "{3c5d580b-1c52-55ce-89c9-57119457e5a7}", "guid": "{3c5d580b-1c52-55ce-89c9-57119457e5a7}",