Use XDG Standard

This commit is contained in:
js0ny 2024-11-01 12:16:59 +00:00
parent 270d7a9de8
commit fbe6495c85
17 changed files with 115 additions and 39 deletions

View file

@ -1,5 +1,5 @@
# ~/.config/conda/condarc.yaml
# New-Item -ItemType SymbolicLink -Path ~\.config\conda\.condarc -Target ~\.dotfiles\.config\conda\condarc.yaml
# mkdir -p ~/.config/conda/ && ln -s ~/.dotfiles/.config/conda/condarc.yaml ~/.config/conda/.condarc
# $XDG_CONFIG_HOME/conda/condarc.yaml
# New-Item -ItemType SymbolicLink -Path ~\.condarc -Target ~\.dotfiles\.config\conda\condarc.yaml
# ln -s $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc
# Reference: https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html
auto_activate_base: false

View file

@ -1,5 +1,6 @@
# ~/.gitconfig
# ln -sf ~/.dotfiles/.gitconfig ~/.gitconfig
# $XDG_CONFIG_HOME/git/config
# ln -sf $DOTFILES/.gitconfig $XDG_CONFIG_HOME/git/config
# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME/git/ -Value $DOTFILES\.config\git\config
[user]
name = js0ny
email = json.y@outlook.com

View file

@ -1,9 +1,28 @@
" ~/.config/ideavim/ideavimrc
" New-Item -ItemType SymbolicLink -Path ~\.config\ideavim/ideavimrc -Target ~\.dotfiles\.config/ideavim/ideavimrc
" ln -sf ~/.dotfiles/.config/ideavim/ideavimrc
"$XDG_CONFIG_HOME/ideavim/ideavimrc
" New-Item -ItemType SymbolicLink -Path ~\.ideavimrc -Target $DOTFILES\.config\ideavim\ideavimrc.vimrc
" ln -sf $DOTFILES/.config/ideavim/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc
""" Basic Configs """
let mapleader = " " " set <leader> to <space>
""" Colemak """
" Word wrap
noremap n gj
noremap e gk
noremap i l
" Similar position to i
noremap l i
noremap L I
" ne[k]st
noremap k n
noremap K N
" [j]ump
noremap j e
noremap J E
" Y to yank to end of line
noremap Y y$
""" Options """
" search for actions: :actionlist <patter>

View file

@ -4,5 +4,5 @@
- `j->e`, `k->n`, `h->h`, `l->i`
```sh
ln -s ~/.dotfiles/.config/nvim/ ~/.config/nvim
ln -s $DOTFILES/.config/nvim/ ~/.config/nvim
```

5
.config/pip/pip.conf Normal file
View file

@ -0,0 +1,5 @@
# $XDG_CONFIG_HOME/pip/pip.conf
# ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf
# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME/pip/pip.conp -Value $DOTFILES\.config\pip\pip.conf
[global]
# index-url = https://pypi.tuna.tsinghua.edu.cn/simple

24
.config/zellij/config.kdl Normal file
View file

@ -0,0 +1,24 @@
// ~/.config/zellij/config.kdl
// ln -sf $DOTFILES/.config/zellij/config.kdl ~.config/zellij/config.kdl
// https://zellij.dev/documentation/configuration
keybinds {
// keybinds are divided into modes
normal {
// bind instructions can include one or more keys (both keys will be bound separately)
// bind keys can include one or more actions (all actions will be performed with no sequential guarantees)
bind "Ctrl g" { SwitchToMode "locked"; }
bind "Ctrl p" { SwitchToMode "pane"; }
bind "Alt n" { NewPane; }
bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
}
pane {
bind "h" "Left" { MoveFocus "Left"; }
bind "i" "Right" { MoveFocus "Right"; }
bind "n" "Down" { MoveFocus "Down"; }
bind "e" "Up" { MoveFocus "Up"; }
bind "p" { SwitchFocus; }
}
locked {
bind "Ctrl g" { SwitchToMode "normal"; }
}
}

2
.npmrc
View file

@ -1,4 +1,4 @@
# ~/.npmrc
# New-Item -ItemType SymbolicLink -Path ~\.npmrc -Target ~\.dotfiles\.npmrc
# ln -s ~/.dotfiles/.npmrc ~/.npmrc
# ln -s $DOTFILES/.npmrc ~/.npmrc
# registry=https://registry.npmmirror.com

View file

@ -1,3 +0,0 @@
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
sudo rm -rf /opt/nvim
sudo tar -C /opt -xzf nvim-linux64.tar.gz

View file

@ -1,5 +1,5 @@
# ~/.config/zsh/.zshrc
# ln -s ~/.dotfiles/mac/.zshrc ~/.config/zsh/.zshrc
# ln -s $DOTFILES/mac/.zshrc ~/.config/zsh/.zshrc
### Variables ###
export DOTFILES="$HOME/.dotfiles"

View file

