diff --git a/.zshrc b/.zshrc index c0a59b8..23ade61 100644 --- a/.zshrc +++ b/.zshrc @@ -10,8 +10,6 @@ export PATH="$HOME/.local/bin:${HOME}/.krew/bin:$PATH" export PATH="$PNPM_HOME:$PATH" export PATH="$HOME/.docker/bin:$PATH" export PATH=$PATH:$HOME/.spicetify -# Added by Windsurf -export PATH="/Users/d0zingcat/.codeium/windsurf/bin:$PATH" export LC_ALL=en_US.UTF-8 export EDITOR=vim diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..be0f6b7 --- /dev/null +++ b/Brewfile @@ -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" diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..0eba382 --- /dev/null +++ b/nvim/lazy-lock.json @@ -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" } +} diff --git a/nvim/lazyvim.json b/nvim/lazyvim.json new file mode 100644 index 0000000..6206f7e --- /dev/null +++ b/nvim/lazyvim.json @@ -0,0 +1,10 @@ +{ + "extras": [ + + ], + "install_version": 8, + "news": { + "NEWS.md": "10960" + }, + "version": 8 +} \ No newline at end of file diff --git a/setup.sh b/setup.sh index 4b7776f..7a84e95 100755 --- a/setup.sh +++ b/setup.sh @@ -1,28 +1,22 @@ #!/usr/bin/env zsh -# Working environment: macOS/ArchLinux -set -x +set -e + FILES=( - .gitignore - .zshrc - .tmux.conf .ideavimrc - ) CONFIG_FILES=( - nvim git + nvim tmux - raycast - wezterm pycodestyle + wezterm starship.toml stylua.toml direnv - zed ) CUSTOM_FILES=( @@ -31,41 +25,52 @@ CUSTOM_FILES=( #"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) 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]" -_uname=`uname` -is_linux=0 -is_macos=0 -if [ $_uname = $UNAME_LINUX ] -then - is_linux=1 -fi -if [ $_uname = $UNAME_MACOS ] -then - is_macos=1 -fi +function command_exists() { + # Check if a command exists + # Usage: command_exists + 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() { sudo xcode-select --install 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 echo "Installing brew" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" @@ -98,48 +103,10 @@ function manual_install() { } function backup() { - if (( $is_brew_installed )) - 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 + brew bundle dump -f } -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 - 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 +function softLink() { echo "Linking files..." for i in ${FILES[@]}; do ln -svfn $WORKING_DIR/$i $HOME_DIR/$i @@ -155,6 +122,33 @@ function recover() { IFS=' ' read -r from to <<< "$row" ln -svfn $WORKING_DIR/$from $HOME_DIR/$to 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 echo 'Syncing Submodules...' @@ -173,14 +167,7 @@ function recover() { mv Brewfile .Brewfile.$suffix fi - # if it is arch - 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 + mkdir -p ~/.1password && ln -s ~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock ~/.1password/agent.sock # others git config --global core.excludesfile ~/.config/git/.gitignore @@ -188,21 +175,60 @@ function recover() { $(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() { - 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 case $option in - "") - recover - ;; - uninstall) - uninstall - ;; - *) - backup - ;; + recover) + new_recover + ;; + uninstall) + uninstall + ;; + backup) + backup + ;; esac exit 0 diff --git a/ssh/example b/ssh/example index 89cbb25..396a3d0 100644 --- a/ssh/example +++ b/ssh/example @@ -11,7 +11,7 @@ Host github.com Port 443 User git # set to personal by default - IdentityFile ~/.ssh/personal.pub + IdentityFile ~/.ssh/Personal.pub IdentitiesOnly yes # Personal @@ -19,7 +19,7 @@ Host personalgit Hostname ssh.github.com Port 443 User git - IdentityFile ~/.ssh/personal.pub + IdentityFile ~/.ssh/Personal.pub IdentitiesOnly yes # Work @@ -27,5 +27,5 @@ Host workgit Hostname ssh.github.com Port 443 User git - IdentityFile ~/.ssh/work.pub + IdentityFile ~/.ssh/Work.pub IdentitiesOnly yes diff --git a/wezterm/wezterm.lua b/wezterm/wezterm.lua index 97cd838..0bfa3ff 100644 --- a/wezterm/wezterm.lua +++ b/wezterm/wezterm.lua @@ -1,94 +1,95 @@ -local wezterm = require('wezterm') +local wezterm = require("wezterm") return { - default_cwd = wezterm.home_dir .. '/work', - font_size = 14, - font = wezterm.font_with_fallback({ - 'JetBrains Mono', - 'JetBrainsMono Nerd Font Mono', - }), - colors = { - tab_bar = { - active_tab = { - bg_color = '#24283b', - fg_color = '#c0caf5', - }, - }, - }, - selection_word_boundary = " \t\n{}[]()\"'`=,.", - use_fancy_tab_bar = true, - -- hide_tab_bar_if_only_one_tab = true, - color_scheme = 'tokyonight', - window_decorations = "INTEGRATED_BUTTONS | RESIZE", - window_frame = { - font_size = 14.0, - }, - window_padding = { - left = 5, - right = 5, - top = 0, - bottom = 0, - }, - foreground_text_hsb = { - hue = 1.0, - saturation = 1.0, - brightness = 1.2, - }, - use_ime = true, -- fix Chinese - skip_close_confirmation_for_processes_named = { - 'fzf', - 'zsh', - 'fzf', - }, - ssh_domains = { - { - name = 'debian', - remote_address = 'debian01', - username = 'd0zingcat', - multiplexing = 'None', - }, - }, - keys = { - --{ key = 'l', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|DOMAINS' } }) }, - --{ key = 's', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|WORKSPACES' } }) }, - { key = 'e', mods = 'CMD', action = wezterm.action({ EmitEvent = 'window-visible-text' }) }, - { key = 'l', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'DOMAINS' } }) }, - { 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', - action = wezterm.action({ SplitVertical = { domain = 'CurrentPaneDomain' } }), - }, - { - key = '[', - mods = 'CMD', - action = wezterm.action({ ActivatePaneDirection = 'Next' }), - }, - { - key = ']', - mods = 'CMD', - action = wezterm.action({ ActivatePaneDirection = 'Prev' }), - }, - { - key = '>', - mods = 'CMD|SHIFT', - action = wezterm.action.MoveTabRelative(1), - }, - { - key = '<', - mods = 'CMD|SHIFT', - action = wezterm.action.MoveTabRelative(-1), - }, - { key = 'Enter', mods = 'CMD', action = 'ToggleFullScreen' }, - }, - -- hyperlink_rules = { - -- { - -- regex = [[\b(https|http)://\S*\b]], - -- format = '$0', - -- }, - -- { - -- regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]], - -- format = 'https://www.github.com/$1/$3', - -- } - -- } + default_cwd = wezterm.home_dir .. "/work", + font_size = 14, + font = wezterm.font_with_fallback({ + "JetBrainsMono Nerd Font", + "JetBrains Mono", + "JetBrainsMono Nerd Font Mono", + }), + colors = { + tab_bar = { + active_tab = { + bg_color = "#24283b", + fg_color = "#c0caf5", + }, + }, + }, + selection_word_boundary = " \t\n{}[]()\"'`=,.", + use_fancy_tab_bar = true, + -- hide_tab_bar_if_only_one_tab = true, + color_scheme = "tokyonight", + window_decorations = "INTEGRATED_BUTTONS | RESIZE", + window_frame = { + font_size = 14.0, + }, + window_padding = { + left = 5, + right = 5, + top = 0, + bottom = 0, + }, + foreground_text_hsb = { + hue = 1.0, + saturation = 1.0, + brightness = 1.2, + }, + use_ime = true, -- fix Chinese + skip_close_confirmation_for_processes_named = { + "fzf", + "zsh", + "fzf", + }, + ssh_domains = { + { + name = "debian", + remote_address = "debian01", + username = "d0zingcat", + multiplexing = "None", + }, + }, + keys = { + --{ key = 'l', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|DOMAINS' } }) }, + --{ key = 's', mods = 'CMD', action = wezterm.action({ ShowLauncherArgs = { flags = 'FUZZY|WORKSPACES' } }) }, + { key = "e", mods = "CMD", action = wezterm.action({ EmitEvent = "window-visible-text" }) }, + { key = "l", mods = "CMD", action = wezterm.action({ ShowLauncherArgs = { flags = "DOMAINS" } }) }, + { 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", + action = wezterm.action({ SplitVertical = { domain = "CurrentPaneDomain" } }), + }, + { + key = "[", + mods = "CMD", + action = wezterm.action({ ActivatePaneDirection = "Next" }), + }, + { + key = "]", + mods = "CMD", + action = wezterm.action({ ActivatePaneDirection = "Prev" }), + }, + { + key = ">", + mods = "CMD|SHIFT", + action = wezterm.action.MoveTabRelative(1), + }, + { + key = "<", + mods = "CMD|SHIFT", + action = wezterm.action.MoveTabRelative(-1), + }, + { key = "Enter", mods = "CMD", action = "ToggleFullScreen" }, + }, + -- hyperlink_rules = { + -- { + -- regex = [[\b(https|http)://\S*\b]], + -- format = '$0', + -- }, + -- { + -- regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]], + -- format = 'https://www.github.com/$1/$3', + -- } + -- } }