Make fish config more reliable on different systems

This commit is contained in:
Agatha Lovelace 2023-02-18 15:13:58 +01:00
parent b518030c86
commit 80be649e96
Signed by: sorceress
GPG Key ID: 01D0B3AB10CED4F8
1 changed files with 50 additions and 31 deletions

View File

@ -8,33 +8,63 @@
# \\, \\ ,-_- \\ |/
# _/
if type -q wal
source ~/.cache/wal/colors.fish
end
set -Ux AWT_TOOLKIT MToolkit
set -Ux BORG_RELOCATED_REPO_ACCESS_IS_OK yes
set -Ux DESKTOP_SESSION bspwm
set -Ux EDITOR vim
set -Ux JDK_JAVA_OPTIONS "-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Djdk.gtk.version=3 -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true"
set -Ux SYSTEMD_EDITOR vim
set -gx fish_user_paths $fish_user_paths (ruby -e 'print Gem.user_dir')/bin /home/agatha/.local/bin /home/agatha/.cargo/bin /home/agatha/.cabal/bin /home/agatha/.espressif/tools/xtensa-esp32-elf-clang/esp-13.0.0-20211203-x86_64-unknown-linux-gnu/bin/
set -Ux LIBCLANG_PATH "/home/agatha/.espressif/tools/xtensa-esp32-elf-clang/esp-13.0.0-20211203-x86_64-unknown-linux-gnu/lib"
set -Ux PIP_USER no
# set -Ux DESKTOP_SESSION bspwm
# Borg pleeease
set -Ux BORG_RELOCATED_REPO_ACCESS_IS_OK yes
# Editor
set -Ux EDITOR helix
set -Ux SYSTEMD_EDITOR helix
# Zoxide
set -Ux _ZO_FZF_OPTS "--no-sort --height=30% --exit-0 --select-1 --bind=ctrl-z:ignore"
# Fix locale errors in Nix
set -Ux LOCALE_ARCHIVE /usr/lib/locale/locale-archive
# PATH
set -gx fish_user_paths $fish_user_paths /home/agatha/.local/bin /home/agatha/.cargo/bin /home/agatha/.cabal/bin /home/agatha/.espressif/tools/xtensa-esp32-elf-clang/esp-13.0.0-20211203-x86_64-unknown-linux-gnu/bin/
if type -q ruby
fish_add_path -a (ruby -e 'print Gem.user_dir')/bin
end
# Aliases
alias cat bat
alias code codium
alias hx helix
alias df duf
alias ls 'exa -lFhT --group-directories-first --level 1'
alias py python3
alias ip 'ip -color=always'
alias xclip 'xclip -selection clipboard'
alias youtube-dl-audio 'youtube-dl --ignore-errors --output "%(title)s.%(ext)s" --extract-audio --audio-format best'
alias ip 'ip -color=always'
# Only alias hx to helix if it's not already done (helix nixpkg does this, arch package does not)
if not type -q hx
alias hx helix
end
if status is-interactive
# Commands to run in interactive sessions can go here
# Only alias in interactive sessions to not break scripts
if type -q exa
alias ls 'exa -lFhT --group-directories-first --level 1'
end
if type -q starship
starship init fish | source
end
if type -q zoxide
zoxide init --cmd v fish | source
end
end
# https://github.com/fish-shell/fish-shell/issues/1891#issuecomment-451961517
@ -53,25 +83,14 @@ end
bind . 'expand-dot-to-parent-directory-path'
# args: file host container path
function scp-lxc
scp -r $argv[1] $argv[2]:/tmp/
set -l pid (string trim (ssh $argv[2] (string join ' ' "sudo lxc-ls -f -Fpid" $argv[3]) | sed -n 2p))
ssh $argv[2] (string join '' "sudo mv /tmp/" (basename $argv[1]) " /proc/" $pid "/root/" $argv[4])
end
function impostor
echo $argv[1] | string sub -s 13 | fold -w1 | shuf | tr -d '\n' | sed 's/^/cccccbeujtje/'
end
# if test -n "$DESKTOP_SESSION"
# set -x (gnome-keyring-daemon --start --components=secrets | string split "=")
# end
if test -d ~/.gnupg
set -e SSH_AGENT_PID
set -x SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket)
# so gpg-agent knows in what tty to prompt for key passwords
set -x GPG_TTY (tty)
gpg-connect-agent updatestartuptty /bye > /dev/null
starship init fish | source
end