@ -2,12 +2,15 @@
# This script is used to setup a new mac
# Xcode Command Line Tools
echo [INFO] Installing Xcode Command Line Tools
xcode-select --install
# System Preferences
# Installation Sources
echo [INFO] Setting Installation Sources
sudo spctl --master-disable
## Finder
echo [INFO] Setting Finder Preferences
defaults write com.apple.finder QuitMenuItem -bool true # Quit with CMD+Q
defaults write com.apple.finder AppleShowAllFiles -bool false # Don't show Hidden Files
defaults write com.apple.finder ShowPathbar -bool true # Show Path Bar
@ -25,6 +28,7 @@ defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
killall Finder
## Dock
echo [INFO] Setting Dock Preferences
defaults write com.apple.dock persistent-apps -array
defaults write com.apple.dock persistent-others -array
defaults write com.apple.dock autohide -bool true # Autohide Dock
@ -38,19 +42,48 @@ defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
# Development #
### Dotfiles Setup ###
echo [INFO] Setting Up Dotfiles
export $DOTFILES="$HOME/.dotfiles"
git clone https://www.github.com/js0ny/dotfiles.git $DOTFILES
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
ln -s $DOTFILES/.condarc ~/.condarc
ln -s $DOTFILES/.gitconfig ~/.gitconfig
ln -s $DOTFILES/.haskeline ~/.haskeline
ln -s $DOTFILES/.ideavimrc ~/.ideavimrc
ln -s $DOTFILES/.tmux.conf ~/.tmux.conf
ln -sf $DOTFILES/zsh/.zshenv ~/.zshenv
echo [INFO] 'source ~/.zshenv' to use XDG_CONFIG_HOME
source ~/.zshenv
# export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
# export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
echo [INFO] Setting Up Oh-My-Zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
ln -sf $DOTFILES/zsh/.zshenv ~/.zshenv
ln -sf $DOTFILES/mac/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc
source $XDG_CONFIG_HOME/zsh/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting
source $XDG_CONFIG_HOME/zsh/.zshrc
echo [INFO] Setting Up dotfiles
mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/nvim $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
mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory
ln -sf $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc
ln -sf $DOTFILES/.config/git/config $XDG_CONFIG_HOME/git/config
ln -sf $DOTFILES/.haskeline ~/.haskeline
ln -sf $DOTFILES/.ideavimrc ~/.ideavimrc
ln -sf $DOTFILES/.tmux.conf ~/.tmux.conf
ln -sf $DOTFILES/.config/markdownlint/.markdownlintrc.json $XDG_CONFIG_HOME/markdownlint/markdownlintrc.json
ln -sf $DOTFILES/.config/zellij/config.kdl ~/.config/zellij/config.kdl
ln -sf $DOTFILES/.npmrc ~/.npmrc
ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf
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
ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode.vimrc
# Brew
echo [INFO] Installing Homebrew
echo [ACTION] Request Human Input
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo [INFO] Installing Brew Packages
brew install mas # Mac App Store CLI
# File Management
brew install --cask keka # Archive
brew install --cask keka # Archiver
brew install --cask google-drive # Cloud Storage
# CLI
@ -64,12 +97,16 @@ brew install --formula ripgrep
brew install --formula tmux
brew install --formula tree
brew install --formula pandoc
brew install --formula zellij # Better Tmux for me
# Editors
brew install --cask visual-studio-code
brew install --formula neovim
brew install --formula neovide
# IDE
brew install --cask qt-creator
# Programming Languages
brew install --formula lua
brew install --formula luajit
@ -97,6 +134,8 @@ brew install --cask squirrel
# PKM
brew install --cask obsidian
brew install --cask typora
brew install --cask notion
brew install --cask notion-calendar
# Media
brew install --cask iina
@ -111,7 +150,7 @@ brew install --cask ltspice
brew install --cask mactex-no-gui
# Browser
brew install --cask arc
brew install --cask vivaldi
brew install --cask firefox@nightly
# Fonts
@ -140,12 +179,3 @@ brew install --cask telegram-desktop
mas install 836500024 # WeChat
mas install 451108668 # QQ
# Oh My Zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sudo rm -rf ~/.zshrc
mkdir -p ~/.config/zsh
ln -s $DOTFILES/zsh/.zshenv ~/.zshenv
ln -s $DOTFILES/mac/.zshrc ~/.config/zsh/.zshrc
source ~/.config/zsh/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting

View file

@ -1,5 +1,7 @@
# ~/.config/neovide/config.toml
# ln -sf ~/.dotfiles/mac/neovide.toml ~/.config/neovide/config.toml
# $XDG_CONFIG_HOME/neovide/config.toml
# ln -sf $DOTFILES/mac/neovide.toml $XDG_CONFIG_HOME/neovide/config.toml
# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME/neovide/config.toml -Value $DOTFILES\mac\neovide.toml (Mac)
# https://neovide.dev/config-file.html?highlight=toml#config-file
fork = false
frame = "full"
idle = true

View file

@ -1,2 +0,0 @@
[global]
# index-url = https://pypi.tuna.tsinghua.edu.cn/simple

View file

@ -1,6 +1,6 @@
" ~/.config/vscode/vscode.vimrc
" New-Item -ItemType SymbolicLink -Path ~\.config\vscode\vscode.vimrc -Target ~\.dotfiles\vscode\vscode.vimrc
" mkdir -p ~/.config/vscode && ln -sf ~/.dotfiles/vscode/vscode.vimrc ~/.config/vscode/vscode.vimrc
" ln -sf $DOTFILES/vscode/vscode.vimrc ~/.config/vscode/vscode.vimrc
" And go to vscode vim setting:
"vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc",

View file

@ -1,5 +1,5 @@
# ~/.config/zsh/.zshrc
# ln -s ~/.dotfiles/wsl/.zshrc ~/.config/zsh/.zshrc
# ln -s $DOTFILES/wsl/.zshrc ~/.config/zsh/.zshrc
### Variables ###
export DOTFILES="$HOME/.dotfiles"

View file

@ -1,5 +1,5 @@
# ~/.zshenv
# ln -s ~/.dotfiles/zsh/.zshenv ~/.zshenv
# ln -s $DOTFILES/zsh/.zshenv ~/.zshenv
# This file is sourced by all zsh sessions upon startup.
# Use XDG Base Directory Specification

View file

@ -1,4 +1,4 @@
# ~/.dotfiles/keymap.zsh
# $DOTFILES/keymap.zsh
bindkey -v # Vi Keybindings
# Colemak hnei