mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
refractor: Reorganise dotfiles structures
This commit is contained in:
parent
2bd9138a5f
commit
bd5ca49c3e
131 changed files with 43 additions and 114 deletions
20
tools/zsh/.zshenv
Normal file
20
tools/zsh/.zshenv
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# ~/.zshenv
|
||||
# ln -s $DOTFILES/zsh/.zshenv $ZDOTDIR/.zshenv
|
||||
# This file is sourced by all zsh sessions upon startup.
|
||||
|
||||
# Use XDG Base Directory Specification
|
||||
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
|
||||
# Disable shell sessions on macOS when using default terminal
|
||||
SHELL_SESSIONS_DISABLE=1
|
||||
|
||||
# Zsh
|
||||
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
|
||||
50
tools/zsh/alias.zsh
Normal file
50
tools/zsh/alias.zsh
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# PowerShell Equivalent #
|
||||
alias ni=touch
|
||||
alias cls=clear
|
||||
alias ii=open
|
||||
|
||||
# Dev #
|
||||
alias g++='g++ -std=c++2b' # Set the default C++ standard to C++20
|
||||
alias gcc='gcc -std=c99' # Set the default C standard to C99
|
||||
alias cl='clang -std=c99'
|
||||
alias clpp='clang++ -std=c++2b'
|
||||
alias python=python3 # Set the default Python version to Python 3
|
||||
alias py=python # Alias for Python
|
||||
alias pip=pip3 # Alias for pip
|
||||
# alias bashcfg="nvim ~/.bashrc"
|
||||
alias zshcfg="nvim $ZDOTDIR/.zshrc"
|
||||
alias shcfg=zshcfg
|
||||
alias reload="source $ZDOTDIR/.zshrc"
|
||||
alias nvimrc="nvim $XDG_CONFIG_HOME/nvim/"
|
||||
alias ohmyzsh="code ~/.oh-my-zsh"
|
||||
alias pulldots="cd $DOTFILES && git pull"
|
||||
|
||||
# Conda #
|
||||
alias pyact="conda activate"
|
||||
alias pydact="conda deactivate"
|
||||
alias pylsenv="conda env list"
|
||||
alias pymkenv="conda create --name"
|
||||
|
||||
# Editors #
|
||||
alias v=nvim
|
||||
alias c=code
|
||||
|
||||
# lsd #
|
||||
alias ls='lsd -a'
|
||||
alias l='lsd -lah'
|
||||
# Misc #
|
||||
alias cf=cfiles
|
||||
|
||||
# Functions #
|
||||
mkcd() {
|
||||
mkdir -p $1 && cd $1
|
||||
}
|
||||
cdls(){
|
||||
cd $1 && ls
|
||||
}
|
||||
tc(){
|
||||
touch $1 && code $1
|
||||
}
|
||||
tv(){
|
||||
touch $1 && nvim $1
|
||||
}
|
||||
98
tools/zsh/config.zsh
Normal file
98
tools/zsh/config.zsh
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
# ZSH Config #
|
||||
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
||||
export PATH=$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH # Ruby Executables
|
||||
HIST_STAMPS="yyyy-mm-dd"
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
|
||||
export NVM_DIR="$HOME/.config/nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
||||
# plugins=(git web-search jsontools z vi-mode zsh-syntax-highlighting zsh-autosuggestions)
|
||||
|
||||
# Plugins (Manually Managed) #
|
||||
# $ZDOTDIR/plugins
|
||||
|
||||
# echo "[DEBUG] Loading plugins..."
|
||||
# echo $ZDOTDIR
|
||||
# Load zsh-syntax-highlighting before zsh-history-substring-search
|
||||
# Reference: https://github.com/zsh-users/zsh-history-substring-search?tab=readme-ov-file#usage
|
||||
source $ZDOTDIR/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
source $ZDOTDIR/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
source $ZDOTDIR/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
|
||||
# Tools Related Environment Variables #
|
||||
|
||||
PAGER="less"
|
||||
EDITOR="nvim"
|
||||
VISUAL="nvim"
|
||||
|
||||
# Use XDG Base Directory Specification #
|
||||
|
||||
# ~/.azure/ -> $XDG_DATA_HOME/azure/
|
||||
export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure
|
||||
# ~/.cargo/ -> $XDG_DATA_HOME/cargo
|
||||
export CARGO_HOME="$XDG_DATA_HOME"/cargo
|
||||
# ~/.cgdb/ -> $XDG_CONFIG_HOME/cgdb/
|
||||
export CGDB_DIR="$XDG_CONFIG_HOME"/cgdb
|
||||
# ~/.docker -> $XDG_CONFIG_HOME/docker
|
||||
export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
|
||||
# ~/.dotnet -> $XDG_DATA_HOME/dotnet
|
||||
# Not working
|
||||
# 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
|
||||
# ~/.inputrc -> $XDG_CONFIG_HOME/readline/inputrc
|
||||
export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
|
||||
# ~/.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
|
||||
# ~/.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
|
||||
# ~/,parallel -> $XDG_CONFIG_HOME/parallel
|
||||
export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel
|
||||
# ~/.python_history -> $XDG_DATA_HOME/python/history
|
||||
# Works only with Python 3.13.0a3 and later
|
||||
export PYTHON_HISTORY="$XDG_DATA_HOME"/python/history
|
||||
# ~/.screenrc -> $XDG_CONFIG_HOME/screen/screenrc
|
||||
export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
|
||||
# ~/.screen/ -> $XDG_RUNTIME_DIR/screen
|
||||
export SCREENDIR="${XDG_RUNTIME_DIR}/screen"
|
||||
# ~/.spacemacs/ -> $XDG_CONFIG_HOME/spacemacs
|
||||
export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs
|
||||
# ~/.tldrc/ -> $XDG_CACHE_HOME/tldr
|
||||
export TLDR_CACHE_DIR="$XDG_CACHE_HOME"/tldr
|
||||
# ~/.w3m -> $XDG_DATA_HOME/w3m
|
||||
export W3M_DIR="$XDG_DATA_HOME"/w3m
|
||||
# ~/.wakatime.cfg -> $XDG_CONFIG_HOME/wakatime.cfg
|
||||
# ~/.wakatime/ -> $XDG_CONFIG_HOME/wakatime/
|
||||
export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime"
|
||||
# ~/.wget-hsts -> $XDG_DATA_HOME/wget-hsts
|
||||
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
|
||||
# ~/.z -> $XDG_DATA_HOME/z
|
||||
export _Z_DATA="$XDG_DATA_HOME/z"
|
||||
# ~/.zcompdump* -> $XDG_CACHE_HOME/zsh/zcompdump*
|
||||
# compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
||||
# ~/.zsh_history -> $XDG_STATE_HOME/zsh/history
|
||||
export HISTFILE="$XDG_STATE_HOME"/zsh/history
|
||||
|
||||
# https://unix.stackexchange.com/questions/33994/
|
||||
# Use `set -k` to mark leading `#` as a comment character
|
||||
set -k
|
||||
23
tools/zsh/keymap.zsh
Normal file
23
tools/zsh/keymap.zsh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# $DOTFILES/keymap.zsh
|
||||
bindkey -v # Vi Keybindings
|
||||
|
||||
# Colemak hnei
|
||||
# bindkey -M vicmd 'h' vi-backward-char # No change
|
||||
bindkey -M vicmd 'n' down-line-or-history
|
||||
bindkey -M vicmd 'e' up-line-or-history
|
||||
bindkey -M vicmd 'i' vi-forward-char
|
||||
|
||||
# Similar position to [i] in QWERTY
|
||||
bindkey -M vicmd 'l' vi-insert
|
||||
bindkey -M vicmd 'L' vi-insert-bol
|
||||
# Ne{[k]s}t
|
||||
bindkey -M vicmd 'k' vi-repeat-search
|
||||
bindkey -M vicmd 'K' vi-rev-repeat-search
|
||||
# [J]ump
|
||||
bindkey -M vicmd 'j' vi-forward-word-end
|
||||
bindkey -M vicmd 'J' vi-forward-blank-word-end
|
||||
# Use N to Join
|
||||
bindkey -M vicmd 'N' vi-join
|
||||
|
||||
# Search History with [r]everse (default emacs keybinding)
|
||||
bindkey '^R' history-incremental-search-backward
|
||||
11
tools/zsh/navi.zsh
Normal file
11
tools/zsh/navi.zsh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
# Relative navigation
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
alias ......="cd ../../../../.."
|
||||
|
||||
function - { cd - }
|
||||
|
||||
eval "$(zoxide init zsh)"
|
||||
3
tools/zsh/prompt.zsh
Normal file
3
tools/zsh/prompt.zsh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export STARSHIP_CONFIG=$DOTFILES/.config/starship/starship_zsh.toml
|
||||
|
||||
eval "$(starship init zsh)"
|
||||
19
tools/zsh/update.sh
Normal file
19
tools/zsh/update.sh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# $DOTFILES/zsh/update.sh
|
||||
|
||||
# This file won't be sourced by zsh by default
|
||||
# Use `source` to run this file for updating plugins
|
||||
|
||||
# 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
|
||||
|
||||
if [ which brew > /dev/null ]; then
|
||||
brew update
|
||||
brew upgrade
|
||||
fi
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue