Signed-off-by: d0zingcat <iamtangli42@gmail.com>
This commit is contained in:
2025-03-06 16:47:27 +08:00
parent d4d819083c
commit 7c11184136
7 changed files with 295 additions and 191 deletions

2
.zshrc
View File

@@ -10,8 +10,6 @@ export PATH="$HOME/.local/bin:${HOME}/.krew/bin:$PATH"
export PATH="$PNPM_HOME:$PATH" export PATH="$PNPM_HOME:$PATH"
export PATH="$HOME/.docker/bin:$PATH" export PATH="$HOME/.docker/bin:$PATH"
export PATH=$PATH:$HOME/.spicetify export PATH=$PATH:$HOME/.spicetify
# Added by Windsurf
export PATH="/Users/d0zingcat/.codeium/windsurf/bin:$PATH"
export LC_ALL=en_US.UTF-8 export LC_ALL=en_US.UTF-8
export EDITOR=vim export EDITOR=vim

35
Brewfile Normal file
View File

@@ -0,0 +1,35 @@
tap "homebrew/bundle"
tap "homebrew/services"
brew "autojump"
brew "btop"
brew "difftastic"
brew "direnv"
brew "dosbox-staging"
brew "fzf"
brew "gcc"
brew "go"
brew "kubernetes-cli"
brew "kubectx"
brew "lsd"
brew "neovim"
brew "protobuf"
brew "redis", restart_service: :changed
brew "ripgrep"
brew "starship"
brew "tmux"
brew "uv"
brew "zsh"
cask "1password"
cask "chatgpt"
cask "cherry-studio"
cask "claude"
cask "cursor"
cask "datagrip"
cask "google-chrome"
cask "mac-mouse-fix"
cask "notion"
cask "orbstack"
cask "raycast"
cask "visual-studio-code@insiders"
cask "wezterm"
cask "windsurf"

34
nvim/lazy-lock.json Normal file
View File

@@ -0,0 +1,34 @@
{
"LazyVim": { "branch": "main", "commit": "ec5981dfb1222c3bf246d9bcaa713d5cfa486fbd" },
"blink.cmp": { "branch": "main", "commit": "dcda20d3aa345025699a920c45b0a0603551f41d" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"catppuccin": { "branch": "main", "commit": "5b5e3aef9ad7af84f463d17b5479f06b87d5c429" },
"conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" },
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
"gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" },
"grug-far.nvim": { "branch": "main", "commit": "3d39dc8b31d4ab7aad1b9ffdba136eafc6c7c360" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
"lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
"mini.ai": { "branch": "main", "commit": "6e01c0e5a15554852546fac9853960780ac52ed4" },
"mini.icons": { "branch": "main", "commit": "ec61af6e606fc89ee3b1d8f2f20166a3ca917a36" },
"mini.pairs": { "branch": "main", "commit": "1a3e73649c0eaef2f6c48ce1e761c6f0a7c11918" },
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
"nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" },
"nvim-lspconfig": { "branch": "master", "commit": "919f83ef8169d11eabd921a4cbda4fc1ba12f123" },
"nvim-treesitter": { "branch": "master", "commit": "1adcd5711929e44d1bc9e59fbf7d94656cf6d389" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "8b2d4d519f3516d09910f5baf48d1a47b594f0ce" },
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
"persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

10
nvim/lazyvim.json Normal file
View File

@@ -0,0 +1,10 @@
{
"extras": [
],
"install_version": 8,
"news": {
"NEWS.md": "10960"
},
"version": 8
}

214
setup.sh
View File

