mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
chezmoi: reorganise repo
This commit is contained in:
parent
b391e03c87
commit
67a78879db
278 changed files with 102 additions and 182 deletions
0
home/dot_config/fish/completions/.keep
Normal file
0
home/dot_config/fish/completions/.keep
Normal file
176
home/dot_config/fish/conf.d/0init.fish
Normal file
176
home/dot_config/fish/conf.d/0init.fish
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
# $DOTFILES/tools/fish/conf.d/0init.fish
|
||||
# Date: 2024-12-19
|
||||
# Author: js0ny
|
||||
# By dictionary order, this file is sourced first in fish shell
|
||||
# Define user-specific environment variables for fish
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/0init.fish (default location)
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
|
||||
set -gx DOTFILES $HOME/.dotfiles
|
||||
# XDG Base Directory Specification
|
||||
set -gx XDG_CONFIG_HOME (set -q XDG_CONFIG_HOME; and echo $XDG_CONFIG_HOME; or echo $HOME/.config)
|
||||
set -gx XDG_DATA_HOME (set -q XDG_DATA_HOME; and echo $XDG_DATA_HOME; or echo $HOME/.local/share)
|
||||
set -gx XDG_STATE_HOME (set -q XDG_STATE_HOME; and echo $XDG_STATE_HOME; or echo $HOME/.local/state)
|
||||
set -gx XDG_CACHE_HOME (set -q XDG_CACHE_HOME; and echo $XDG_CACHE_HOME; or echo $HOME/.local/cache)
|
||||
|
||||
if test (uname) = "Darwin"
|
||||
set -gx XDG_RUNTIME_DIR $HOME/.tmp/run/
|
||||
else
|
||||
set -gx XDG_RUNTIME_DIR /run/user/(id -u)
|
||||
end
|
||||
|
||||
set -gx GHCUP_USE_XDG_DIRS 1
|
||||
|
||||
set -gx PAGER "less -R"
|
||||
set -gx EDITOR nvim
|
||||
set -gx VISUAL nvim
|
||||
|
||||
# Minimal PATH for early commands
|
||||
for dir in /usr/local/bin /usr/bin /bin /usr/sbin /sbin "$HOME/.local/bin" /opt/share/bin
|
||||
if test -d "$dir" -a ! -L "$dir"
|
||||
fish_add_path "$dir"
|
||||
end
|
||||
end
|
||||
|
||||
# Homebrew/Linuxbrew
|
||||
test -d /opt/homebrew/bin && fish_add_path /opt/homebrew/bin
|
||||
test -d /home/linuxbrew/.linuxbrew/bin && fish_add_path /home/linuxbrew/.linuxbrew/bin
|
||||
|
||||
if command -v brew > /dev/null
|
||||
set -gx HOMEBREW_NO_ENV_HINTS
|
||||
end
|
||||
|
||||
# Azure CLI
|
||||
if command -v az > /dev/null
|
||||
set -gx AZURE_CONFIG_DIR $XDG_DATA_HOME/azure
|
||||
end
|
||||
# Bun JS
|
||||
if command -v bun > /dev/null
|
||||
set -gx BUN_INSTALL "$XDG_DATA_HOME/bun"
|
||||
set -gx PATH $BUN_INSTALL/bin $PATH
|
||||
end
|
||||
# Rust Cargo
|
||||
if command -v cargo > /dev/null
|
||||
set -gx CARGO_HOME $XDG_DATA_HOME/cargo
|
||||
set -gx PATH $CARGO_HOME/bin $PATH
|
||||
end
|
||||
# CGDB
|
||||
if command -v cgdb > /dev/null
|
||||
set -gx CGDB_DIR $XDG_CONFIG_HOME/cgdb
|
||||
end
|
||||
# .NET
|
||||
if command -v dotnet > /dev/null
|
||||
set -gx DOTNET_CLI_HOME $XDG_DATA_HOME/dotnet
|
||||
set -gx PATH $DOTNET_CLI_HOME/.dotnet/tools $PATH
|
||||
end
|
||||
# Docker
|
||||
if command -v docker > /dev/null
|
||||
set -gx DOCKER_CONFIG $XDG_CONFIG_HOME/docker
|
||||
end
|
||||
# GnuPG
|
||||
if command -v gpg > /dev/null
|
||||
set -gx GNUPGHOME $XDG_DATA_HOME/gnupg
|
||||
end
|
||||
# Go
|
||||
if command -v go > /dev/null
|
||||
set -gx GOPATH $XDG_DATA_HOME/go
|
||||
set PATH $GOPATH/bin $PATH
|
||||
end
|
||||
# Julia
|
||||
if command -v julia > /dev/null
|
||||
set -gx JULIA_DEPOT_PATH $XDG_DATA_HOME/julia
|
||||
end
|
||||
# Node.js
|
||||
if command -v node > /dev/null
|
||||
set -gx NODE_REPL_HISTORY $XDG_STATE_HOME/node/repl_history
|
||||
set -gx TS_NODE_REPL_HISTORY $XDG_STATE_HOME/node/ts_repl_history
|
||||
set -gx NPM_CONFIG_USERCONFIG $XDG_CONFIG_HOME/npm/npmrc
|
||||
set -gx NPM_CONFIG_INIT_MODULE $XDG_CONFIG_HOME/npm/config/npm-init.js
|
||||
set -gx NPM_CONFIG_CACHE $XDG_CACHE_HOME/npm
|
||||
set -gx NPM_CONFIG_TMP $XDG_RUNTIME_DIR/npm
|
||||
end
|
||||
# Parallel
|
||||
if command -v parallel > /dev/null
|
||||
set -gx PARALLEL_CONFIG $XDG_CONFIG_HOME/parallel
|
||||
end
|
||||
# Python
|
||||
# Works only with Python 3.13.0a3 and later
|
||||
if command -v python3 > /dev/null
|
||||
set -gx PYTHON_HISTORY $XDG_DATA_HOME/python/history
|
||||
end
|
||||
# GNU Screen
|
||||
if command -v screen > /dev/null
|
||||
set -gx SCREENRC $XDG_CONFIG_HOME/screen/screenrc
|
||||
set -gx SCREENDIR $XDG_RUNTIME_DIR/screen
|
||||
end
|
||||
# Ruby Gem
|
||||
if command -v gem > /dev/null
|
||||
for dir in $HOME/.local/share/gem/ruby/*/bin
|
||||
if test -d $dir
|
||||
set -gx PATH $dir $PATH
|
||||
end
|
||||
end
|
||||
set -gx PATH $HOME/.local/share/gem/ruby/3.3.0/bin $PATH
|
||||
end
|
||||
# Spacemacs
|
||||
if command -v emacs > /dev/null
|
||||
set -gx SPACEMACSDIR $XDG_CONFIG_HOME/spacemacs
|
||||
end
|
||||
# tldr
|
||||
if command -v tldr > /dev/null
|
||||
set -gx TLDR_CACHE_DIR $XDG_CACHE_HOME/tldr
|
||||
end
|
||||
# W3M
|
||||
if command -v w3m > /dev/null
|
||||
set -gx W3M_DIR $XDG_DATA_HOME/w3m
|
||||
end
|
||||
# Wakatime
|
||||
if command -v wakatime > /dev/null
|
||||
set -gx WAKATIME_HOME $XDG_CONFIG_HOME/wakatime
|
||||
end
|
||||
# Wget
|
||||
if command -v wget > /dev/null
|
||||
alias wget="wget --hsts-file=$XDG_CACHE_HOME/wget-hsts"
|
||||
end
|
||||
# z
|
||||
if command -v z > /dev/null
|
||||
set -gx _Z_DATA $XDG_DATA_HOME/z
|
||||
end
|
||||
if command -v tldr > /dev/null
|
||||
set -gx TLDR_CACHE_DIR $XDG_CACHE_HOME/tldr
|
||||
end
|
||||
if status is-interactive
|
||||
if command -v ipython > /dev/null
|
||||
set IPYTHONDIR $XDG_CONFIG_HOME/ipython
|
||||
end
|
||||
end
|
||||
|
||||
if command -v opam > /dev/null
|
||||
set OPAMROOT $XDG_DATA_HOME/opam
|
||||
test -r $OPAMROOT/opam-init/init.fish && source $OPAMROOT/opam-init/init.fish > /dev/null 2> /dev/null; or true
|
||||
end
|
||||
|
||||
# Coursier: Scala dependency manager
|
||||
if command -v coursier > /dev/null
|
||||
set -gx PATH "$PATH:$XDG_DATA_HOME/coursier/bin"
|
||||
end
|
||||
# pnpm
|
||||
set -gx PNPM_HOME "$XDG_DATA_HOME/pnpm"
|
||||
if not string match -q -- $PNPM_HOME $PATH
|
||||
set -gx PATH "$PNPM_HOME" $PATH
|
||||
end
|
||||
# pnpm end
|
||||
|
||||
test -d /opt/miniconda3 && source /opt/miniconda3/etc/fish/conf.d/conda.fish
|
||||
|
||||
test -f /opt/miniconda3/etc/fish/conf.d/conda.fish && source /opt/miniconda3/etc/fish/conf.d/conda.fish
|
||||
|
||||
# User-specific PATH
|
||||
test -d $HOME/.local/scripts && fish_add_path $HOME/.local/scripts
|
||||
test -d $HOME/.local/build && fish_add_path $HOME/.local/build
|
||||
|
||||
source "/home/js0ny/.deno/env.fish"
|
||||
179
home/dot_config/fish/conf.d/alias.fish
Normal file
179
home/dot_config/fish/conf.d/alias.fish
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
# $DOTFILES/tools/fish/conf.d/alias.fish
|
||||
# Date: 2024-12-22
|
||||
# Author: js0ny
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/alias.fish
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
|
||||
switch (uname)
|
||||
case "Darwin"
|
||||
# macOS Specific
|
||||
#abbr --add clip pbcopy
|
||||
#abbr --add paste pbpaste
|
||||
alias clip="pbcopy"
|
||||
alias paste="pbpaste"
|
||||
# Use GNU Coreutils
|
||||
alias cp=gcp
|
||||
alias ln=gln
|
||||
alias mkdir=gmkdir
|
||||
alias mv=gmv
|
||||
alias rm=grm
|
||||
alias rmdir=grmdir
|
||||
alias touch=gtouch
|
||||
alias clip=pbcopy
|
||||
alias paste=pbpaste
|
||||
alias sed=gsed
|
||||
abbr --add reboot "sudo reboot"
|
||||
case "Linux"
|
||||
# Linux Specific
|
||||
#switch($XDG_SESSION_TYPE)
|
||||
#case "wayland"
|
||||
# Wayland Specific
|
||||
alias clip="wl-copy"
|
||||
alias paste="wl-paste"
|
||||
#case "x11"
|
||||
# # X11 Specific
|
||||
# alias clip="xclip -selection clipboard"
|
||||
# alias paste="xclip -selection clipboard -o"
|
||||
case '*'
|
||||
# Default / Fallback case
|
||||
alias clip="xclip -selection clipboard"
|
||||
alias paste="xclip -selection clipboard -o"
|
||||
end
|
||||
|
||||
# Powershell equivalent
|
||||
abbr --add ni touch
|
||||
abbr --add cls clear
|
||||
abbr --add ii open
|
||||
|
||||
# Editors #
|
||||
abbr --add v nvim
|
||||
abbr --add c code
|
||||
alias svi="sudo vim -u ~/.dotfiles/common/vim.noxdg.vimrc" # Prevent conflicts with svelte-cli
|
||||
|
||||
# Dev #
|
||||
abbr --add py python3
|
||||
abbr --add ipy ipython
|
||||
|
||||
abbr --add g lazygit
|
||||
|
||||
abbr --add aic "aichat -s"
|
||||
|
||||
# lsd - modern ls
|
||||
if command -v lsd > /dev/null
|
||||
alias ls='lsd'
|
||||
abbr --add l 'lsd -lah'
|
||||
abbr --add ll 'lsd -l'
|
||||
abbr --add la 'lsd -A'
|
||||
abbr --add l. 'lsd -d .*'
|
||||
abbr --add tree 'ls --tree'
|
||||
else
|
||||
abbr --add l 'ls -lah'
|
||||
abbr --add ll 'ls -l'
|
||||
end
|
||||
|
||||
# Functions #
|
||||
function mkcd
|
||||
mkdir -p $argv[1] && cd $argv[1]
|
||||
end
|
||||
function cdls
|
||||
cd $argv[1] && ls
|
||||
end
|
||||
function tc
|
||||
touch $argv[1] && code $argv[1]
|
||||
end
|
||||
function tv
|
||||
touch $argv[1] && nvim $argv[1]
|
||||
end
|
||||
|
||||
# Create a new file, if the directory does not exist, create it
|
||||
# Arg: a file name
|
||||
function mt
|
||||
mkdir -p (dirname $argv[1]) && touch $argv[1]
|
||||
end
|
||||
|
||||
function mtv
|
||||
mkdir -p (dirname $argv[1]) && touch $argv[1] && nvim $argv[1]
|
||||
end
|
||||
|
||||
abbr --add bcat "bat --style=plain"
|
||||
|
||||
# Use neovide as gVim
|
||||
abbr --add gvi "neovide"
|
||||
|
||||
if command -v brew > /dev/null
|
||||
abbr --add brewi "brew install"
|
||||
abbr --add brewu "brew upgrade && brew update"
|
||||
abbr --add brewr "brew remove"
|
||||
abbr --add brewc "brew cleanup"
|
||||
abbr --add brewl "brew list"
|
||||
end
|
||||
|
||||
if command -v pacman > /dev/null
|
||||
abbr --add pac "sudo pacman"
|
||||
abbr --add paci "sudo pacman -S"
|
||||
abbr --add pacr "sudo pacman -R"
|
||||
abbr --add pacu "sudo pacman -Syu"
|
||||
abbr --add pacl "pacman -Q"
|
||||
if command -v paru > /dev/null
|
||||
abbr --add pacs "paru -Ss"
|
||||
else if command -v yay > /dev/null
|
||||
abbr --add pacs "yay -Ss"
|
||||
else
|
||||
abbr --add pacs "pacman -Ss"
|
||||
end
|
||||
end
|
||||
|
||||
if command -v apt > /dev/null
|
||||
abbr --add apt "sudo apt"
|
||||
abbr --add apti "sudo apt install"
|
||||
abbr --add aptr "sudo apt remove"
|
||||
abbr --add aptu "sudo apt update && sudo apt upgrade"
|
||||
abbr --add apts "apt search"
|
||||
abbr --add aptl "apt list --installed"
|
||||
end
|
||||
|
||||
|
||||
if command -v dnf > /dev/null
|
||||
abbr --add dnf "sudo dnf"
|
||||
abbr --add dnfi "sudo dnf install"
|
||||
abbr --add dnfr "sudo dnf remove"
|
||||
abbr --add dnfu "sudo dnf update"
|
||||
abbr --add dnfs "dnf search"
|
||||
abbr --add dnfl "dnf list --installed"
|
||||
end
|
||||
|
||||
if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty"
|
||||
abbr --add icat "kitten icat"
|
||||
else if test "$TERM_PROGRAM" = "WezTerm"
|
||||
if test "$WSL_DISTRO_NAME"
|
||||
abbr --add icat "wezterm.exe imgcat"
|
||||
else
|
||||
abbr --add icat "wezterm imgcat"
|
||||
end
|
||||
end
|
||||
|
||||
# Bash Style Command Substitution
|
||||
# https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$)
|
||||
|
||||
function __last_history_item; echo $history[1]; end
|
||||
|
||||
abbr -a !! --position anywhere --function __last_history_item
|
||||
|
||||
function y
|
||||
set tmp (mktemp -t "yazi-cwd.XXXXXX")
|
||||
yazi $argv --cwd-file="$tmp"
|
||||
if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
||||
builtin cd -- "$cwd"
|
||||
end
|
||||
rm -f -- "$tmp"
|
||||
end
|
||||
|
||||
abbr --add bcnt "emacs -nw $HOME/Documents/Finance/Beancount/"
|
||||
|
||||
if command -v chezmoi > /dev/null
|
||||
alias pmoi="chezmoi --source ~/.local/share/pmoi --config ~/.config/chezmoi/pmoi.toml"
|
||||
end
|
||||
18
home/dot_config/fish/conf.d/colorscheme.fish
Normal file
18
home/dot_config/fish/conf.d/colorscheme.fish
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
switch (uname)
|
||||
case "Linux"
|
||||
set SYSTEM_COLOR_SCHEME (gsettings get org.gnome.desktop.interface color-scheme)
|
||||
if test $SYSTEM_COLOR_SCHEME = "'prefer-dark'"
|
||||
fish_config theme choose "Catppuccin Mocha"
|
||||
else
|
||||
fish_config theme choose "Catppuccin Latte"
|
||||
end
|
||||
case "Darwin"
|
||||
set SYSTEM_COLOR_SCHEME (defaults read -g AppleInterfaceStyle)
|
||||
if test $SYSTEM_COLOR_SCHEME = "Dark"
|
||||
fish_config theme choose "Catppuccin Mocha"
|
||||
else
|
||||
fish_config theme choose "Catppuccin Latte"
|
||||
end
|
||||
case '*'
|
||||
fish_config theme choose "Catppuccin Mocha"
|
||||
end
|
||||
49
home/dot_config/fish/conf.d/keymap.fish
Normal file
49
home/dot_config/fish/conf.d/keymap.fish
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# $DOTFILES/tools/fish/conf.d/keymap.fish
|
||||
# Date: 2024-12-22
|
||||
# Author: js0ny
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/keymap.fish
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
|
||||
# read key: `fish_key_reader`
|
||||
# get current bindings: `bind`
|
||||
|
||||
fish_vi_key_bindings
|
||||
|
||||
# source $DOTFILES/tools/fish/conf.d/keymap/+colemak.fish
|
||||
|
||||
# Emacs Hybrid
|
||||
bind -M default ctrl-p up-or-search
|
||||
bind -M default ctrl-n down-or-search
|
||||
bind -M default ctrl-f forward-char
|
||||
bind -M default ctrl-b backward-char
|
||||
bind -M default ctrl-a beginning-of-line
|
||||
bind -M default ctrl-e end-of-line
|
||||
bind -M default ctrl-k kill-line
|
||||
|
||||
bind -M insert ctrl-p up-or-search
|
||||
bind -M insert ctrl-n down-or-search
|
||||
bind -M insert ctrl-f forward-char
|
||||
bind -M insert ctrl-b backward-char
|
||||
bind -M insert ctrl-a beginning-of-line
|
||||
bind -M insert ctrl-e end-of-line
|
||||
bind -M insert ctrl-k kill-line
|
||||
bind -M insert ctrl-w backward-kill-path-component
|
||||
|
||||
|
||||
# ctrl + backspace
|
||||
bind -M insert ctrl-backspace backward-kill-path-component
|
||||
# alt + backspace
|
||||
bind -M insert alt-backspace backward-kill-line
|
||||
# ctrl + delete
|
||||
bind -M insert ctrl-delete kill-word
|
||||
# alt + delete (d$)
|
||||
bind -M insert alt-delete kill-line
|
||||
|
||||
fzf --fish | source
|
||||
# C-r : fzf history search
|
||||
# C-t : fzf file search
|
||||
# A-c : fzf directory search
|
||||
23
home/dot_config/fish/conf.d/keymap/+colemak.fish
Normal file
23
home/dot_config/fish/conf.d/keymap/+colemak.fish
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Colemak hnei
|
||||
# ^
|
||||
# e
|
||||
# < h i >
|
||||
# n
|
||||
# v
|
||||
# bind -M default 'h' backward-char
|
||||
bind -M default n down-or-search
|
||||
bind -M default e up-or-search
|
||||
bind -M default i forward-char
|
||||
|
||||
# Similar position to [i] in QWERTY
|
||||
bind -M default -m insert l repaint-mode
|
||||
bind -M default -m insert L beginning-of-line repaint-mode
|
||||
|
||||
# Ne{[k]s}t -> fish doesnt have this feature
|
||||
|
||||
# [J]ump
|
||||
bind -M default j forward-word
|
||||
bind -M default J forward-bigword
|
||||
|
||||
# Use N to Join
|
||||
bind -M default N end-of-line delete-char
|
||||
47
home/dot_config/fish/conf.d/navi.fish
Normal file
47
home/dot_config/fish/conf.d/navi.fish
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# $DOTFILES/tools/fish/conf.d/navi.fish
|
||||
# Date: 2024-12-22
|
||||
# Author: js0ny
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/navi.fish
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
set __CD_CMD "cd"
|
||||
|
||||
|
||||
if command -v zoxide > /dev/null
|
||||
set __CD_CMD "z"
|
||||
zoxide init fish | source
|
||||
end
|
||||
|
||||
|
||||
alias ..="$__CD_CMD .."
|
||||
alias ...="$__CD_CMD ../.."
|
||||
alias ....="$__CD_CMD ../../.."
|
||||
alias .....="$__CD_CMD ../../../.."
|
||||
alias ......="$__CD_CMD ../../../../.."
|
||||
|
||||
abbr --add \- "$__CD_CMD -"
|
||||
|
||||
|
||||
function zls
|
||||
$__CD_CMD $argv[1] && ls
|
||||
end
|
||||
|
||||
alias cdls=zls
|
||||
|
||||
function __source_quick_jump
|
||||
set dir (fd --type d --max-depth 1 . ~/Source/ | fzf --preview 'lsd --color always --icon always {}')
|
||||
if test -n "$dir"
|
||||
cd "$dir"
|
||||
end
|
||||
end
|
||||
# Quick Jump Directories
|
||||
test -d $DOTFILES && abbr --add dot "$__CD_CMD $DOTFILES"
|
||||
test -d $HOME/Downloads && abbr --add down "$__CD_CMD $HOME/Downloads"
|
||||
test -d $HOME/.config && abbr --add conf "$__CD_CMD $HOME/.config"
|
||||
test -d $HOME/Obsidian && abbr --add ob "$__CD_CMD $HOME/Obsidian"
|
||||
test -d $HOME/Source && alias src="__source_quick_jump"
|
||||
test -d $HOME/Source/Scripts && alias scr="fd --type f --hidden --exclude .git --exclude '.*' . ~/Source/Scripts/ | fzf --preview 'bat --color=always --style=numbers {}' | xargs -r nvim"
|
||||
test -d $HOME/OrgFiles && abbr --add org "$__CD_CMD $HOME/OrgFiles"
|
||||
13
home/dot_config/fish/conf.d/prompt.fish
Normal file
13
home/dot_config/fish/conf.d/prompt.fish
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# $DOTFILES/tools/fish/conf.d/prompt.fish
|
||||
# Date: 2024-12-22
|
||||
# Author: js0ny
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/prompt.fish
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
if command -v starship > /dev/null
|
||||
starship init fish | source
|
||||
end
|
||||
|
||||
13
home/dot_config/fish/conf.d/winterop.fish
Normal file
13
home/dot_config/fish/conf.d/winterop.fish
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
if command -v wslpath > /dev/null
|
||||
function cdw
|
||||
cd (wslpath -u $argv)
|
||||
end
|
||||
function zw
|
||||
z (wslpath -u $argv)
|
||||
end
|
||||
alias psw="tasklist.exe"
|
||||
alias killw="taskkill.exe"
|
||||
alias winget="winget.exe"
|
||||
# https://github.com/stuartleeks/wsl-notify-send
|
||||
alias notify-send="wsl-notify-send.exe"
|
||||
end
|
||||
22
home/dot_config/fish/config.fish
Normal file
22
home/dot_config/fish/config.fish
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# $DOTFILES/tools/fish/config.fish
|
||||
# Date: 2024-12-15
|
||||
# Author: js0ny
|
||||
# Define interactive shell configurations for fish
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/config.fish (default location)
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
if status is-interactive
|
||||
# Commands to run in interactive sessions can go here
|
||||
set fish_greeting
|
||||
end
|
||||
|
||||
# bun
|
||||
set --export BUN_INSTALL "$HOME/.bun"
|
||||
set --export PATH $BUN_INSTALL/bin $PATH
|
||||
|
||||
# moonbit
|
||||
fish_add_path "$HOME/.moon/bin"
|
||||
|
||||
0
home/dot_config/fish/functions/.keep
Normal file
0
home/dot_config/fish/functions/.keep
Normal file
73
home/dot_config/fish/functions/dotenv.fish
Normal file
73
home/dot_config/fish/functions/dotenv.fish
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
function dotenv
|
||||
# Parses commend-line arguments and sets _flag_[xuh] variables. Complains if the user tries to use both -x and -u.
|
||||
argparse --name=dotenv -x 'u,x' 'u/unset' 'h/help' 'x/export' 'q/quiet' -- $argv
|
||||
|
||||
# If the h or --help flags are set (both can be checked using _flag_h), display help, and ignore everything else.
|
||||
if test $_flag_h
|
||||
__help_dotenv
|
||||
else
|
||||
# Any non-option command-line arguments are assumed to be .env files, so we check to see if any are present.
|
||||
if set -q argv; and test (count $argv) -gt 0
|
||||
set env_files $argv
|
||||
# If no environment files are specified on the command-line, we default to .env
|
||||
else
|
||||
set env_files .env
|
||||
end
|
||||
# Loop through all of the specified environment variable files and set any variables found within
|
||||
for env_file in $env_files
|
||||
if test -r $env_file
|
||||
while read -l line
|
||||
# Set variables to be global, otherwise they will not be available in your shell once this script
|
||||
# has finished running.
|
||||
set set_args "-g"
|
||||
|
||||
# Remove the "export" directive from the line if present, and set a variable indicating whether or
|
||||
# not it was found. Negate the return value of "string replace" so that 1/true means we found the
|
||||
# export directive. This makes its usage easier to follow in subsequent lines.
|
||||
set trimmed_line (not string replace -r '^\s*export\s+' '' -- $line)
|
||||
set export $status
|
||||
|
||||
# If we found the export directive in the previous step, or if -x/--export was specified on the
|
||||
# command-line, set the export flag for the upcoming 'set' command.
|
||||
if test $export -eq 1; or begin; set -q _flag_x; and test "$_flag_x" = "-x"; end;
|
||||
set set_args "$set_args"x
|
||||
end
|
||||
|
||||
# Check to see if the line we are processing is basically sane. The fish set command will ignore
|
||||
# leading white space on the variable name, so we allow it in our check.
|
||||
if string match -q --regex -- '^\s*[a-zA-Z0-9_]+=' "$trimmed_line"
|
||||
# Split the current line into name and value, and store them in $kv. We use -m1 because we only
|
||||
# want to split on the first "=" we encounter. Everything after that, including additional "="
|
||||
# characters, is part of the value.
|
||||
set kv (string split -m 1 = -- $trimmed_line)
|
||||
# If -u/--unset has been specified, erase the variable.
|
||||
if set -q _flag_u; and test "$_flag_u" = "-u"
|
||||
set -e $kv[1]
|
||||
# Otherwise, set the shell variable. The variable $kv contains both the name and the value we
|
||||
# want to set.
|
||||
else
|
||||
set $set_args $kv
|
||||
end
|
||||
end
|
||||
# Combined with the `while` keyword, this reads $env_file one line at a time.
|
||||
end <$env_file
|
||||
else
|
||||
if not set -q _flag_q; or test "$_flag_q" != '-q'
|
||||
echo "Unable to locate file $env_file"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# This function will be available to be called directly from the shell, even though it is defined inside of dotenv.
|
||||
# I put it into its own function because I think it looks a little cleaner than having a big blob of echoes inside
|
||||
# the "if" statement near the top of this function.
|
||||
function __help_dotenv
|
||||
echo "Usage: dotenv [-u] [files]"
|
||||
echo "-h/--help: Display this help message."
|
||||
echo "-u/--unset: Read [files] and unset the variables found therein."
|
||||
echo "-x/--export: Force variables to be exported, regardless of whether or not they are preceded by 'export' in the env file."
|
||||
echo "[files]: One or more files containing name=value pairs to be read into the environment. Defaults to .env."
|
||||
echo ""
|
||||
end
|
||||
end
|
||||
29
home/dot_config/fish/readme.md
Normal file
29
home/dot_config/fish/readme.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
|
||||
|
||||
|
||||
## `type -q` vs `command -v`
|
||||
|
||||
```shell
|
||||
> time for i in (seq 1 10000)
|
||||
type -q vim
|
||||
end
|
||||
|
||||
time for i in (seq 1 10000)
|
||||
command -v vim >/dev/null
|
||||
end
|
||||
|
||||
|
||||
________________________________________________________
|
||||
Executed in 545.79 millis fish external
|
||||
usr time 177.62 millis 174.28 millis 3.34 millis
|
||||
sys time 367.72 millis 366.16 millis 1.56 millis
|
||||
|
||||
|
||||
________________________________________________________
|
||||
Executed in 292.97 millis fish external
|
||||
usr time 71.23 millis 69.31 millis 1.93 millis
|
||||
sys time 215.22 millis 214.78 millis 0.44 millis
|
||||
```
|
||||
|
||||
`command -v` is faster
|
||||
30
home/dot_config/fish/themes/Catppuccin Latte.theme
Normal file
30
home/dot_config/fish/themes/Catppuccin Latte.theme
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# name: 'Catppuccin Latte'
|
||||
# url: 'https://github.com/catppuccin/fish'
|
||||
# preferred_background: eff1f5
|
||||
|
||||
fish_color_normal 4c4f69
|
||||
fish_color_command 1e66f5
|
||||
fish_color_param dd7878
|
||||
fish_color_keyword d20f39
|
||||
fish_color_quote 40a02b
|
||||
fish_color_redirection ea76cb
|
||||
fish_color_end fe640b
|
||||
fish_color_comment 8c8fa1
|
||||
fish_color_error d20f39
|
||||
fish_color_gray 9ca0b0
|
||||
fish_color_selection --background=ccd0da
|
||||
fish_color_search_match --background=ccd0da
|
||||
fish_color_option 40a02b
|
||||
fish_color_operator ea76cb
|
||||
fish_color_escape e64553
|
||||
fish_color_autosuggestion 9ca0b0
|
||||
fish_color_cancel d20f39
|
||||
fish_color_cwd df8e1d
|
||||
fish_color_user 179299
|
||||
fish_color_host 1e66f5
|
||||
fish_color_host_remote 40a02b
|
||||
fish_color_status d20f39
|
||||
fish_pager_color_progress 9ca0b0
|
||||
fish_pager_color_prefix ea76cb
|
||||
fish_pager_color_completion 4c4f69
|
||||
fish_pager_color_description 9ca0b0
|
||||
30
home/dot_config/fish/themes/Catppuccin Mocha.theme
Normal file
30
home/dot_config/fish/themes/Catppuccin Mocha.theme
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# name: 'Catppuccin Mocha'
|
||||
# url: 'https://github.com/catppuccin/fish'
|
||||
# preferred_background: 1e1e2e
|
||||
|
||||
fish_color_normal cdd6f4
|
||||
fish_color_command 89b4fa
|
||||
fish_color_param f2cdcd
|
||||
fish_color_keyword f38ba8
|
||||
fish_color_quote a6e3a1
|
||||
fish_color_redirection f5c2e7
|
||||
fish_color_end fab387
|
||||
fish_color_comment 7f849c
|
||||
fish_color_error f38ba8
|
||||
fish_color_gray 6c7086
|
||||
fish_color_selection --background=313244
|
||||
fish_color_search_match --background=313244
|
||||
fish_color_option a6e3a1
|
||||
fish_color_operator f5c2e7
|
||||
fish_color_escape eba0ac
|
||||
fish_color_autosuggestion 6c7086
|
||||
fish_color_cancel f38ba8
|
||||
fish_color_cwd f9e2af
|
||||
fish_color_user 94e2d5
|
||||
fish_color_host 89b4fa
|
||||
fish_color_host_remote a6e3a1
|
||||
fish_color_status f38ba8
|
||||
fish_pager_color_progress 6c7086
|
||||
fish_pager_color_prefix f5c2e7
|
||||
fish_pager_color_completion cdd6f4
|
||||
fish_pager_color_description 6c7086
|
||||
41
home/dot_config/fish/themes/Rosé Pine Dawn.theme
Normal file
41
home/dot_config/fish/themes/Rosé Pine Dawn.theme
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# syntax highlighting variables
|
||||
# https://fishshell.com/docs/current/interactive.html#syntax-highlighting-variables
|
||||
fish_color_normal 575279
|
||||
fish_color_command 907aa9
|
||||
fish_color_keyword 56949f
|
||||
fish_color_quote ea9d34
|
||||
fish_color_redirection 286983
|
||||
fish_color_end 797593
|
||||
fish_color_error b4637a
|
||||
fish_color_param d7827e
|
||||
fish_color_comment 797593
|
||||
# fish_color_match --background=brblue
|
||||
fish_color_selection --reverse
|
||||
# fish_color_history_current --bold
|
||||
fish_color_operator 575279
|
||||
fish_color_escape 286983
|
||||
fish_color_autosuggestion 797593
|
||||
fish_color_cwd d7827e
|
||||
# fish_color_cwd_root red
|
||||
fish_color_user ea9d34
|
||||
fish_color_host 56949f
|
||||
fish_color_host_remote 907aa9
|
||||
fish_color_cancel 575279
|
||||
fish_color_search_match --background=faf4ed
|
||||
fish_color_valid_path
|
||||
|
||||
# pager color variables
|
||||
# https://fishshell.com/docs/current/interactive.html#pager-color-variables
|
||||
fish_pager_color_progress d7827e
|
||||
fish_pager_color_background --background=fffaf3
|
||||
fish_pager_color_prefix 56949f
|
||||
fish_pager_color_completion 797593
|
||||
fish_pager_color_description 797593
|
||||
fish_pager_color_secondary_background
|
||||
fish_pager_color_secondary_prefix
|
||||
fish_pager_color_secondary_completion
|
||||
fish_pager_color_secondary_description
|
||||
fish_pager_color_selected_background --background=f2e9e1
|
||||
fish_pager_color_selected_prefix 56949f
|
||||
fish_pager_color_selected_completion 575279
|
||||
fish_pager_color_selected_description 575279
|
||||
Loading…
Add table
Add a link
Reference in a new issue