112 lines
2.8 KiB
Fish
112 lines
2.8 KiB
Fish
# Convenience function for only setting PATH if the specified directory exists
|
|
function setpath
|
|
test -e $argv[1]; and set PATH $argv[1] $PATH
|
|
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
|
|
|
|
# Set Nix include path if it exists
|
|
if test -e ~/.nix-profile/etc/profile.d/nix.sh
|
|
fenv source ~/.nix-profile/etc/profile.d/nix.sh
|
|
end
|
|
|
|
# PATH adjustment
|
|
setpath /opt/homebrew/bin
|
|
setpath ~/.rbenv/shims
|
|
setpath ~/.rbenv/bin
|
|
setpath ~/.cargo/bin
|
|
setpath ~/.nimble/bin
|
|
setpath ~/.local/bin
|
|
setpath ~/n/bin
|
|
setpath ~/.bin
|
|
setpath ~/.cask/bin
|
|
setpath ~/.npm-packages/bin
|
|
setpath ~/.n/bin
|
|
setpath /snap/bin
|
|
setpath ~/.emacs.d/bin
|
|
setpath ~/Library/Python/3.7/bin
|
|
setpath /opt/texlive/2019/bin/x86_64-linux
|
|
setpath ~/.radicle/bin
|
|
|
|
# Source private stuff
|
|
source ~/.config/fish/private.fish
|
|
|
|
# Environment variables
|
|
set -x EDITOR "vim"
|
|
set -x USER "lu"
|
|
set -x SHELL /usr/bin/fish
|
|
set -x TERM xterm-256color
|
|
set -x N_PREFIX ~/n
|
|
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_ALL 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
|
|
|
|
# General Aliases
|
|
alias editconfig "chezmoi edit ~/.config/fish/config.fish; and chezmoi apply; and source ~/.config/fish/config.fish"
|
|
alias j "z"
|
|
alias c "cargo"
|
|
alias emacsd "emacs --daemon"
|
|
alias jo "zo"
|
|
alias be "bundle exec"
|
|
alias doc "docker-compose"
|
|
alias rp "rustup"
|
|
alias ca "cargo"
|
|
alias mkt "cd (mktemp -d)"
|
|
alias y "sudo zypper"
|
|
alias czm "chezmoi"
|
|
alias r "ranger"
|
|
# Git Aliases
|
|
alias g "git"
|
|
alias gs "g status --short"
|
|
alias gl "g log --color --graph --abbrev-commit --oneline"
|
|
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 gaa "g add --all"
|
|
alias gco "g checkout"
|
|
alias gse "g send-email"
|
|
alias wip "g add --all; and g commit -m WIP"
|
|
alias squish "gs; and g commit -a --amend -C HEAD"
|
|
# Mercurial Aliases
|
|
alias h "hg"
|
|
alias ha "hg addremove"
|
|
alias hc "hg commit"
|
|
alias hps "hg push"
|
|
alias hp "hg push"
|
|
alias hpl "hg pull"
|
|
alias hs "hg status"
|
|
alias hl "hg log"
|
|
|
|
# Aliases that overwrite other, existing commands
|
|
if command --search hub > /dev/null do
|
|
alias git "hub"
|
|
end
|
|
|
|
if command --search exa > /dev/null do
|
|
alias ls "exa"
|
|
end
|
|
|
|
# Some neat GPG shorthands
|
|
function secret
|
|
set output ~/$argv[1].(date +%s).enc
|
|
gpg --encrypt --armor --output $output $argv[1]; and echo "$argv[1] -> $output"
|
|
end
|
|
|
|
function reveal
|
|
set output (echo $argv[1] | rev | cut -c16- | rev)
|
|
gpg --decrypt --output $output $argv[1]; and echo "$argv[1] -> $output"
|
|
end
|