@@ -1,28 +1,22 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# Working environment: macOS/ArchLinux
set -x set -e
FILES=( FILES=(
.gitignore
.zshrc .zshrc
.tmux.conf .tmux.conf
.ideavimrc .ideavimrc
) )
CONFIG_FILES=( CONFIG_FILES=(
nvim
git git
nvim
tmux tmux
raycast
wezterm
pycodestyle pycodestyle
wezterm
starship.toml starship.toml
stylua.toml stylua.toml
direnv direnv
zed
) )
CUSTOM_FILES=( CUSTOM_FILES=(
@@ -31,41 +25,52 @@ CUSTOM_FILES=(
#"logseq .logseq" #"logseq .logseq"
) )
RUSTUP_COMPONENTS=(
clippy
)
KUBECTl_COMPONENTS=(
# ctx
# ns
# tail
# tree
# view-secret
# who-can
# cost
# neat
# sniff
# access-matrix
# pod-dive
# pod-chaos
# pod-lease
# pod-shell
# pod-logs
# pod-attach
# pod-exec
# pod-port-forward
)
WORKING_DIR=$(pwd) WORKING_DIR=$(pwd)
HOME_DIR="$HOME" HOME_DIR="$HOME"
UNAME_LINUX="Linux"
UNAME_MACOS="Darwin"
RELEASE_ARCH="Arch Linux"
RELEASE_UBUNTU="Ubuntu"
# install golang rustc cargo
# cargo install lsd
RELEASE_DEBIAN="Debian"
RELEASE_MANJARO="Manjaro Linux"
RELEASE_MACOS="macOS"
release_name=$(cat /etc/*release| egrep '^NAME=' | sed -E 's/.*"(.*)"/\1/')
is_brew_installed="$+commands[brew]" is_brew_installed="$+commands[brew]"
_uname=`uname`
is_linux=0
is_macos=0
if [ $_uname = $UNAME_LINUX ]
then
is_linux=1
fi
if [ $_uname = $UNAME_MACOS ] function command_exists() {
then # Check if a command exists
is_macos=1 # Usage: command_exists <command_name>
fi local cmd="$1"
if command -v "$cmd" >/dev/null 2>&1; then
return 0 # Command exists
else
return 1 # Command does not exist
fi
}
function init() { function init() {
sudo xcode-select --install sudo xcode-select --install
sudo xcodebuild -license accept sudo xcodebuild -license accept
k git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.0 git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.0
if [[ $(command -v brew) = "" ]]; then if [[ $(command -v brew) = "" ]]; then
echo "Installing brew" echo "Installing brew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@@ -98,48 +103,10 @@ function manual_install() {
} }
function backup() { function backup() {
if (( $is_brew_installed )) brew bundle dump -f
then
# brew backup
brew tap Homebrew/bundle
brew bundle dump -f
mv Brewfile .Brewfile."$(uname)."$(echo $(hostname) | cut -d '.' -f 1)
fi
if [ $is_linux -eq 1 ] && [ $release_name = $RELEASE_ARCH ]
then
pacman -Qqe > pkglist.txt
fi
} }
function recover() { function softLink() {
#softwareupdate --install-rosetta
OS="$(uname)"
# Homebrew
if [ ! $(which brew) ]; then
echo "Installing homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
if [ "$OS" = 'Darwin' ]; then
export PATH=/usr/local/bin/:$PATH
xcode-select --install
defaults write -g ApplePressAndHoldEnabled -bool false
elif [ "$OS" = 'Linux' ]; then
export PATH=/home/linuxbrew/.linuxbrew/bin/:$PATH
fi
# antigen
if [ ! -f $HOME/.antigen/antigen.zsh ]; then
mkdir -p $HOME/.antigen/
curl -L git.io/antigen >$HOME/.antigen/antigen.zsh
fi
mkdir -p $HOME/.kube/
mkdir $HOME/.ssh
mkdir $HOME/.config/
# dotfiles
cp ssh/example .ssh/config
echo "Linking files..." echo "Linking files..."
for i in ${FILES[@]}; do for i in ${FILES[@]}; do
ln -svfn $WORKING_DIR/$i $HOME_DIR/$i ln -svfn $WORKING_DIR/$i $HOME_DIR/$i
@@ -155,6 +122,33 @@ function recover() {
IFS=' ' read -r from to <<< "$row" IFS=' ' read -r from to <<< "$row"
ln -svfn $WORKING_DIR/$from $HOME_DIR/$to ln -svfn $WORKING_DIR/$from $HOME_DIR/$to
done done
}
function recover() {
#softwareupdate --install-rosetta
OS="$(uname)"
# Homebrew
if [ ! $(which brew) ]; then
echo "Installing homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
export PATH=/usr/local/bin/:$PATH
xcode-select --install
defaults write -g ApplePressAndHoldEnabled -bool false
# antigen
if [ ! -f $HOME/.antigen/antigen.zsh ]; then
mkdir -p $HOME/.antigen/
curl -L git.io/antigen >$HOME/.antigen/antigen.zsh
fi
mkdir -p $HOME/.kube/
mkdir $HOME/.ssh
mkdir $HOME/.config/
# dotfiles
cp ssh/example $HOME/.ssh/config
# submodules # submodules
echo 'Syncing Submodules...' echo 'Syncing Submodules...'
@@ -173,14 +167,7 @@ function recover() {
mv Brewfile .Brewfile.$suffix mv Brewfile .Brewfile.$suffix
fi fi
# if it is arch mkdir -p ~/.1password && ln -s ~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock ~/.1password/agent.sock
if [ $is_linux -eq 1 ] && [ $release_name = $RELEASE_ARCH ]
then
sudo pacman -S - < pkglist.txt
elif [ $is_macos -eq 1 ]
then
mkdir -p ~/.1password && ln -s ~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock ~/.1password/agent.sock
fi
# others # others
git config --global core.excludesfile ~/.config/git/.gitignore git config --global core.excludesfile ~/.config/git/.gitignore
@@ -188,21 +175,60 @@ function recover() {
$(brew --prefix)/opt/fzf/install $(brew --prefix)/opt/fzf/install
} }
function recover_rust() {
# install rustup
if ! command_exists rustup; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi
# cargo commands installation
for command in ${RUSTUP_COMPONENTS[@]}; do
if ! command_exists $command; then
rustup component add $command
fi
done
}
function recover_kubectl() {
# krew installation
if ! command_exists kubectl-krew; then
(
set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)
fi
# kubectl plugins installation
for plugin in ${KUBECTl_COMPONENTS[@]}; do
if ! command_exists $plugin; then
kubectl krew install $plugin
fi
done
}
function new_recover() {
# recover_rust
recover_kubectl
}
function post_recover() { function post_recover() {
mkdir -p ~/.1password && ln -s /Users/d0zingcat/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock /Users/d0zingcat/.1password/agent.sock mkdir -p ~/.1password && ln -s "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" ~/.1password/agent.sock
} }
option=$1 option=$1
case $option in case $option in
"") recover)
recover new_recover
;; ;;
uninstall) uninstall)
uninstall uninstall
;; ;;
*) backup)
backup backup
;; ;;
esac esac
exit 0 exit 0

View File

@@ -11,7 +11,7 @@ Host github.com
Port 443 Port 443
User git User git
# set to personal by default # set to personal by default
IdentityFile ~/.ssh/personal.pub IdentityFile ~/.ssh/Personal.pub
IdentitiesOnly yes IdentitiesOnly yes
# Personal # Personal
@@ -19,7 +19,7 @@ Host personalgit
Hostname ssh.github.com Hostname ssh.github.com
Port 443 Port 443
User git User git
IdentityFile ~/.ssh/personal.pub IdentityFile ~/.ssh/Personal.pub
IdentitiesOnly yes IdentitiesOnly yes
# Work # Work
@@ -27,5 +27,5 @@ Host workgit
Hostname ssh.github.com Hostname ssh.github.com
Port 443 Port 443
User git User git
IdentityFile ~/.ssh/work.pub IdentityFile ~/.ssh/Work.pub
IdentitiesOnly yes IdentitiesOnly yes

View File

@@ -1,94 +1,95 @@
local wezterm = require('wezterm') local wezterm = require("wezterm")
return { return {
default_cwd = wezterm.home_dir .. '/work', default_cwd = wezterm.home_dir .. "/work",
font_size = 14, font_size = 14,
font = wezterm.font_with_fallback({ font = wezterm.font_with_fallback({
'JetBrains Mono', "JetBrainsMono Nerd Font",
'JetBrainsMono Nerd Font Mono', "JetBrains Mono",
}), "JetBrainsMono Nerd Font Mono",
colors = { }),
tab_bar = { colors = {
active_tab = { tab_bar = {
bg_color = '#24283b', active_tab = {
fg_color = '#c0caf5', bg_color = "#24283b",
}, fg_color = "#c0caf5",
}, },
}, },
selection_word_boundary = " \t\n{}[]()\"'`=,.", },
use_fancy_tab_bar = true, selection_word_boundary = " \t\n{}[]()\"'`=,.",
-- hide_tab_bar_if_only_one_tab = true, use_fancy_tab_bar = true,
color_scheme = 'tokyonight', -- hide_tab_bar_if_only_one_tab = true,
window_decorations = "INTEGRATED_BUTTONS | RESIZE", color_scheme = "tokyonight",
window_frame = { window_decorations = "INTEGRATED_BUTTONS | RESIZE",
font_size = 14.0, window_frame = {
}, font_size = 14.0,
window_padding = { },
left = 5, window_padding = {
right = 5, left = 5,
top = 0, right = 5,
bottom = 0, top = 0,
}, bottom = 0,
foreground_text_hsb = { },
hue = 1.0, foreground_text_hsb = {
saturation = 1.0, hue = 1.0,
brightness = 1.2, saturation = 1.0,
}, brightness = 1.2,
use_ime = true, -- fix Chinese },
skip_close_confirmation_for_processes_named = { use_ime = true, -- fix Chinese
'fzf', skip_close_confirmation_for_processes_named = {
'zsh', "fzf",
'fzf', "zsh",
}, "fzf",
ssh_domains = { },
{ ssh_domains = {
name = 'debian', {
remote_address = 'debian01', name = "debian",
username = 'd0zingcat', remote_address = "debian01",
multiplexing = 'None', username = "d0zingcat",
}, multiplexing = "None",
}, },
keys = { },
--{ key = 'l', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|DOMAINS' } }) }, keys = {
--{ key = 's', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|WORKSPACES' } }) }, --{ key = 'l', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|DOMAINS' } }) },
{ key = 'e', mods = 'CMD', action = wezterm.action({ EmitEvent = 'window-visible-text' }) }, --{ key = 's', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|WORKSPACES' } }) },
{ key = 'l', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'DOMAINS' } }) }, { key = "e", mods = "CMD", action = wezterm.action({ EmitEvent = "window-visible-text" }) },
{ key = 'w', mods = 'CMD', action = wezterm.action({ CloseCurrentPane = { confirm = false } }) }, { key = "l", mods = "CMD", action = wezterm.action({ ShowLauncherArgs = { flags = "DOMAINS" } }) },
{ key = 'd', mods = 'CMD', action = wezterm.action({ SplitHorizontal = { domain = 'CurrentPaneDomain' } }) }, { key = "w", mods = "CMD", action = wezterm.action({ CloseCurrentPane = { confirm = false } }) },
{ { key = "d", mods = "CMD", action = wezterm.action({ SplitHorizontal = { domain = "CurrentPaneDomain" } }) },
key = 'd', {
mods = 'CMD|SHIFT', key = "d",
action = wezterm.action({ SplitVertical = { domain = 'CurrentPaneDomain' } }), mods = "CMD|SHIFT",
}, action = wezterm.action({ SplitVertical = { domain = "CurrentPaneDomain" } }),
{ },
key = '[', {
mods = 'CMD', key = "[",
action = wezterm.action({ ActivatePaneDirection = 'Next' }), mods = "CMD",
}, action = wezterm.action({ ActivatePaneDirection = "Next" }),
{ },
key = ']', {
mods = 'CMD', key = "]",
action = wezterm.action({ ActivatePaneDirection = 'Prev' }), mods = "CMD",
}, action = wezterm.action({ ActivatePaneDirection = "Prev" }),
{ },
key = '>', {
mods = 'CMD|SHIFT', key = ">",
action = wezterm.action.MoveTabRelative(1), mods = "CMD|SHIFT",
}, action = wezterm.action.MoveTabRelative(1),
{ },
key = '<', {
mods = 'CMD|SHIFT', key = "<",
action = wezterm.action.MoveTabRelative(-1), mods = "CMD|SHIFT",
}, action = wezterm.action.MoveTabRelative(-1),
{ key = 'Enter', mods = 'CMD', action = 'ToggleFullScreen' }, },
}, { key = "Enter", mods = "CMD", action = "ToggleFullScreen" },
-- hyperlink_rules = { },
-- { -- hyperlink_rules = {
-- regex = [[\b(https|http)://\S*\b]], -- {
-- format = '$0', -- regex = [[\b(https|http)://\S*\b]],
-- }, -- format = '$0',
-- { -- },
-- regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]], -- {
-- format = 'https://www.github.com/$1/$3', -- regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]],
-- } -- format = 'https://www.github.com/$1/$3',
-- } -- }
-- }
} }