mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 00:33:00 +00:00
chezmoi: reorganise repo
This commit is contained in:
parent
b391e03c87
commit
67a78879db
278 changed files with 102 additions and 182 deletions
|
|
@ -1,9 +0,0 @@
|
|||
$PSHistPath = (Get-PSReadlineOption).HistorySavePath
|
||||
|
||||
if (Test-Path $PSHistPath) {
|
||||
$PSHist = Get-Content $PSHistPath
|
||||
$PSHist | Group-Object | Sort-Object Count -Descending | Select-Object -First 10 Count, Name
|
||||
}
|
||||
else {
|
||||
Write-Host "No history file found."
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Rename files with a specified extension in a folder, padding the numeric part with zeros.
|
||||
.PARAMETER ext
|
||||
The extension of the files to rename, without the dot. Default is "md".
|
||||
.PARAMETER Numeral
|
||||
If specified, the files will be renamed in the order of their numeric part.
|
||||
.EXAMPLE
|
||||
Rename-FilesWithZeroPadding.ps1 -ext "txt"
|
||||
Renames all files with the extension "txt" in the current folder, padding the numeric part with zeros.
|
||||
For example: '1.txt', '2.txt', ... '12.txt' -> '01.txt', '02.txt', ... '12.txt'.
|
||||
.EXAMPLE
|
||||
Rename-FilesWithZeroPadding.ps1 -Numeral # This set the Numeral switch to false
|
||||
Renames all files with the default extension "md" in the current folder, in the order of their filenames.
|
||||
For example: 'file1.md', 'file2.md', ... 'file12.md' -> '01.md', '02.md', ... '12.md'.
|
||||
#>
|
||||
param(
|
||||
[string]$ext = "md",
|
||||
[switch]$Numeral
|
||||
)
|
||||
if ($Numeral) {
|
||||
$files = $files | Sort-Object { [int]($_.BaseName -replace '\D', '') }
|
||||
}
|
||||
else {
|
||||
$files = Get-ChildItem -Filter "*.$ext" | Sort-Object Name
|
||||
$fnamecnt = 1
|
||||
}
|
||||
$cnt = $files.Count
|
||||
|
||||
$paddingLength = $cnt.ToString().Length
|
||||
|
||||
foreach ($file in $files) {
|
||||
if ($Numeral) {
|
||||
$number = [int]($file.BaseName -replace '\D', '')
|
||||
$newNumber = $number.ToString().PadLeft($paddingLength, '0')
|
||||
$newName = "$newNumber.$ext"
|
||||
}
|
||||
else {
|
||||
$newName = ($fnamecnt++).ToString().PadLeft($paddingLength, '0') + ".$ext"
|
||||
}
|
||||
|
||||
Rename-Item -Path $file.FullName -NewName $newName
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
function CsvToMarkdown {
|
||||
param( [string]$csv)
|
||||
$counter = 0
|
||||
$column = $csv.Split("`n")[0].Split(",").Length
|
||||
$aHeader = " --- |"
|
||||
$header = "|" + $aHeader * $column
|
||||
$csv.replace(",", " | ").Split("`n") | ForEach-Object {
|
||||
if ($counter -eq 0) {
|
||||
Write-Output "| $_ |"
|
||||
$counter++
|
||||
Write-Output $header
|
||||
}
|
||||
else {
|
||||
Write-Output "| $_ |"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
yabai --start-service
|
||||
skhd --start-service
|
||||
brew services start sketchybar
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
yabai --stop-service
|
||||
skhd --stop-service
|
||||
brew services stop sketchybar
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
curl https://raw.githubusercontent.com/SpaceAceMonkey/dotenv-for-fish/refs/heads/main/dotenv.fish -o "$CHEZMOI_SOURCE_DIR/dot_config/fish/functions/dotenv.fish"
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env pwsh
|
||||
|
||||
Install-Package PSFzf -Force
|
||||
Install-Package CompletionPredictor -Force
|
||||
|
||||
git clone --depth 1 https://github.com/catppuccin/powershell.git (Join-Path $Env:PSModulePath.Split(':')[0] Catppuccin)
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
ya pkg add llanosrocas/yaziline
|
||||
ya pkg add yazi-rs/plugins:git
|
||||
ya pkg add Rolv-Apneseth/starship
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
||||
|
||||
test -d "$XDG_CONFIG_HOME/zsh/plugins/zsh-autosuggestions" || git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git "$XDG_CONFIG_HOME/zsh/plugins/zsh-autosuggestions"
|
||||
test -d "$XDG_CONFIG_HOME/zsh/plugins/zsh-syntax-highlighting" || git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git "$XDG_CONFIG_HOME/zsh/plugins/zsh-syntax-highlighting"
|
||||
test -d "$XDG_CONFIG_HOME/zsh/plugins/zsh-history-substring-search" || git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git "$XDG_CONFIG_HOME/zsh/plugins/zsh-history-substring-search"
|
||||
test -d "$XDG_CONFIG_HOME/zsh/plugins/zsh-completions" || git clone --depth 1 https://github.com/zsh-users/zsh-completions.git "$XDG_CONFIG_HOME/zsh/plugins/zsh-completions"
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
||||
|
||||
if [ -f /etc/zshenv ]; then
|
||||
sudo cp "$CHEZMOI_SOURCE_DIR/dot_config/zsh/global.zshenv" /etc/zshenv
|
||||
fi
|
||||
|
||||
if [ -f /etc/zsh/zshenv ]; then
|
||||
sudo cp "$CHEZMOI_SOURCE_DIR/dot_config/zsh/global.zshenv" /etc/zsh/zshenv
|
||||
fi
|
||||
|
||||
mkdir -p $XDG_STATE_HOME/zsh
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
#!/bin/zsh
|
||||
# $DOTFILES/scripts/update.zsh
|
||||
# call by `update` alias defined in tools/zsh/alias.zsh
|
||||
# 使用别名 `update` 引用,别名定义于 tools/zsh/alias.zsh
|
||||
|
||||
# Plugins #
|
||||
# Auto `git pull` on $ZDOTDIR/plugins
|
||||
for plugin in $ZDOTDIR/plugins/*; do
|
||||
if [ -d "$plugin" ]; then
|
||||
cd $plugin
|
||||
git pull --quiet --no-edit
|
||||
fi
|
||||
done
|
||||
|
||||
# Update package managers #
|
||||
# Homebrew, macOS
|
||||
if command -v brew >/dev/null 2>&1; then
|
||||
brew update
|
||||
brew upgrade
|
||||
fi
|
||||
|
||||
# Arch
|
||||
if command -v pacman >/dev/null 2>&1; then
|
||||
sudo pacman -Syu
|
||||
fi
|
||||
|
||||
# Debian
|
||||
if command -v apt >/dev/null 2>&1; then
|
||||
sudo apt update
|
||||
sudo apt upgrade
|
||||
fi
|
||||
|
||||
# Fedora
|
||||
if command -v dnf >/dev/null 2>&1; then
|
||||
sudo dnf update
|
||||
fi
|
||||
|
||||
# WSL
|
||||
if command -v winget.exe >/dev/null 2>&1; then
|
||||
winget.exe upgrade
|
||||
fi
|
||||
|
||||
# macOS - Rime
|
||||
if [ $(uname) = "Darwin" ]; then
|
||||
bash ~/plum/rime-install
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue