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

View file

@ -48,7 +48,13 @@ ${function:doku} = { Set-Location -Path ~\MyDocuments && Get-ChildItem }
# Shell Equivalents #
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 #
@ -63,20 +69,20 @@ ${function:csi} = { dotnet script }
# C & C++ #
Set-Alias "cl" "clang"
Set-Alias "clpp" "clang++"
Set-Alias "clang" "clang -std=c99"
Set-Alias "clang++" "clang++ -std=c++2b"
# Set-Alias "cl" "clang"
# Set-Alias "clpp" "clang++"
# ${function:clang} = { clang -std=c99 $args[0] }
# ${function:clang++} = { clang -std=c++2b $args[0] }
# Python & Conda #
Set-Alias "python3" "python"
Set-Alias "pip3" "pip"
Set-Alias "py" "python"
Set-Alias "pyact" "conda activate"
Set-Alias "pylsenv" "conda env list"
Set-Alias "pydeact" "conda deactivate"
Set-Alias "pymkenv" "conda create --name"
${function:pyact} = { conda activate $args[0] }
${function:pylsenvs} = { conda env list }
${function:pydact} = { conda deactivate }
${function:pymkenv} = { conda create --name $args[0] }
# # Git #
@ -106,33 +112,23 @@ Set-Alias "gvi" "neovide"
# Miscs #
Set-Alias mcd CreateAndSet-Directory
### Functions ###
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 mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname}
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 }
### 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 CompletionPredictor
### Misc ###
## Conda ##
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
@ -140,19 +136,15 @@ If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
}
#endregion
### Check Start Up ###
## Check Start Up ##
$SystemlogFilePath = "$env:USERPROFILE\.PowerShellStartup.log"
# 检查日志文件是否存在
if (-not (Test-Path $SystemlogFilePath)) {
New-Item -Path $SystemlogFilePath -ItemType File -Force | Out-Null
}
# 读取日志文件的最后一行(即上次启动日期)
$__lastStartup = Get-Content -Path $SystemlogFilePath -Tail 1 -ErrorAction SilentlyContinue
$_currentDate = (Get-Date).ToString("yyyy-MM-dd")
if (-not ($__lastStartup -eq $_currentDate)) {
Get-Date
Update-ForexData &
@ -160,3 +152,8 @@ if (-not ($__lastStartup -eq $_currentDate)) {
# 记录当前日期到日志文件
$_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",
"actions":
[
{
"command":
{
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
},
{
"command": "unbound",
"keys": "alt+shift+plus"
@ -39,22 +47,6 @@
"command": "unbound",
"keys": "alt+shift+left"
},
{
"command":
{
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
},
{
"command":
{
"action": "moveFocus",
"direction": "up"
},
"keys": "ctrl+k"
},
{
"command": "paste",
"keys": "ctrl+v"
@ -68,8 +60,12 @@
"keys": "ctrl+shift+k"
},
{
"command": "find",
"keys": "ctrl+shift+f"
"command":
{
"action": "moveFocus",
"direction": "up"
},
"keys": "ctrl+k"
},
{
"command":
@ -79,6 +75,10 @@
},
"keys": "ctrl+shift+h"
},
{
"command": "find",
"keys": "ctrl+shift+f"
},
{
"command":
{
@ -88,14 +88,6 @@
},
"keys": "alt+shift+d"
},
{
"command":
{
"action": "splitPane",
"split": "right"
},
"keys": "alt+shift+/"
},
{
"command":
{
@ -104,6 +96,14 @@
},
"keys": "ctrl+j"
},
{
"command":
{
"action": "splitPane",
"split": "right"
},
"keys": "alt+shift+/"
},
{
"command":
{
@ -158,7 +158,9 @@
"font":
{
"face": "CaskaydiaCove Nerd Font"
}
},
"opacity": 95,
"useAcrylic": true
},
"list":
[
@ -169,9 +171,10 @@
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"hidden": false,
"name": "PowerShell",
"opacity": 100,
"opacity": 30,
"scrollbarState": "hidden",
"source": "Windows.Terminal.PowershellCore"
"source": "Windows.Terminal.PowershellCore",
"useAcrylic": true
},
{
"guid": "{3c5d580b-1c52-55ce-89c9-57119457e5a7}",