blob: 580614370fe0f5dcddbdc6a14e352a266411ea79 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# vim: filetype=sh
# Disable greeting
set fish_greeting
# Disable command not found handler
function __fish_command_not_found_handler --on-event fish_command_not_found; echo "fish: Unknown command '$argv'"; end
# Default application
set -gx BROWSER qutebrowser
set -gx EDITOR nvim
set -gx READER mupdf
set -gx TERMINAL alacritty
set -gx VISUAL $EDITOR
# Personal variables
set -gx DOMAIN minskio.co.uk
set -gx EMAIL (whoami)@$DOMAIN
set -gx SYNCDIR $HOME/vault
# Exports to move certain files around
fish_add_path "$HOME/.local/bin"
set -gx GNUPGHOME "$XDG_DATA_HOME/gnupg"
set -gx LESSHISTFILE "-"
set -gx XDG_CONFIG_HOME "$HOME/.config"
set -gx XDG_DATA_HOME "$HOME/.local/share"
set -gx XDG_DESKTOP_DIR "$HOME"
set -gx XDG_DOWNLOAD_DIR "$HOME/downloads"
# Command aliases
if test ! (command -v sudo); alias sudo="doas"; end
alias crontab='$EDITOR "$XDG_CONFIG_HOME/cron/crontab" && /usr/bin/crontab "$XDG_CONFIG_HOME/cron/crontab"'
alias dotedit='find "$XDG_CONFIG_HOME" "$HOME/.local/bin" -maxdepth 2 -type f | fzf --preview "cat {}" --layout reverse | xargs -r "$EDITOR"'
alias dotfiles='git --git-dir="$SYNCDIR/src/dotfiles" --work-tree="$HOME"'
alias empties='find . -maxdepth 3 -mount -not -path "*/\.*" -empty'
alias mpv-hdmi='mpv --fs --volume=100 --audio-device=alsa/hdmi:CARD=PCH,DEV=0'
alias screenoff='sleep 0.5s && pkill -USR1 swayidle'
alias todo='find "$SYNCDIR" -maxdepth 3 -type f -name 'todo.txt' -exec $EDITOR {} \;'
alias vaultedit='find "$SYNCDIR" -maxdepth 5 -type f -not -path "*/\.git" | fzf --preview "cat {}" --layout reverse | xargs -r -I{} "$EDITOR" "{}"'
# Functions
function backup; tar -zcvf (basename $argv)_backup-(date +%F-%H%M%S).tar.gz $argv ; end
function cheat; curl -s "http://cheat.sh/$argv" ; end
function crypto-sum; rbw get 'crypto purchases' | awk '/^20/ {print $2}' | paste -sd+ | math ; end
function dos2unix; sed -i 's/\r//' "$argv" ; end
function fractodec; math -s2 "$argv" ; end
function hextodec; math "0x$argv" ; end
function mcd; mkdir -p "$argv" && cd "$argv" ; end
function macaddr; printf "%s\n" (curl -s https://api.macvendors.com/$argv) ; end
function mergeinto; rsync --progress --remove-source-files -av "$argv[1]" "$argv[2]" && find "$argv[1]" -empty -delete ; end
function mount-rw; sudo mount -o rw "$argv[1]" "$argv[2]"; end
# function mount-exfat; sudo mount -o rw,users,uid=(id -u) "$argv[1]" "$argv[2]"; end
function sessionexec; awk -v site="$argv[1]" '$0~site {print $2}' "$XDG_DATA_HOME/qutebrowser/sessions/default.yml"; end
function split; ffmpeg -i "$argv[1]" -ss "$argv[2]" -to "$argv[3]" -c copy split-$argv[1]; end
function sudo; if test "$argv" = !!; eval command sudo $history[1]; else; command sudo $argv; end; end
function vat; math "$argv + ($argv * 0.2)"; end
function wallet; rbw get "2miners" | atto "$argv"; end
function ytsearch; mpv "ytdl://ytsearch:\"$argv\""; end
# Rclone config symlink
if ! test -e "$XDG_CONFIG_HOME/rclone/rclone.conf"; and test -f "$SYNCDIR/src/dockerfiles/rclone.conf"; ln -s "$SYNCDIR/src/dockerfiles" "$XDG_CONFIG_HOME/rclone"; end
# Prompt, inspired by Oxide by Dikiaap
function fish_prompt; echo && set_color green; echo (dirs) && set_color normal; printf "❯ "; end
# Keybinds
bind \cH backward-kill-path-component
bind \e\[3\;5~ kill-word
# Colour scheme
set -x fish_color_autosuggestion 585858
set -x fish_color_cancel \x2dr
set -x fish_color_command a1b56c
set -x fish_color_comment f7ca88
set -x fish_color_cwd green
set -x fish_color_cwd_root red
set -x fish_color_end ba8baf
set -x fish_color_error ab4642
set -x fish_color_escape 86c1b9
set -x fish_color_history_current \x2d\x2dbold
set -x fish_color_host normal
set -x fish_color_host_remote yellow
set -x fish_color_match 7cafc2
set -x fish_color_normal normal
set -x fish_color_operator 7cafc2
set -x fish_color_param d8d8d8
set -x fish_color_quote f7ca88
set -x fish_color_redirection d8d8d8
set -x fish_color_search_match bryellow\x1e\x2d\x2dbackground\x3dbrblack
set -x fish_color_selection white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
set -x fish_color_status red
set -x fish_color_user brgreen
set -x fish_color_valid_path \x2d\x2dunderline
set -x fish_key_bindings fish_default_key_bindings
set -x fish_pager_color_completion normal
set -x fish_pager_color_description B3A06D\x1eyellow
set -x fish_pager_color_prefix white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
set -x fish_pager_color_progress brwhite\x1e\x2d\x2dbackground\x3dcyan
# Start sway at login
if test (tty) = "/dev/tty1"; exec sway; end
|