Muh dotfiles
This commit is contained in:
46
.config/fish/conf.d/abbr.fish
Normal file
46
.config/fish/conf.d/abbr.fish
Normal file
@ -0,0 +1,46 @@
|
||||
status is-interactive; or return
|
||||
|
||||
status is-login; and abbr H Hyprland
|
||||
|
||||
abbr l la
|
||||
abbr m mkdir
|
||||
abbr o open
|
||||
abbr t trash
|
||||
# abbr m mpv
|
||||
abbr mm -- mpv --shuffle \$XDG_MUSIC_DIR
|
||||
|
||||
abbr g git
|
||||
# abbr dots -- git --git-dir \~/.dotfiles/ --work-tree \~
|
||||
abbr gl git log
|
||||
abbr ga git add
|
||||
abbr gc git commit
|
||||
abbr gs git status
|
||||
abbr gcl git clone
|
||||
abbr gco git checkout
|
||||
|
||||
|
||||
function __last_hist_item; printf $history[1]; end
|
||||
abbr !! -p anywhere -f __last_hist_item
|
||||
|
||||
function __find_editor --description 'Edit with edit-in-kitty when in ssh'
|
||||
if set -q SSH_TTY; and type -q edit-in-kitty
|
||||
printf edit-in-kitty
|
||||
else
|
||||
printf $EDITOR
|
||||
end
|
||||
end
|
||||
abbr e -f __find_editor
|
||||
|
||||
function __ssh_kitten --description 'Use ssh kitten if available'
|
||||
type -q kitten; and printf 'kitten '
|
||||
printf ssh
|
||||
end
|
||||
abbr s -f __ssh_kitten
|
||||
|
||||
function __multidot --description 'Use .... instead of ../../../'
|
||||
string repeat -n (math (string length -- $argv) - 1) ../
|
||||
end
|
||||
abbr multidot -r '\.\.\.+$' -p anywhere -f __multidot
|
||||
|
||||
function __multicd; echo cd (__multidot $argv); end
|
||||
abbr multicd -r '^\.\.+$' -f __multicd
|
49
.config/fish/conf.d/env.fish
Normal file
49
.config/fish/conf.d/env.fish
Normal file
@ -0,0 +1,49 @@
|
||||
set -gx XDG_CONFIG_HOME ~/.config
|
||||
set -gx XDG_CACHE_HOME ~/.cache
|
||||
set -gx XDG_STATE_HOME ~/.local/state
|
||||
set -gx XDG_DATA_HOME ~/.local/share
|
||||
|
||||
set -gx XDG_MUSIC_DIR ~/music
|
||||
set -gx XDG_VIDEOS_DIR ~/vid
|
||||
set -gx XDG_PICTURES_DIR ~/pic
|
||||
set -gx XDG_DOCUMENTS_DIR ~/doc
|
||||
|
||||
set -gx XDG_DESKTOP_DIR /tmp
|
||||
set -gx XDG_DOWNLOAD_DIR /tmp
|
||||
# set -gx XDG_TEMPLATES_DIR "$HOME/"
|
||||
# set -gx XDG_PUBLICSHARE_DIR "$HOME/"
|
||||
|
||||
set -gx GOPATH $XDG_DATA_HOME/go # GOOUT my home
|
||||
set -gx CARGO_HOME $XDG_DATA_HOME/cargo
|
||||
|
||||
# Can't use '~' in universal variables
|
||||
set -gx fish_user_paths ~/.local/bin $CARGO_HOME/bin
|
||||
|
||||
# -agx is a bad idea as login shell itself also does it
|
||||
set -gx WINEPATH /usr/x86_64-w64-mingw32/bin
|
||||
# set -gx CPATH /usr/x86_64-w64-mingw32/include
|
||||
|
||||
set -gx BROWSER librewolf # for fish documentation mainly
|
||||
|
||||
# Convenience
|
||||
set -gx SCREENSHOT_DIR $XDG_PICTURES_DIR/screen
|
||||
set -gx SCREENRECORD_DIR $XDG_VIDEOS_DIR/screen
|
||||
|
||||
|
||||
# Find an editor
|
||||
for e in nvim vim vi helix nano
|
||||
type -q $e; or continue
|
||||
set -gx EDITOR $e
|
||||
break
|
||||
end
|
||||
type -q nvim; and set -gx MANPAGER nvim +Man!
|
||||
|
||||
|
||||
test -S ~/.bitwarden-ssh-agent.sock
|
||||
and set -gx SSH_AUTH_SOCK ~/.bitwarden-ssh-agent.sock
|
||||
|
||||
# SSH with GPG
|
||||
# set -e SSH_AGENT_PID
|
||||
# set -gx GPG_TTY (tty)
|
||||
# set -gx SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket)
|
||||
# gpg-connect-agent updatestartuptty /bye >/dev/null
|
0
.config/fish/config.fish
Normal file
0
.config/fish/config.fish
Normal file
43
.config/fish/fish_variables
Normal file
43
.config/fish/fish_variables
Normal file
@ -0,0 +1,43 @@
|
||||
# This file contains fish universal variable definitions.
|
||||
# VERSION: 3.0
|
||||
SETUVAR __fish_initialized:3800
|
||||
SETUVAR fish_color_autosuggestion:6272a4
|
||||
SETUVAR fish_color_cancel:ff5555\x1e\x2d\x2dreverse
|
||||
SETUVAR fish_color_command:8be9fd
|
||||
SETUVAR fish_color_comment:6272a4
|
||||
SETUVAR fish_color_cwd:50fa7b
|
||||
SETUVAR fish_color_cwd_root:red
|
||||
SETUVAR fish_color_end:ffb86c
|
||||
SETUVAR fish_color_error:ff5555
|
||||
SETUVAR fish_color_escape:ff79c6
|
||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||
SETUVAR fish_color_host:bd93f9
|
||||
SETUVAR fish_color_host_remote:bd93f9
|
||||
SETUVAR fish_color_keyword:ff79c6
|
||||
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||
SETUVAR fish_color_normal:f8f8f2
|
||||
SETUVAR fish_color_operator:50fa7b
|
||||
SETUVAR fish_color_option:ffb86c
|
||||
SETUVAR fish_color_param:bd93f9
|
||||
SETUVAR fish_color_quote:f1fa8c
|
||||
SETUVAR fish_color_redirection:f8f8f2
|
||||
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3d44475a
|
||||
SETUVAR fish_color_selection:\x2d\x2dbackground\x3d44475a
|
||||
SETUVAR fish_color_status:ff5555
|
||||
SETUVAR fish_color_user:8be9fd
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
SETUVAR fish_features:all
|
||||
SETUVAR fish_key_bindings:fish_vi_key_bindings
|
||||
SETUVAR fish_pager_color_background:\x1d
|
||||
SETUVAR fish_pager_color_completion:f8f8f2
|
||||
SETUVAR fish_pager_color_description:6272a4
|
||||
SETUVAR fish_pager_color_prefix:8be9fd
|
||||
SETUVAR fish_pager_color_progress:6272a4
|
||||
SETUVAR fish_pager_color_secondary_background:\x1d
|
||||
SETUVAR fish_pager_color_secondary_completion:f8f8f2
|
||||
SETUVAR fish_pager_color_secondary_description:6272a4
|
||||
SETUVAR fish_pager_color_secondary_prefix:8be9fd
|
||||
SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3d44475a
|
||||
SETUVAR fish_pager_color_selected_completion:f8f8f2
|
||||
SETUVAR fish_pager_color_selected_description:6272a4
|
||||
SETUVAR fish_pager_color_selected_prefix:8be9fd
|
3
.config/fish/functions/chat.fish
Normal file
3
.config/fish/functions/chat.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function chat --wraps='ollama run --nowordwrap' --description 'Run an llm without history'
|
||||
OLLAMA_NOHISTORY=y ollama run --nowordwrap $argv
|
||||
end
|
3
.config/fish/functions/dots.fish
Normal file
3
.config/fish/functions/dots.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function dots --wraps 'git --git-dir ~/.dotfiles/ --work-tree ~' --description 'Track dotfiles with git'
|
||||
command git --git-dir ~/.dotfiles/ --work-tree ~ $argv
|
||||
end
|
3
.config/fish/functions/fish_greeting.fish
Normal file
3
.config/fish/functions/fish_greeting.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function fish_greeting
|
||||
# command -q fortune; and fortune -as
|
||||
end
|
1
.config/fish/functions/fish_mode_prompt.fish
Normal file
1
.config/fish/functions/fish_mode_prompt.fish
Normal file
@ -0,0 +1 @@
|
||||
function fish_mode_prompt; end
|
65
.config/fish/functions/fish_prompt.fish
Normal file
65
.config/fish/functions/fish_prompt.fish
Normal file
@ -0,0 +1,65 @@
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
# Save those before running anything
|
||||
set -l last_pipestatus $pipestatus
|
||||
set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
|
||||
|
||||
# Detect reflow from window size change
|
||||
if test "$__fish_prompt_term_dimensions" != "$COLUMNS$LINES"
|
||||
set -g __fish_prompt_term_dimensions "$COLUMNS$LINES"
|
||||
if set -q __fish_prompt
|
||||
echo -ns $__fish_prompt
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# Write pipestatus if a command was issued
|
||||
# TODO: hardcode this mess
|
||||
if test "$__fish_prompt_status_generation" != $status_generation
|
||||
set -g __fish_prompt_status_generation $status_generation
|
||||
set -q fish_color_status; or set -g fish_color_status brred
|
||||
|
||||
set -f prompt_status (__fish_print_pipestatus '' '' '|' '' (set_color --bold $fish_color_status) $last_pipestatus)
|
||||
end
|
||||
|
||||
# Only show login if in SSH or container
|
||||
if not set -q prompt_host
|
||||
set -g prompt_host '' # global because it's slow and unchanging
|
||||
if set -q SSH_TTY; or begin
|
||||
command -sq systemd-detect-virt
|
||||
and systemd-detect-virt -q
|
||||
end
|
||||
set prompt_host "$(prompt_login) "
|
||||
end
|
||||
end
|
||||
|
||||
if not set -q __prompt_suffix
|
||||
set -g __prompt_suffix '>'
|
||||
set -g __prompt_color_cwd fish_color_cwd
|
||||
|
||||
if fish_is_root_user
|
||||
set __prompt_suffix '#'
|
||||
set -q fish_color_cwd_root; or set -g fish_color_cwd_root red
|
||||
set __prompt_color_cwd fish_color_cwd_root
|
||||
end
|
||||
end
|
||||
|
||||
set -l suffix $__prompt_suffix
|
||||
if test "$fish_key_bindings" = fish_vi_key_bindings
|
||||
or test "$fish_key_bindings" = fish_hybrid_key_bindings
|
||||
switch $fish_bind_mode
|
||||
# case insert
|
||||
case default
|
||||
set suffix (set_color --bold brmagenta)N
|
||||
case visual
|
||||
set suffix (set_color --bold brcyan)V
|
||||
case replace_one
|
||||
set suffix (set_color --bold bryellow)R
|
||||
case replace
|
||||
set suffix (set_color --bold brred)R
|
||||
end
|
||||
end
|
||||
|
||||
set -l n (set_color normal)
|
||||
set -g __fish_prompt $n $prompt_host (set_color $$__prompt_color_cwd) (prompt_pwd -D2) $n ' ' $prompt_status $suffix $n ' '
|
||||
echo -ns $__fish_prompt
|
||||
end
|
53
.config/fish/functions/fish_right_prompt.fish
Normal file
53
.config/fish/functions/fish_right_prompt.fish
Normal file
@ -0,0 +1,53 @@
|
||||
function fish_right_prompt
|
||||
# Detect reflow from window size change
|
||||
if test "$__fish_right_prompt_term_dimensions" != "$COLUMNS$LINES"
|
||||
set -g __fish_right_prompt_term_dimensions "$COLUMNS$LINES"
|
||||
if set -q __fish_right_prompt
|
||||
echo -ns $__fish_right_prompt
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
set -g __fish_git_prompt_showdirtystate 1
|
||||
set -g __fish_git_prompt_showuntrackedfiles 1
|
||||
set -g __fish_git_prompt_showupstream informative
|
||||
set -g __fish_git_prompt_showcolorhints 1
|
||||
set -g __fish_git_prompt_use_informative_chars 1
|
||||
|
||||
# Unfortunately this only works if we have a sensible locale
|
||||
string match -qi '*.utf-8' -- $LANG $LC_CTYPE $LC_ALL
|
||||
and set -g __fish_git_prompt_char_dirtystate \U1F4a9
|
||||
set -g __fish_git_prompt_char_untrackedfiles '?'
|
||||
|
||||
set -l vcs (fish_vcs_prompt '%s' 2>/dev/null)
|
||||
|
||||
set -q VIRTUAL_ENV_DISABLE_PROMPT
|
||||
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
|
||||
set -q VIRTUAL_ENV
|
||||
and set -l venv (string replace -r '.*/' '' -- "$VIRTUAL_ENV")
|
||||
|
||||
# Count duration (optionally)
|
||||
if test $CMD_DURATION -gt 100 -a \
|
||||
"$__fish_right_prompt_status_generation" != $status_generation
|
||||
set -g __fish_right_prompt_status_generation $status_generation
|
||||
|
||||
set -l secs (math -s2 $CMD_DURATION / 1000 % 60)
|
||||
set -l mins (math -s0 $CMD_DURATION / 60000 % 60)
|
||||
set -l hrs (math -s0 $CMD_DURATION / 3600000)
|
||||
set -l parts
|
||||
|
||||
# Remove excess verbosity
|
||||
test $hrs -gt 0; and set -a parts $hrs'h'
|
||||
if test $mins -gt 0
|
||||
set -a parts $mins'm'
|
||||
set secs (math -s0 $secs) # drop millis when there are mins
|
||||
end
|
||||
test $secs -gt 0 -a $hrs -eq 0; and set -a parts $secs's'
|
||||
|
||||
set -f duration (set_color white)(string join ':' -- $parts)
|
||||
end
|
||||
|
||||
set -l n (set_color normal)
|
||||
set -g __fish_right_prompt $n $venv' ' $duration' ' $vcs' ' (set_color brblack) (date '+%R') $n
|
||||
echo -ns $__fish_right_prompt
|
||||
end
|
40
.config/fish/functions/fish_user_key_bindings.fish
Normal file
40
.config/fish/functions/fish_user_key_bindings.fish
Normal file
@ -0,0 +1,40 @@
|
||||
function fish_user_key_bindings
|
||||
if command -q fzf
|
||||
set -gx FZF_CTRL_R_OPTS '--reverse'
|
||||
|
||||
function bind; end # thanks fzf for not using `builtin`
|
||||
if functions -q fzf_key_bindings
|
||||
fzf_key_bindings
|
||||
else
|
||||
echo 'WARNING: using `fzf --fish | source`'
|
||||
command fzf --fish | source
|
||||
end
|
||||
functions -e bind
|
||||
|
||||
# FZF_ALT_C_COMMAND, FZF_ALT_C_OPTS
|
||||
bind alt-c fzf-cd-widget
|
||||
bind -M insert alt-c fzf-cd-widget
|
||||
# FZF_CTRL_T_COMMAND, FZF_CTRL_T_OPTS
|
||||
bind alt-f fzf-file-widget
|
||||
bind -M insert alt-f fzf-file-widget
|
||||
# FZF_CTRL_R_OPTS
|
||||
bind ctrl-f fzf-history-widget
|
||||
bind -M insert ctrl-f fzf-history-widget
|
||||
else
|
||||
echo 'INFO: fzf not found'
|
||||
end
|
||||
|
||||
# Unused: alt-z, insert ctrl-r
|
||||
|
||||
bind alt-t transpose-words
|
||||
bind -M insert alt-t transpose-words
|
||||
bind -M visual alt-t transpose-words
|
||||
bind ctrl-t transpose-chars
|
||||
bind -M insert ctrl-t transpose-chars
|
||||
bind -M visual ctrl-t transpose-chars
|
||||
bind ctrl-z 'fish_commandline_append " &; disown"'
|
||||
bind -M insert ctrl-z 'fish_commandline_append " &; disown"'
|
||||
bind -M visual ctrl-z 'fish_commandline_append " &; disown"'
|
||||
|
||||
# bind -M insert ctrl-d exit
|
||||
end
|
3
.config/fish/functions/la.fish
Normal file
3
.config/fish/functions/la.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function la --wraps 'ls' --description 'List all files in directory using verbose format'
|
||||
ls -lAh --group-directories-first $argv
|
||||
end
|
3
.config/fish/functions/ll.fish
Normal file
3
.config/fish/functions/ll.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function ll --wraps 'ls' --description 'List contents of directory using long format'
|
||||
ls -lh --group-directories-first $argv
|
||||
end
|
7
.config/fish/functions/music.fish
Normal file
7
.config/fish/functions/music.fish
Normal file
@ -0,0 +1,7 @@
|
||||
function music --wraps 'yt-dlp -x --embed-thumbnail --embed-chapters' --description 'Download music with yt-dlp'
|
||||
test -d $argv[-1]; or set -a argv "$XDG_MUSIC_DIR"
|
||||
echo "Downloading into $argv[-1]"
|
||||
|
||||
command yt-dlp --extract-audio --embed-thumbnail --embed-chapters \
|
||||
--output "$argv[-1]/%(title)s.%(ext)s" $argv[..-2]
|
||||
end
|
3
.config/fish/functions/tree.fish
Normal file
3
.config/fish/functions/tree.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function tree
|
||||
command tree -C --dirsfirst $argv
|
||||
end
|
11
.config/fish/functions/y.fish
Normal file
11
.config/fish/functions/y.fish
Normal file
@ -0,0 +1,11 @@
|
||||
function y --wraps 'yazi' --description 'TUI file manager'
|
||||
set -l tmp (mktemp -t 'yazi_cwd.XXX')
|
||||
yazi --cwd-file="$tmp" $argv
|
||||
|
||||
set -l cwd (command cat -- "$tmp")
|
||||
and test -n "$cwd"
|
||||
and test "$cwd" != "$PWD"
|
||||
and builtin cd -- "$cwd"
|
||||
|
||||
rm -f -- "$tmp"
|
||||
end
|
Reference in New Issue
Block a user