home/dot_config/fish/config.fish

129 lines
3.2 KiB
Fish

# Convenience function for only setting PATH if the specified directory exists
function setpath
test -e $argv[1]; and fish_add_path $argv[1]
end
if test -z "$XDG_RUNTIME_DIR"
set -x XDG_RUNTIME_DIR "/tmp/$USER-runtime-dir"
if test ! -e "$XDG_RUNTIME_DIR"
mkdir "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"
end
end
# PATH adjustment
setpath ~/.local/share/cargo/bin
setpath ~/.ghcup/bin
setpath ~/.cabal/bin
setpath ~/.local/bin
setpath ~/.rye/shims
setpath ~/.local/share/mise/shims
# Both of these work now apparently?
setpath ~/.config/emacs/bin
setpath ~/.fly/bin
setpath ~/.bun/bin
setpath ~/go/bin
# zoxide setup
zoxide init fish | source
# Source private stuff
source ~/.config/fish/private.fish
# Environment variables
set -x EDITOR vim
set -x USER lu
set -x SHELL (which fish)
set -x TERM xterm-256color
set -x CARGO_HOME ~/.local/share/cargo
set -x GTK_IM_MODULE ibus
set -x XMODIFIERS @im=ibus
set -x QT_IM_MODULE ibus
set -x GLFW_IM_MODULE ibus
set -x LANG en_US.UTF-8
set -x LC_CTYPE en_US.UTF-8
set -x LANGUAGE en_US.UTF-8
set -x RUST_SRC_PATH (rustc --print sysroot)/lib/rustlib/src/rust/src
set -x XDG_CURRENT_DESKTOP Unity
set -x LANG "en_US.UTF-8"
set -x TZ_LIST "Europe/Berlin;Berlin,America/New_York;US East,America/Los_Angeles;US West,Europe/London;London"
# General Aliases
# Convenience for editing my shell config
alias editconfig "chezmoi edit --watch ~/.config/fish/config.fish; and source ~/.config/fish/config.fish"
# General aliases
alias cl clear
alias ll "ls -lahF --color=always"
alias e "$EDITOR"
alias se sudoedit
alias cd.. "cd ../"
alias rmrf "rm -rf"
# portage aliases
alias eupgrade "doas emerge -aguDN @world"
alias eclean "doas emerge -ac"
# chezmoi aliases
alias czm chezmoi
alias ce "chezmoi edit --watch"
alias ccd "cd ~/.local/share/chezmoi"
# If nvim is installed, alias vim with it
if command --search nvim >/dev/null
alias vim nvim
end
# overrides of defaults
alias mkdir "mkdir -p"
alias cp "cp -r"
alias scp "scp -r"
alias apt "sudo apt"
alias doc "sudo docker"
alias docker "sudo docker"
alias sctl "sudo systemctl"
alias usctl "systemctl --user"
alias doco "sudo docker-compose"
# z is such a weird key to hit frequently, j is much better
alias j z
# Cargoes and Rust-s
alias c cargo
alias cr "cargo run"
alias cb "cargo build"
alias ct "cargo test"
alias cwr "cargo watch -x run"
alias ct "cargo test"
alias rp rustup
# Rubies
alias be "bundle exec"
# cd into a temp directory, very useful!
alias mkt "cd (mktemp -d)"
# Git Aliases
alias lg lazygit
alias g git
alias ga "g add"
alias gs "g status --short"
alias gl "g log --color --graph --abbrev-commit --oneline"
# "git quick push" and "git quick commit". it makes sense in my head
alias gqp "g add --all; and g commit; and g push"
alias gqc "g add --all; and g commit"
alias gpl "g pull"
alias gps "g push"
alias gc "g commit"
alias gb "g branch"
alias gaa "g add --all"
alias gco "g checkout"
# Load nix profile if nix is installed
if test -e /nix
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish
set -x NIX_PATH "$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/root/channels"
end
# proto
set -gx PROTO_HOME "$HOME/.proto"
set -gx PATH "$PROTO_HOME/shims" $PATH