From b3530d7c4a102935fa26498a160ee1dc6c1e9c03 Mon Sep 17 00:00:00 2001 From: delta Date: Fri, 4 Jul 2025 00:38:29 +0200 Subject: :3 --- .config/fish/bindings.fish | 2 + .config/fish/colors.fish | 10 +- .config/fish/completions/beet.fish | 523 +++++++++++++++++++++ .config/fish/config.fish | 79 +++- .config/fish/fish_variables | 14 +- .../fish/functions/fish_commandline_toggle.fish | 26 + .config/fish/functions/fish_ssh_agent.fish | 32 ++ .config/fish/path.fish | 20 +- 8 files changed, 668 insertions(+), 38 deletions(-) create mode 100644 .config/fish/completions/beet.fish create mode 100644 .config/fish/functions/fish_commandline_toggle.fish create mode 100644 .config/fish/functions/fish_ssh_agent.fish (limited to '.config/fish') diff --git a/.config/fish/bindings.fish b/.config/fish/bindings.fish index 1ed7313..1a371e1 100644 --- a/.config/fish/bindings.fish +++ b/.config/fish/bindings.fish @@ -1 +1,3 @@ bind \b backward-kill-word +bind \eq fish_commandline_toggle +bind alt-s "fish_commandline_prepend doas" diff --git a/.config/fish/colors.fish b/.config/fish/colors.fish index de32d6d..381b0e9 100644 --- a/.config/fish/colors.fish +++ b/.config/fish/colors.fish @@ -9,15 +9,15 @@ set fish_color_error white set fish_color_param white set fish_color_valid_path white set fish_color_option white -set fish_color_comment "#8893a5" +set fish_color_comment "#77828c" set fish_color_operator white set fish_color_escape yellow -set fish_color_autosuggestion "#8893a5" +set fish_color_autosuggestion "#77828c" set fish_color_search_match --background=black # pager -set fish_pager_color_progress "#8893a5" +set fish_pager_color_progress "#77828c" set fish_pager_color_prefix white -set fish_pager_color_completion "#8893a5" -set fish_pager_color_description "#8893a5" +set fish_pager_color_completion "#77828c" +set fish_pager_color_description "#77828c" set fish_pager_color_selected_background --background=black diff --git a/.config/fish/completions/beet.fish b/.config/fish/completions/beet.fish new file mode 100644 index 0000000..8cc38e0 --- /dev/null +++ b/.config/fish/completions/beet.fish @@ -0,0 +1,523 @@ + +function __fish_beet_needs_command + set cmd (commandline -opc) + if test (count $cmd) -eq 1 + return 0 + end + return 1 +end + +function __fish_beet_using_command + set cmd (commandline -opc) + set needle (count $cmd) + if test $needle -gt 1 + if begin test $argv[1] = $cmd[2]; + and not contains -- $cmd[$needle] $FIELDS; end + return 0 + end + end + return 1 +end + +function __fish_beet_use_extra + set cmd (commandline -opc) + set needle (count $cmd) + if test $argv[2] = $cmd[$needle] + return 0 + end + return 1 +end + +set CMDS bpmanalyser clearart completion config convert dup duplicates embedart extractart fetchart fields fish ? help imp im import info ls list miss missing mod modify mv move rm remove spotify stats upd up update version write + +set FIELDS acoustid_fingerprint: acoustid_id: added: album: album_id: albumartist: albumartist_credit: albumartist_sort: albumdisambig: albumstatus: albumtotal: albumtype: albumtypes: arranger: artist: artist_credit: artist_sort: artpath: asin: bitdepth: bitrate: bpm: catalognum: channels: comments: comp: composer: composer_sort: country: day: disc: discogs_albumid: discogs_artistid: discogs_labelid: disctitle: disctotal: encoder: filesize: format: genre: grouping: id: initial_key: isrc: label: language: length: lyricist: lyrics: mb_albumartistid: mb_albumid: mb_artistid: mb_releasegroupid: mb_releasetrackid: mb_trackid: mb_workid: media: missing: month: mtime: original_day: original_month: original_year: path: r128_album_gain: r128_track_gain: releasegroupdisambig: rg_album_gain: rg_album_peak: rg_track_gain: rg_track_peak: samplerate: script: singleton: style: title: track: trackdisambig: tracktotal: work: work_disambig: year: + + +# ====== setup basic beet completion ===== + +complete -c beet -n '__fish_beet_needs_command' -l format-item -f -d 'print with custom format' +complete -c beet -n '__fish_beet_needs_command' -l format-album -f -d 'print with custom format' +complete -c beet -n '__fish_beet_needs_command' -s l -l library -f -r -d 'library database file to use' +complete -c beet -n '__fish_beet_needs_command' -s d -l directory -f -r -d 'destination music directory' +complete -c beet -n '__fish_beet_needs_command' -s v -l verbose -f -d 'print debugging information' +complete -c beet -n '__fish_beet_needs_command' -s c -l config -f -r -d 'path to configuration file' +complete -c beet -n '__fish_beet_needs_command' -s h -l help -f -d 'print this help message and exit' + +# ====== setup field completion for subcommands ===== + +# ------ fieldsetups for bpmanalyser ------- +complete -c beet -n '__fish_beet_needs_command' -a bpmanalyser -f -d 'analyse your songs for tempo and write it into the bpm tag' +complete -c beet -n '__fish_beet_using_command bpmanalyser' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for clearart ------- +complete -c beet -n '__fish_beet_needs_command' -a clearart -f -d 'remove images from file metadata' +complete -c beet -n '__fish_beet_using_command clearart' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for completion ------- +complete -c beet -n '__fish_beet_needs_command' -a completion -f -d 'print shell script that provides command line completion' +complete -c beet -n '__fish_beet_using_command completion' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for config ------- +complete -c beet -n '__fish_beet_needs_command' -a config -f -d 'show or edit the user configuration' +complete -c beet -n '__fish_beet_using_command config' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for convert ------- +complete -c beet -n '__fish_beet_needs_command' -a convert -f -d 'convert to external location' +complete -c beet -n '__fish_beet_using_command convert' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for dup ------- +complete -c beet -n '__fish_beet_needs_command' -a dup -f -d 'List duplicate tracks or albums.' +complete -c beet -n '__fish_beet_using_command dup' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for duplicates ------- +complete -c beet -n '__fish_beet_needs_command' -a duplicates -f -d 'List duplicate tracks or albums.' +complete -c beet -n '__fish_beet_using_command duplicates' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for embedart ------- +complete -c beet -n '__fish_beet_needs_command' -a embedart -f -d 'embed image files into file metadata' +complete -c beet -n '__fish_beet_using_command embedart' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for extractart ------- +complete -c beet -n '__fish_beet_needs_command' -a extractart -f -d 'extract an image from file metadata' +complete -c beet -n '__fish_beet_using_command extractart' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for fetchart ------- +complete -c beet -n '__fish_beet_needs_command' -a fetchart -f -d 'download album art' +complete -c beet -n '__fish_beet_using_command fetchart' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for fields ------- +complete -c beet -n '__fish_beet_needs_command' -a fields -f -d 'show fields available for queries and format strings' +complete -c beet -n '__fish_beet_using_command fields' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for fish ------- +complete -c beet -n '__fish_beet_needs_command' -a fish -f -d 'generate Fish shell tab completions' +complete -c beet -n '__fish_beet_using_command fish' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for \? ------- +complete -c beet -n '__fish_beet_needs_command' -a \? -f -d 'give detailed help on a specific sub-command' +complete -c beet -n '__fish_beet_using_command \?' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for help ------- +complete -c beet -n '__fish_beet_needs_command' -a help -f -d 'give detailed help on a specific sub-command' +complete -c beet -n '__fish_beet_using_command help' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for imp ------- +complete -c beet -n '__fish_beet_needs_command' -a imp -f -d 'import new music' +complete -c beet -n '__fish_beet_using_command imp' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for im ------- +complete -c beet -n '__fish_beet_needs_command' -a im -f -d 'import new music' +complete -c beet -n '__fish_beet_using_command im' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for import ------- +complete -c beet -n '__fish_beet_needs_command' -a import -f -d 'import new music' +complete -c beet -n '__fish_beet_using_command import' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for info ------- +complete -c beet -n '__fish_beet_needs_command' -a info -f -d 'show file metadata' +complete -c beet -n '__fish_beet_using_command info' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for ls ------- +complete -c beet -n '__fish_beet_needs_command' -a ls -f -d 'query the library' +complete -c beet -n '__fish_beet_using_command ls' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for list ------- +complete -c beet -n '__fish_beet_needs_command' -a list -f -d 'query the library' +complete -c beet -n '__fish_beet_using_command list' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for miss ------- +complete -c beet -n '__fish_beet_needs_command' -a miss -f -d 'List missing tracks.' +complete -c beet -n '__fish_beet_using_command miss' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for missing ------- +complete -c beet -n '__fish_beet_needs_command' -a missing -f -d 'List missing tracks.' +complete -c beet -n '__fish_beet_using_command missing' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for mod ------- +complete -c beet -n '__fish_beet_needs_command' -a mod -f -d 'change metadata fields' +complete -c beet -n '__fish_beet_using_command mod' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for modify ------- +complete -c beet -n '__fish_beet_needs_command' -a modify -f -d 'change metadata fields' +complete -c beet -n '__fish_beet_using_command modify' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for mv ------- +complete -c beet -n '__fish_beet_needs_command' -a mv -f -d 'move or copy items' +complete -c beet -n '__fish_beet_using_command mv' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for move ------- +complete -c beet -n '__fish_beet_needs_command' -a move -f -d 'move or copy items' +complete -c beet -n '__fish_beet_using_command move' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for rm ------- +complete -c beet -n '__fish_beet_needs_command' -a rm -f -d 'remove matching items from the library' +complete -c beet -n '__fish_beet_using_command rm' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for remove ------- +complete -c beet -n '__fish_beet_needs_command' -a remove -f -d 'remove matching items from the library' +complete -c beet -n '__fish_beet_using_command remove' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for spotify ------- +complete -c beet -n '__fish_beet_needs_command' -a spotify -f -d 'build a Spotify playlist' +complete -c beet -n '__fish_beet_using_command spotify' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for stats ------- +complete -c beet -n '__fish_beet_needs_command' -a stats -f -d 'show statistics about the library or a query' +complete -c beet -n '__fish_beet_using_command stats' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for upd ------- +complete -c beet -n '__fish_beet_needs_command' -a upd -f -d 'update the library' +complete -c beet -n '__fish_beet_using_command upd' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for up ------- +complete -c beet -n '__fish_beet_needs_command' -a up -f -d 'update the library' +complete -c beet -n '__fish_beet_using_command up' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for update ------- +complete -c beet -n '__fish_beet_needs_command' -a update -f -d 'update the library' +complete -c beet -n '__fish_beet_using_command update' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for version ------- +complete -c beet -n '__fish_beet_needs_command' -a version -f -d 'output version information' +complete -c beet -n '__fish_beet_using_command version' -a '$FIELDS' -f -d 'fieldname' + +# ------ fieldsetups for write ------- +complete -c beet -n '__fish_beet_needs_command' -a write -f -d 'write tag information to files' +complete -c beet -n '__fish_beet_using_command write' -a '$FIELDS' -f -d 'fieldname' + + + +# ====== completions for bpmanalyser ===== +complete -c beet -n '__fish_beet_using_command bpmanalyser' -s d -l dry-run -f -d '[default: False] display the bpm values but do not update the library items' +complete -c beet -n '__fish_beet_using_command bpmanalyser' -s w -l write -f -d '[default: True] write the bpm values to the media files' +complete -c beet -n '__fish_beet_using_command bpmanalyser' -r -s t -l threads -f -d '[default: 8] the number of threads to run in parallel' +complete -c beet -n '__fish_beet_using_command bpmanalyser' -s f -l force -f -d '[default: False] force analysis of items with non-zero bpm values' +complete -c beet -n '__fish_beet_using_command bpmanalyser' -s q -l quiet -f -d '[default: False] mute all output' +complete -c beet -n '__fish_beet_using_command bpmanalyser' -s v -l version -f -d 'show plugin version' +complete -c beet -n '__fish_beet_using_command bpmanalyser' -s h -l help -f -d 'print help' + + +# ====== completions for clearart ===== +complete -c beet -n '__fish_beet_using_command clearart' -s y -l yes -f -d 'skip confirmation' +complete -c beet -n '__fish_beet_using_command clearart' -s h -l help -f -d 'print help' + + +# ====== completions for completion ===== +complete -c beet -n '__fish_beet_using_command completion' -s h -l help -f -d 'print help' + + +# ====== completions for config ===== +complete -c beet -n '__fish_beet_using_command config' -s p -l paths -f -d 'show files that configuration was loaded from' +complete -c beet -n '__fish_beet_using_command config' -s e -l edit -f -d 'edit user configuration with $EDITOR' +complete -c beet -n '__fish_beet_using_command config' -s d -l defaults -f -d 'include the default configuration' +complete -c beet -n '__fish_beet_using_command config' -s c -l clear -f -d 'do not redact sensitive fields' +complete -c beet -n '__fish_beet_using_command config' -s h -l help -f -d 'print help' + + +# ====== completions for convert ===== +complete -c beet -n '__fish_beet_using_command convert' -s p -l pretend -f -d 'show actions but do nothing' +complete -c beet -n '__fish_beet_using_command convert' -r -s t -l threads -f -d 'change the number of threads, defaults to maximum available processors' +complete -c beet -n '__fish_beet_using_command convert' -s k -l keep-new -f -d 'keep only the converted and move the old files' +complete -c beet -n '__fish_beet_using_command convert' -r -s d -l dest -f -d 'set the destination directory' +complete -c beet -n '__fish_beet_using_command convert' -r -s f -l format -f -d 'set the target format of the tracks' +complete -c beet -n '__fish_beet_using_command convert' -s y -l yes -f -d 'do not ask for confirmation' +complete -c beet -n '__fish_beet_using_command convert' -s l -l link -f -d 'symlink files that do not need transcoding.' +complete -c beet -n '__fish_beet_using_command convert' -s H -l hardlink -f -d 'hardlink files that do not need transcoding. Overrides --link.' +complete -c beet -n '__fish_beet_using_command convert' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command convert' -s h -l help -f -d 'print help' + + +# ====== completions for dup ===== +complete -c beet -n '__fish_beet_using_command dup' -s c -l count -f -d 'show duplicate counts' +complete -c beet -n '__fish_beet_using_command dup' -r -s C -l checksum -f -d 'report duplicates based on arbitrary command' +complete -c beet -n '__fish_beet_using_command dup' -s d -l delete -f -d 'delete items from library and disk' +complete -c beet -n '__fish_beet_using_command dup' -s F -l full -f -d 'show all versions of duplicate tracks or albums' +complete -c beet -n '__fish_beet_using_command dup' -s s -l strict -f -d 'report duplicates only if all attributes are set' +complete -c beet -n '__fish_beet_using_command dup' -r -s k -l key -f -d 'report duplicates based on keys (use multiple times)' +complete -c beet -n '__fish_beet_using_command dup' -s M -l merge -f -d 'merge duplicate items' +complete -c beet -n '__fish_beet_using_command dup' -r -s m -l move -f -d 'move items to dest' +complete -c beet -n '__fish_beet_using_command dup' -r -s o -l copy -f -d 'copy items to dest' +complete -c beet -n '__fish_beet_using_command dup' -r -s t -l tag -f -d "tag matched items with 'k=v' attribute" +complete -c beet -n '__fish_beet_using_command dup' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command dup' -s p -l path -f -d 'print paths for matched items or albums' +complete -c beet -n '__fish_beet_using_command dup' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command dup' -s h -l help -f -d 'print help' + + +# ====== completions for duplicates ===== +complete -c beet -n '__fish_beet_using_command duplicates' -s c -l count -f -d 'show duplicate counts' +complete -c beet -n '__fish_beet_using_command duplicates' -r -s C -l checksum -f -d 'report duplicates based on arbitrary command' +complete -c beet -n '__fish_beet_using_command duplicates' -s d -l delete -f -d 'delete items from library and disk' +complete -c beet -n '__fish_beet_using_command duplicates' -s F -l full -f -d 'show all versions of duplicate tracks or albums' +complete -c beet -n '__fish_beet_using_command duplicates' -s s -l strict -f -d 'report duplicates only if all attributes are set' +complete -c beet -n '__fish_beet_using_command duplicates' -r -s k -l key -f -d 'report duplicates based on keys (use multiple times)' +complete -c beet -n '__fish_beet_using_command duplicates' -s M -l merge -f -d 'merge duplicate items' +complete -c beet -n '__fish_beet_using_command duplicates' -r -s m -l move -f -d 'move items to dest' +complete -c beet -n '__fish_beet_using_command duplicates' -r -s o -l copy -f -d 'copy items to dest' +complete -c beet -n '__fish_beet_using_command duplicates' -r -s t -l tag -f -d "tag matched items with 'k=v' attribute" +complete -c beet -n '__fish_beet_using_command duplicates' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command duplicates' -s p -l path -f -d 'print paths for matched items or albums' +complete -c beet -n '__fish_beet_using_command duplicates' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command duplicates' -s h -l help -f -d 'print help' + + +# ====== completions for embedart ===== +complete -c beet -n '__fish_beet_using_command embedart' -r -s f -l file -f -d 'the image file to embed' +complete -c beet -n '__fish_beet_using_command embedart' -s y -l yes -f -d 'skip confirmation' +complete -c beet -n '__fish_beet_using_command embedart' -s h -l help -f -d 'print help' + + +# ====== completions for extractart ===== +complete -c beet -n '__fish_beet_using_command extractart' -r -s o -f -d 'image output file' +complete -c beet -n '__fish_beet_using_command extractart' -r -s n -f -d 'image filename to create for all matched albums' +complete -c beet -n '__fish_beet_using_command extractart' -s a -f -d 'associate the extracted images with the album' +complete -c beet -n '__fish_beet_using_command extractart' -s h -l help -f -d 'print help' + + +# ====== completions for fetchart ===== +complete -c beet -n '__fish_beet_using_command fetchart' -s f -l force -f -d 're-download art when already present' +complete -c beet -n '__fish_beet_using_command fetchart' -s q -l quiet -f -d 'quiet mode: do not output albums that already have artwork' +complete -c beet -n '__fish_beet_using_command fetchart' -s h -l help -f -d 'print help' + + +# ====== completions for fields ===== +complete -c beet -n '__fish_beet_using_command fields' -s h -l help -f -d 'print help' + + +# ====== completions for fish ===== +complete -c beet -n '__fish_beet_using_command fish' -s f -l noFields -f -d 'omit album/track field completions' +complete -c beet -n '__fish_beet_using_command fish' -r -s e -l extravalues -f -a 'id path album_id title artist artist_sort artist_credit album albumartist albumartist_sort albumartist_credit genre style discogs_albumid discogs_artistid discogs_labelid lyricist composer composer_sort work mb_workid work_disambig arranger grouping year month day track tracktotal disc disctotal lyrics comments bpm comp mb_trackid mb_albumid mb_artistid mb_albumartistid mb_releasetrackid trackdisambig albumtype albumtypes label acoustid_fingerprint acoustid_id mb_releasegroupid asin isrc catalognum script language country albumstatus media albumdisambig releasegroupdisambig disctitle encoder rg_track_gain rg_track_peak rg_album_gain rg_album_peak r128_track_gain r128_album_gain original_year original_month original_day initial_key length bitrate format samplerate bitdepth channels mtime added singleton filesize id artpath added albumartist albumartist_sort albumartist_credit album genre style discogs_albumid discogs_artistid discogs_labelid year month day disctotal comp mb_albumid mb_albumartistid albumtype albumtypes label mb_releasegroupid asin catalognum script language country albumstatus albumdisambig releasegroupdisambig rg_album_gain rg_album_peak r128_album_gain original_year original_month original_day missing path albumtotal' -d 'include specified field *values* in completions' +complete -c beet -n '__fish_beet_using_command fish' -s h -l help -f -d 'print help' + + +# ====== completions for \? ===== +complete -c beet -n '__fish_beet_using_command \?' -s h -l help -f -d 'print help' + + +# ====== completions for help ===== +complete -c beet -n '__fish_beet_using_command help' -s h -l help -f -d 'print help' + + +# ====== completions for imp ===== +complete -c beet -n '__fish_beet_using_command imp' -s c -l copy -f -d 'copy tracks into library directory (default)' +complete -c beet -n '__fish_beet_using_command imp' -s C -l nocopy -f -d "don't copy tracks (opposite of -c)" +complete -c beet -n '__fish_beet_using_command imp' -s m -l move -f -d 'move tracks into the library (overrides -c)' +complete -c beet -n '__fish_beet_using_command imp' -s w -l write -f -d "write new metadata to files' tags (default)" +complete -c beet -n '__fish_beet_using_command imp' -s W -l nowrite -f -d "don't write metadata (opposite of -w)" +complete -c beet -n '__fish_beet_using_command imp' -s a -l autotag -f -d 'infer tags for imported files (default)' +complete -c beet -n '__fish_beet_using_command imp' -s A -l noautotag -f -d "don't infer tags for imported files (opposite of -a)" +complete -c beet -n '__fish_beet_using_command imp' -s p -l resume -f -d 'resume importing if interrupted' +complete -c beet -n '__fish_beet_using_command imp' -s P -l noresume -f -d 'do not try to resume importing' +complete -c beet -n '__fish_beet_using_command imp' -s q -l quiet -f -d 'never prompt for input: skip albums instead' +complete -c beet -n '__fish_beet_using_command imp' -r -s l -l log -f -d 'file to log untaggable albums for later review' +complete -c beet -n '__fish_beet_using_command imp' -s s -l singletons -f -d 'import individual tracks instead of full albums' +complete -c beet -n '__fish_beet_using_command imp' -s t -l timid -f -d 'always confirm all actions' +complete -c beet -n '__fish_beet_using_command imp' -s L -l library -f -d 'retag items matching a query' +complete -c beet -n '__fish_beet_using_command imp' -s i -l incremental -f -d 'skip already-imported directories' +complete -c beet -n '__fish_beet_using_command imp' -s I -l noincremental -f -d 'do not skip already-imported directories' +complete -c beet -n '__fish_beet_using_command imp' -l from-scratch -f -d 'erase existing metadata before applying new metadata' +complete -c beet -n '__fish_beet_using_command imp' -l flat -f -d 'import an entire tree as a single album' +complete -c beet -n '__fish_beet_using_command imp' -s g -l group-albums -f -d 'group tracks in a folder into separate albums' +complete -c beet -n '__fish_beet_using_command imp' -l pretend -f -d 'just print the files to import' +complete -c beet -n '__fish_beet_using_command imp' -r -s S -l search-id -f -d 'restrict matching to a specific metadata backend ID' +complete -c beet -n '__fish_beet_using_command imp' -r -l set -f -d 'set the given fields to the supplied values' +complete -c beet -n '__fish_beet_using_command imp' -s h -l help -f -d 'print help' + + +# ====== completions for im ===== +complete -c beet -n '__fish_beet_using_command im' -s c -l copy -f -d 'copy tracks into library directory (default)' +complete -c beet -n '__fish_beet_using_command im' -s C -l nocopy -f -d "don't copy tracks (opposite of -c)" +complete -c beet -n '__fish_beet_using_command im' -s m -l move -f -d 'move tracks into the library (overrides -c)' +complete -c beet -n '__fish_beet_using_command im' -s w -l write -f -d "write new metadata to files' tags (default)" +complete -c beet -n '__fish_beet_using_command im' -s W -l nowrite -f -d "don't write metadata (opposite of -w)" +complete -c beet -n '__fish_beet_using_command im' -s a -l autotag -f -d 'infer tags for imported files (default)' +complete -c beet -n '__fish_beet_using_command im' -s A -l noautotag -f -d "don't infer tags for imported files (opposite of -a)" +complete -c beet -n '__fish_beet_using_command im' -s p -l resume -f -d 'resume importing if interrupted' +complete -c beet -n '__fish_beet_using_command im' -s P -l noresume -f -d 'do not try to resume importing' +complete -c beet -n '__fish_beet_using_command im' -s q -l quiet -f -d 'never prompt for input: skip albums instead' +complete -c beet -n '__fish_beet_using_command im' -r -s l -l log -f -d 'file to log untaggable albums for later review' +complete -c beet -n '__fish_beet_using_command im' -s s -l singletons -f -d 'import individual tracks instead of full albums' +complete -c beet -n '__fish_beet_using_command im' -s t -l timid -f -d 'always confirm all actions' +complete -c beet -n '__fish_beet_using_command im' -s L -l library -f -d 'retag items matching a query' +complete -c beet -n '__fish_beet_using_command im' -s i -l incremental -f -d 'skip already-imported directories' +complete -c beet -n '__fish_beet_using_command im' -s I -l noincremental -f -d 'do not skip already-imported directories' +complete -c beet -n '__fish_beet_using_command im' -l from-scratch -f -d 'erase existing metadata before applying new metadata' +complete -c beet -n '__fish_beet_using_command im' -l flat -f -d 'import an entire tree as a single album' +complete -c beet -n '__fish_beet_using_command im' -s g -l group-albums -f -d 'group tracks in a folder into separate albums' +complete -c beet -n '__fish_beet_using_command im' -l pretend -f -d 'just print the files to import' +complete -c beet -n '__fish_beet_using_command im' -r -s S -l search-id -f -d 'restrict matching to a specific metadata backend ID' +complete -c beet -n '__fish_beet_using_command im' -r -l set -f -d 'set the given fields to the supplied values' +complete -c beet -n '__fish_beet_using_command im' -s h -l help -f -d 'print help' + + +# ====== completions for import ===== +complete -c beet -n '__fish_beet_using_command import' -s c -l copy -f -d 'copy tracks into library directory (default)' +complete -c beet -n '__fish_beet_using_command import' -s C -l nocopy -f -d "don't copy tracks (opposite of -c)" +complete -c beet -n '__fish_beet_using_command import' -s m -l move -f -d 'move tracks into the library (overrides -c)' +complete -c beet -n '__fish_beet_using_command import' -s w -l write -f -d "write new metadata to files' tags (default)" +complete -c beet -n '__fish_beet_using_command import' -s W -l nowrite -f -d "don't write metadata (opposite of -w)" +complete -c beet -n '__fish_beet_using_command import' -s a -l autotag -f -d 'infer tags for imported files (default)' +complete -c beet -n '__fish_beet_using_command import' -s A -l noautotag -f -d "don't infer tags for imported files (opposite of -a)" +complete -c beet -n '__fish_beet_using_command import' -s p -l resume -f -d 'resume importing if interrupted' +complete -c beet -n '__fish_beet_using_command import' -s P -l noresume -f -d 'do not try to resume importing' +complete -c beet -n '__fish_beet_using_command import' -s q -l quiet -f -d 'never prompt for input: skip albums instead' +complete -c beet -n '__fish_beet_using_command import' -r -s l -l log -f -d 'file to log untaggable albums for later review' +complete -c beet -n '__fish_beet_using_command import' -s s -l singletons -f -d 'import individual tracks instead of full albums' +complete -c beet -n '__fish_beet_using_command import' -s t -l timid -f -d 'always confirm all actions' +complete -c beet -n '__fish_beet_using_command import' -s L -l library -f -d 'retag items matching a query' +complete -c beet -n '__fish_beet_using_command import' -s i -l incremental -f -d 'skip already-imported directories' +complete -c beet -n '__fish_beet_using_command import' -s I -l noincremental -f -d 'do not skip already-imported directories' +complete -c beet -n '__fish_beet_using_command import' -l from-scratch -f -d 'erase existing metadata before applying new metadata' +complete -c beet -n '__fish_beet_using_command import' -l flat -f -d 'import an entire tree as a single album' +complete -c beet -n '__fish_beet_using_command import' -s g -l group-albums -f -d 'group tracks in a folder into separate albums' +complete -c beet -n '__fish_beet_using_command import' -l pretend -f -d 'just print the files to import' +complete -c beet -n '__fish_beet_using_command import' -r -s S -l search-id -f -d 'restrict matching to a specific metadata backend ID' +complete -c beet -n '__fish_beet_using_command import' -r -l set -f -d 'set the given fields to the supplied values' +complete -c beet -n '__fish_beet_using_command import' -s h -l help -f -d 'print help' + + +# ====== completions for info ===== +complete -c beet -n '__fish_beet_using_command info' -s l -l library -f -d 'show library fields instead of tags' +complete -c beet -n '__fish_beet_using_command info' -s a -l album -f -d 'show album fields instead of tracks (implies "--library")' +complete -c beet -n '__fish_beet_using_command info' -s s -l summarize -f -d 'summarize the tags of all files' +complete -c beet -n '__fish_beet_using_command info' -r -s i -l include-keys -f -d 'comma separated list of keys to show' +complete -c beet -n '__fish_beet_using_command info' -s k -l keys-only -f -d 'show only the keys' +complete -c beet -n '__fish_beet_using_command info' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command info' -s h -l help -f -d 'print help' + + +# ====== completions for ls ===== +complete -c beet -n '__fish_beet_using_command ls' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command ls' -s p -l path -f -d 'print paths for matched items or albums' +complete -c beet -n '__fish_beet_using_command ls' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command ls' -s h -l help -f -d 'print help' + + +# ====== completions for list ===== +complete -c beet -n '__fish_beet_using_command list' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command list' -s p -l path -f -d 'print paths for matched items or albums' +complete -c beet -n '__fish_beet_using_command list' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command list' -s h -l help -f -d 'print help' + + +# ====== completions for miss ===== +complete -c beet -n '__fish_beet_using_command miss' -s c -l count -f -d 'count missing tracks per album' +complete -c beet -n '__fish_beet_using_command miss' -s t -l total -f -d 'count total of missing tracks' +complete -c beet -n '__fish_beet_using_command miss' -s a -l album -f -d 'show missing albums for artist instead of tracks' +complete -c beet -n '__fish_beet_using_command miss' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command miss' -s h -l help -f -d 'print help' + + +# ====== completions for missing ===== +complete -c beet -n '__fish_beet_using_command missing' -s c -l count -f -d 'count missing tracks per album' +complete -c beet -n '__fish_beet_using_command missing' -s t -l total -f -d 'count total of missing tracks' +complete -c beet -n '__fish_beet_using_command missing' -s a -l album -f -d 'show missing albums for artist instead of tracks' +complete -c beet -n '__fish_beet_using_command missing' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command missing' -s h -l help -f -d 'print help' + + +# ====== completions for mod ===== +complete -c beet -n '__fish_beet_using_command mod' -s m -l move -f -d 'move files in the library directory' +complete -c beet -n '__fish_beet_using_command mod' -s M -l nomove -f -d "don't move files in library" +complete -c beet -n '__fish_beet_using_command mod' -s w -l write -f -d "write new metadata to files' tags (default)" +complete -c beet -n '__fish_beet_using_command mod' -s W -l nowrite -f -d "don't write metadata (opposite of -w)" +complete -c beet -n '__fish_beet_using_command mod' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command mod' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command mod' -s y -l yes -f -d 'skip confirmation' +complete -c beet -n '__fish_beet_using_command mod' -s h -l help -f -d 'print help' + + +# ====== completions for modify ===== +complete -c beet -n '__fish_beet_using_command modify' -s m -l move -f -d 'move files in the library directory' +complete -c beet -n '__fish_beet_using_command modify' -s M -l nomove -f -d "don't move files in library" +complete -c beet -n '__fish_beet_using_command modify' -s w -l write -f -d "write new metadata to files' tags (default)" +complete -c beet -n '__fish_beet_using_command modify' -s W -l nowrite -f -d "don't write metadata (opposite of -w)" +complete -c beet -n '__fish_beet_using_command modify' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command modify' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command modify' -s y -l yes -f -d 'skip confirmation' +complete -c beet -n '__fish_beet_using_command modify' -s h -l help -f -d 'print help' + + +# ====== completions for mv ===== +complete -c beet -n '__fish_beet_using_command mv' -r -s d -l dest -f -d 'destination directory' +complete -c beet -n '__fish_beet_using_command mv' -s c -l copy -f -d 'copy instead of moving' +complete -c beet -n '__fish_beet_using_command mv' -s p -l pretend -f -d "show how files would be moved, but don't touch anything" +complete -c beet -n '__fish_beet_using_command mv' -s t -l timid -f -d 'always confirm all actions' +complete -c beet -n '__fish_beet_using_command mv' -s e -l export -f -d 'copy without changing the database path' +complete -c beet -n '__fish_beet_using_command mv' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command mv' -s h -l help -f -d 'print help' + + +# ====== completions for move ===== +complete -c beet -n '__fish_beet_using_command move' -r -s d -l dest -f -d 'destination directory' +complete -c beet -n '__fish_beet_using_command move' -s c -l copy -f -d 'copy instead of moving' +complete -c beet -n '__fish_beet_using_command move' -s p -l pretend -f -d "show how files would be moved, but don't touch anything" +complete -c beet -n '__fish_beet_using_command move' -s t -l timid -f -d 'always confirm all actions' +complete -c beet -n '__fish_beet_using_command move' -s e -l export -f -d 'copy without changing the database path' +complete -c beet -n '__fish_beet_using_command move' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command move' -s h -l help -f -d 'print help' + + +# ====== completions for rm ===== +complete -c beet -n '__fish_beet_using_command rm' -s d -l delete -f -d 'also remove files from disk' +complete -c beet -n '__fish_beet_using_command rm' -s f -l force -f -d 'do not ask when removing items' +complete -c beet -n '__fish_beet_using_command rm' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command rm' -s h -l help -f -d 'print help' + + +# ====== completions for remove ===== +complete -c beet -n '__fish_beet_using_command remove' -s d -l delete -f -d 'also remove files from disk' +complete -c beet -n '__fish_beet_using_command remove' -s f -l force -f -d 'do not ask when removing items' +complete -c beet -n '__fish_beet_using_command remove' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command remove' -s h -l help -f -d 'print help' + + +# ====== completions for spotify ===== +complete -c beet -n '__fish_beet_using_command spotify' -r -s m -l mode -f -d '"open" to open Spotify with playlist, "list" to print (default)' +complete -c beet -n '__fish_beet_using_command spotify' -s f -l show-failures -f -d 'list tracks that did not match a Spotify ID' +complete -c beet -n '__fish_beet_using_command spotify' -s h -l help -f -d 'print help' + + +# ====== completions for stats ===== +complete -c beet -n '__fish_beet_using_command stats' -s e -l exact -f -d 'exact size and time' +complete -c beet -n '__fish_beet_using_command stats' -s h -l help -f -d 'print help' + + +# ====== completions for upd ===== +complete -c beet -n '__fish_beet_using_command upd' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command upd' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command upd' -s m -l move -f -d 'move files in the library directory' +complete -c beet -n '__fish_beet_using_command upd' -s M -l nomove -f -d "don't move files in library" +complete -c beet -n '__fish_beet_using_command upd' -s p -l pretend -f -d 'show all changes but do nothing' +complete -c beet -n '__fish_beet_using_command upd' -r -s F -l field -f -d 'list of fields to update' +complete -c beet -n '__fish_beet_using_command upd' -s h -l help -f -d 'print help' + + +# ====== completions for up ===== +complete -c beet -n '__fish_beet_using_command up' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command up' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command up' -s m -l move -f -d 'move files in the library directory' +complete -c beet -n '__fish_beet_using_command up' -s M -l nomove -f -d "don't move files in library" +complete -c beet -n '__fish_beet_using_command up' -s p -l pretend -f -d 'show all changes but do nothing' +complete -c beet -n '__fish_beet_using_command up' -r -s F -l field -f -d 'list of fields to update' +complete -c beet -n '__fish_beet_using_command up' -s h -l help -f -d 'print help' + + +# ====== completions for update ===== +complete -c beet -n '__fish_beet_using_command update' -s a -l album -f -d 'match albums instead of tracks' +complete -c beet -n '__fish_beet_using_command update' -r -s f -l format -f -d 'print with custom format' +complete -c beet -n '__fish_beet_using_command update' -s m -l move -f -d 'move files in the library directory' +complete -c beet -n '__fish_beet_using_command update' -s M -l nomove -f -d "don't move files in library" +complete -c beet -n '__fish_beet_using_command update' -s p -l pretend -f -d 'show all changes but do nothing' +complete -c beet -n '__fish_beet_using_command update' -r -s F -l field -f -d 'list of fields to update' +complete -c beet -n '__fish_beet_using_command update' -s h -l help -f -d 'print help' + + +# ====== completions for version ===== +complete -c beet -n '__fish_beet_using_command version' -s h -l help -f -d 'print help' + + +# ====== completions for write ===== +complete -c beet -n '__fish_beet_using_command write' -s p -l pretend -f -d 'show all changes but do nothing' +complete -c beet -n '__fish_beet_using_command write' -s f -l force -f -d 'write tags even if the existing tags match the database' +complete -c beet -n '__fish_beet_using_command write' -s h -l help -f -d 'print help' \ No newline at end of file diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 2fddce3..59a861c 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -1,12 +1,9 @@ if not status is-interactive exit end - -# fish -set -gx FISH_CFG $XDG_CONFIG_HOME/fish -set -g fish_greeting -source $FISH_CFG/path.fish -set -gx LANG "en_US.UTF-8" +# for agent in $(pidof ssh-agent | string split " ") +# kill $agent +# end # xdg set -gx XDG_CONFIG_HOME "$HOME/.config" @@ -14,15 +11,39 @@ set -gx XDG_CACHE_HOME "$HOME/.cache" set -gx XDG_DATA_HOME "$HOME/.local/share" set -gx XDG_STATE_HOME "$HOME/.local/state" +# fish +set -gx FISH_CFG $XDG_CONFIG_HOME/fish +set -g fish_greeting +set -gx LANG "en_US.UTF-8" + +# home pollution fixes +set -gx CARGO_HOME "$XDG_DATA_HOME/cargo" +set -gx RUSTUP_HOME "$XDG_DATA_HOME/rustup" +set -gx GOPATH "$XDG_DATA_HOME/go" +set -gx GRADLE_USER_HOME "$XDG_DATA_HOME/gradle" +set -gx GTK2_RC_FILES "$XDG_CONFIG_HOME/gtk-2.0/gtkrc" +set -gx XCURSOR_PATH "/usr/share/icons:$XDG_DATA_HOME/icons" +set -gx LESSHISTFILE "$XDG_STATE_HOME/less/history" +set -gx NODE_REPL_HISTORY "$XDG_DATA_HOME/node_repl_history" +set -gx NPM_CONFIG_USERCONFIG "$XDG_CONFIG_HOME/npm/npmrc" +set -gx _JAVA_OPTIONS "-Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java" +set -gx NUGET_PACKAGES "$XDG_CACHE_HOME/NuGetPackages" +set -gx PASSWORD_STORE_DIR "$XDG_DATA_HOME/pass" +set -gx PYTHONSTARTUP "/etc/python/pythonrc" +set -gx W3M_DIR "$XDG_DATA_HOME/w3m" +set -gx PNPM_HOME "$HOME/.local/share/pnpm" + # program set -gx EDITOR "nvim" -set -gx VISUAL "lite-xl" +# set -gx VISUAL "lite-xl" +set -gx MANPAGER "nvim +Man!" +set -gx MANWIDTH 999 set -gx PF_INFO "ascii title os wm editor shell kernel palette" set -gx BAT_THEME "ansi" -set -gx PNPM_HOME "$HOME/.local/share/pnpm" -set -gx GTK_USE_PORTAL 1 set -gx LITE_SCALE 1.3 set -gx RANGER_LOAD_DEFAULT_RC "FALSE" +# set -gx MANPATH /usr/local/texlive/2023/texmf-dist/doc/man +set -gx INFOPATH /usr/local/texlive/2023/texmf-dist/doc/info # $PATH source $FISH_CFG/path.fish @@ -36,20 +57,44 @@ source $FISH_CFG/bindings.fish # configs source $FISH_CFG/done_cfg.fish +# source /opt/asdf-vm/asdf.fish + # abbreviations & aliases abbr -a paru paru --limit 10 -abbr -a projects cd ~/DesktopTemp/RealProjects +abbr -a projects cd ~/Documents/RealProjects abbr -a gc git commit -m abbr -a ga git add abbr -a gcl git clone +abbr -a pq pacman -Qqi +abbr -a gt git log --oneline --graph --decorate --all alias imgcat="wezterm imgcat" alias dots="git --git-dir=$HOME/.dots --work-tree=$HOME" -alias sudo="doas" +# alias sudo="doas" alias ls="ls --color=auto" +alias grep="grep -P --color=always" +alias molest="sudo touch" +alias wget="wget --hsts-file=$XDG_DATA_HOME/wget-hsts" +alias stylua="stylua -s" +alias cd="z" +alias n="nvim ." +function y + set tmp (mktemp -t "yazi-cwd.XXXXXX") + yazi $argv --cwd-file="$tmp" + if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] + builtin cd -- "$cwd" + end + rm -f -- "$tmp" +end function ssh export TERM=xterm-color /usr/bin/ssh $argv - export TERM=xterm-kitty + export TERM=xterm-256color +end +function flac_preview + # nsxiv (ffmpeg -i $argv[1] -v 8 -t 30 -lavfi showspectrumpic=s=hd720 -f image2 pipe: | psub) + nsxiv (ffmpeg -i $argv[1] -v 8 -t 30 -lavfi showspectrumpic=s=2k -f image2 pipe: | psub) + + end function multicd echo (string repeat -n (math (string length -- $argv[1]) - 1) ../) @@ -58,8 +103,16 @@ abbr -a dotdot --regex '^\.\.+$' --position anywhere --function multicd function last_history_item echo $history[1] end +function post_exec_line --on-event fish_postexec + if not string match -qr "^clear" $argv[1] + echo "" + end +end abbr -a !! --position anywhere --function last_history_item # shell init -eval "$(ssh-agent -c)" +# eval "$(ssh-agent -c)" &>/dev/null +fish_ssh_agent starship init fish | source +zoxide init fish | source +direnv hook fish | source diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables index fc6415f..2ac8f35 100644 --- a/.config/fish/fish_variables +++ b/.config/fish/fish_variables @@ -1,11 +1,11 @@ # This file contains fish universal variable definitions. # VERSION: 3.0 SETUVAR __done_exclude:lite\x2dxl -SETUVAR __fish_initialized:3400 -SETUVAR fish_color_autosuggestion:\x238893a5 +SETUVAR __fish_initialized:3800 +SETUVAR fish_color_autosuggestion:\x2377828c SETUVAR fish_color_cancel:\x2dr SETUVAR fish_color_command:white -SETUVAR fish_color_comment:\x238893a5 +SETUVAR fish_color_comment:\x2377828c SETUVAR fish_color_cwd:green SETUVAR fish_color_cwd_root:red SETUVAR fish_color_end:pink @@ -26,9 +26,9 @@ SETUVAR fish_color_user:brgreen SETUVAR fish_color_valid_path:white SETUVAR fish_greeting:\x1d SETUVAR fish_key_bindings:fish_default_key_bindings -SETUVAR fish_pager_color_completion:\x238893a5 -SETUVAR fish_pager_color_description:\x238893a5 +SETUVAR fish_pager_color_completion:\x2377828c +SETUVAR fish_pager_color_description:\x2377828c SETUVAR fish_pager_color_prefix:white -SETUVAR fish_pager_color_progress:\x238893a5 +SETUVAR fish_pager_color_progress:\x2377828c SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dblack -SETUVAR fish_user_paths:/home/delta/\x2elocal/share/pnpm\x1e/home/delta/\x2elocal/bin\x1e/home/delta/\x2ecargo/bin\x1e/home/delta/\x2elocal/share/gem/ruby/3\x2e0\x2e0/bin\x1e/home/delta/\x2espicetify\x1e/home/delta/go/bin\x1e/home/delta/\x2edeno/bin +SETUVAR fish_user_paths:/home/delta/\x2elocal/share/pnpm\x1e/home/delta/\x2elocal/bin\x1e/home/delta/\x2elocal/share/cargo/bin\x1e/home/delta/\x2elocal/share/gem/ruby/3\x2e0\x2e0/bin\x1e/home/delta/\x2elocal/share/go/bin\x1e/home/delta/\x2edetaspace/bin\x1e/usr/local/texlive/2023/bin/x86_64\x2dlinux diff --git a/.config/fish/functions/fish_commandline_toggle.fish b/.config/fish/functions/fish_commandline_toggle.fish new file mode 100644 index 0000000..688c97e --- /dev/null +++ b/.config/fish/functions/fish_commandline_toggle.fish @@ -0,0 +1,26 @@ +function __commandline_stash -d 'Stash current command line' + set -g __stash_command_position (commandline -C) + set -g __stash_command (commandline -b) + commandline -r "" +end + +function __commandline_pop -d 'Pop last stashed command line' + if not set -q __stash_command + return + end + commandline -r $__stash_command + if set -q __stash_command_position + commandline -C $__stash_command_position + end + set -e __stash_command + set -e __stash_command_position +end + +function fish_commandline_toggle -d 'Stash current commandline if not empty, otherwise pop last stashed commandline' + set -l cmd (commandline -b) + if test "$cmd" + __commandline_stash + else + __commandline_pop + end +end diff --git a/.config/fish/functions/fish_ssh_agent.fish b/.config/fish/functions/fish_ssh_agent.fish new file mode 100644 index 0000000..5960b75 --- /dev/null +++ b/.config/fish/functions/fish_ssh_agent.fish @@ -0,0 +1,32 @@ +function __ssh_agent_is_started -d "check if ssh agent is already started" + if begin; test -f $SSH_ENV; and test -z "$SSH_AGENT_PID"; end + source $SSH_ENV > /dev/null + end + + if test -z "$SSH_AGENT_PID" + return 1 + end + + ps -ef | grep $SSH_AGENT_PID | grep -v grep | grep -q ssh-agent + #pgrep ssh-agent + return $status +end + + +function __ssh_agent_start -d "start a new ssh agent" + ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV + chmod 600 $SSH_ENV + source $SSH_ENV > /dev/null + true # suppress errors from setenv, i.e. set -gx +end + + +function fish_ssh_agent --description "Start ssh-agent if not started yet, or uses already started ssh-agent." + if test -z "$SSH_ENV" + set -xg SSH_ENV $HOME/.ssh/environment + end + + if not __ssh_agent_is_started + __ssh_agent_start + end +end diff --git a/.config/fish/path.fish b/.config/fish/path.fish index d0d3144..b977e7c 100644 --- a/.config/fish/path.fish +++ b/.config/fish/path.fish @@ -1,20 +1,14 @@ alias fp="fish_add_path -a" -# function pa -# set -x PATH PATH $argv[1] -# end -# -# function pp -# set -x PATH $argv[1] PATH -# end - -# ik this is not the "correct" way to set path but persistent path sucks +#set -gx PATH $PNPM_HOME ~/.local/bin $CARGO_HOME/bin ~/.local/share/gem/ruby/3.0.0/bin $GOPATH/bin ~/.detaspace/bin $PATH fp $PNPM_HOME -fp ~/.deno/bin fp ~/.local/bin fp ~/usr/bin -fp ~/.cargo/bin +fp $CARGO_HOME/bin fp ~/.local/share/gem/ruby/3.0.0/bin -fp ~/.spicetify -fp ~/go/bin +#fp ~/.spicetify +fp $GOPATH/bin +fp ~/.detaspace/bin +fp /usr/local/texlive/2023/bin/x86_64-linux +fp ~/.nix-profile/bin -- cgit v1.2.3