From 1cc7bae198e7fe22ef246e97a6e2936857bdd2b9 Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 13 Nov 2024 03:10:20 +0000 Subject: [PATCH] reorg --- .config/lesskey | 2 +- {mac => setup}/mac_setup.sh | 26 +++----------------- setup/set_symblink_unix.sh | 22 +++++++++++++++++ win/setup_win.ps1 => setup/win_setup.ps1 | 1 - zsh/.zshenv | 4 +++- zsh/config.zsh | 30 ++++++++++++++++++++---- 6 files changed, 55 insertions(+), 30 deletions(-) rename {mac => setup}/mac_setup.sh (86%) create mode 100644 setup/set_symblink_unix.sh rename win/setup_win.ps1 => setup/win_setup.ps1 (99%) diff --git a/.config/lesskey b/.config/lesskey index 150eebe..c497024 100644 --- a/.config/lesskey +++ b/.config/lesskey @@ -1,6 +1,6 @@ # $XDG_CONFIG_HOME/lesskey -- less options # ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey -# Ne +# work for less -V > 582, for mac, use brew install less to override the system less # Format: key action diff --git a/mac/mac_setup.sh b/setup/mac_setup.sh similarity index 86% rename from mac/mac_setup.sh rename to setup/mac_setup.sh index d4cf396..78ea0d0 100644 --- a/mac/mac_setup.sh +++ b/setup/mac_setup.sh @@ -1,8 +1,8 @@ -#! /bin/zsh +#! /bin/sh # This script is used to setup a new mac # In a new mac (Sequoia) # Enter the following command in the terminal -#! curl -fsSL https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/mac/mac_setup.sh | sh +#! curl -fsSL https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/setup/mac_setup.sh | sh # Do not use this command echo "Running the setup script" @@ -80,30 +80,10 @@ rm -f ~/.zshrc ~/.zprofile ~/.zsh_history ~/.zshenv rm -rf ~/.zsh_sessions echo "[INFO] Setting Up dotfiles" -mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm -mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory -mkdir -p $WAKATIME_HOME -mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view -# $DOTFILES/.config -ln -sf $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc -ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config -ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc -ln -sf $DOTFILES/.config/markdownlint/.markdownlint.json $XDG_CONFIG_HOME/markdownlint/markdownlint.json -ln -sf $DOTFILES/.config/npm/npmrc $NPM_CONFIG_USERCONFIG -ln -sf $DOTFILES/.config/NuGet/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config -ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim -ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf -ln -sf $DOTFILES/.config/tmux/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf -ln -sf $DOTFILES/.config/vim/vimrc $XDG_CONFIG_HOME/vim/vimrc -ln -sf $DOTFILES/.config/zellij/config.kdl ~/.config/zellij/config.kdl -ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey +. $DOTFILES/setup/set_symblink_unix.sh # $DOTFILES/mac ln -sf $DOTFILES/mac/neovide.toml $XDG_CONFIG_HOME/neovide/config.toml ln -sf $DOTFILES/mac/Microsoft.PowerShell_profile.ps1 $XDG_CONFIG_HOME/powershell/Microsoft.PowerShell_profile.ps1 -# $DOTFILES/vscode -ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode.vimrc -# $DOTFILES root -ln -sf $DOTFILES/.haskeline ~/.haskeline # Brew echo "[INFO] Installing Homebrew" diff --git a/setup/set_symblink_unix.sh b/setup/set_symblink_unix.sh new file mode 100644 index 0000000..c038b3e --- /dev/null +++ b/setup/set_symblink_unix.sh @@ -0,0 +1,22 @@ +#! /bin/sh +mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm +mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory +mkdir -p $WAKATIME_HOME +mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view +# $DOTFILES/.config +ln -sf $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc +ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config +ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc +ln -sf $DOTFILES/.config/markdownlint/.markdownlint.json $XDG_CONFIG_HOME/markdownlint/markdownlint.json +ln -sf $DOTFILES/.config/npm/npmrc $NPM_CONFIG_USERCONFIG +ln -sf $DOTFILES/.config/NuGet/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config +ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim +ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf +ln -sf $DOTFILES/.config/tmux/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf +ln -sf $DOTFILES/.config/vim/vimrc $XDG_CONFIG_HOME/vim/vimrc +ln -sf $DOTFILES/.config/zellij/config.kdl ~/.config/zellij/config.kdl +ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey +# $DOTFILES/vscode +ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode.vimrc +# $DOTFILES root +ln -sf $DOTFILES/.haskeline ~/.haskeline \ No newline at end of file diff --git a/win/setup_win.ps1 b/setup/win_setup.ps1 similarity index 99% rename from win/setup_win.ps1 rename to setup/win_setup.ps1 index 78097c5..492f9d4 100644 --- a/win/setup_win.ps1 +++ b/setup/win_setup.ps1 @@ -1,6 +1,5 @@ #!C:\Program Files\WindowsApps\Microsoft.PowerShell_7.4.6.0_x64__8wekyb3d8bbwe\pwsh.EXE # Run with PowerShell 7 -# Use PowerShell as Administrator winget install -e --id Git.Git git clone https://github.com/js0ny/dotfiles.git ~\.dotfiles Set-Location -Path ~\.dotfiles diff --git a/zsh/.zshenv b/zsh/.zshenv index 1a78651..9c83239 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,5 +1,5 @@ # ~/.zshenv -# ln -s $DOTFILES/zsh/.zshenv ~/.zshenv +# ln -s $DOTFILES/zsh/.zshenv $ZDOTDIR/.zshenv # This file is sourced by all zsh sessions upon startup. # Use XDG Base Directory Specification @@ -16,3 +16,5 @@ export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" # Also put in /etc/zsh/zshenv # or /etc/zshenv in macOS +# sudo cp $DOTFILES/zsh/.zshenv /etc/zsh/zshenv +# sudo cp $DOTFILES/zsh/.zshenv /etc/zshenv diff --git a/zsh/config.zsh b/zsh/config.zsh index d29813e..a647393 100644 --- a/zsh/config.zsh +++ b/zsh/config.zsh @@ -25,16 +25,38 @@ source .private.env.sh # Use XDG Base Directory Specification +# ~/.azure/ -> $XDG_DATA_HOME/azure/ +export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure +# ~/.cgdb/ -> $XDG_CONFIG_HOME/cgdb/ +export CGDB_DIR="$XDG_CONFIG_HOME"/cgdb +# ~/.nv -> $XDG_CACHE_HOME/nv (CUDA) +# macOS does not have Cuda; Check if CUDA is installed +if [ "$(uname)" != "Darwin" ] && [ -d "/usr/local/cuda" ]; then + export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv +fi +# ~/.docker -> $XDG_CONFIG_HOME/docker +export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker # ~/.dotnet -> $XDG_DATA_HOME/dotnet export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet # ~/.gnupg -> $XDG_CONFIG_HOME/gnupg export GNUPGHOME="$XDG_DATA_HOME"/gnupg # ~/go -> $XDG_DATA_HOME/go export GOPATH="$XDG_DATA_HOME"/go -# ~/.node_repl_history -> $XDG_STATE_HOME/node/repl_history -export NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/repl_history -# ~/.npmrc -> $XDG_CONFIG_HOME/npm/npmrc -export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc +# ~/.juliaup/ -> $XDG_DATA_HOME/julia/ +export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH" +# Check if node is installed +if command -v node > /dev/null; then + # ~/.node_repl_history -> $XDG_STATE_HOME/node/repl_history + export NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/repl_history + # ~/.ts_node_repl_history -> $XDG_STATE_HOME/node/ts_node_repl_history + export TS_NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/ts_node_repl_history + # ~/.npmrc -> $XDG_CONFIG_HOME/npm/npmrc + export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc + # ~/.npm -> $XDG_CACHE_HOME/npm + export NPM_CONFIG_INIT_MODULE="$XDG_CONFIG_HOME"/npm/config/npm-init.js + export NPM_CONFIG_CACHE="$XDG_CACHE_HOME"/npm + export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR"/npm +fi # ~/.python_history -> $XDG_DATA_HOME/python/history # Works only with Python 3.13.0a3 and later export PYTHON_HISTORY="$XDG_DATA_HOME"/python/history