mirror of
https://github.com/ION606/config-backup.git
synced 2026-05-14 22:16:58 +00:00
overhaul
This commit is contained in:
@@ -0,0 +1,235 @@
|
||||
# fish completion for glow -*- shell-script -*-
|
||||
|
||||
function __glow_debug
|
||||
set -l file "$BASH_COMP_DEBUG_FILE"
|
||||
if test -n "$file"
|
||||
echo "$argv" >> $file
|
||||
end
|
||||
end
|
||||
|
||||
function __glow_perform_completion
|
||||
__glow_debug "Starting __glow_perform_completion"
|
||||
|
||||
# Extract all args except the last one
|
||||
set -l args (commandline -opc)
|
||||
# Extract the last arg and escape it in case it is a space
|
||||
set -l lastArg (string escape -- (commandline -ct))
|
||||
|
||||
__glow_debug "args: $args"
|
||||
__glow_debug "last arg: $lastArg"
|
||||
|
||||
# Disable ActiveHelp which is not supported for fish shell
|
||||
set -l requestComp "GLOW_ACTIVE_HELP=0 $args[1] __complete $args[2..-1] $lastArg"
|
||||
|
||||
__glow_debug "Calling $requestComp"
|
||||
set -l results (eval $requestComp 2> /dev/null)
|
||||
|
||||
# Some programs may output extra empty lines after the directive.
|
||||
# Let's ignore them or else it will break completion.
|
||||
# Ref: https://github.com/spf13/cobra/issues/1279
|
||||
for line in $results[-1..1]
|
||||
if test (string trim -- $line) = ""
|
||||
# Found an empty line, remove it
|
||||
set results $results[1..-2]
|
||||
else
|
||||
# Found non-empty line, we have our proper output
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
set -l comps $results[1..-2]
|
||||
set -l directiveLine $results[-1]
|
||||
|
||||
# For Fish, when completing a flag with an = (e.g., <program> -n=<TAB>)
|
||||
# completions must be prefixed with the flag
|
||||
set -l flagPrefix (string match -r -- '-.*=' "$lastArg")
|
||||
|
||||
__glow_debug "Comps: $comps"
|
||||
__glow_debug "DirectiveLine: $directiveLine"
|
||||
__glow_debug "flagPrefix: $flagPrefix"
|
||||
|
||||
for comp in $comps
|
||||
printf "%s%s\n" "$flagPrefix" "$comp"
|
||||
end
|
||||
|
||||
printf "%s\n" "$directiveLine"
|
||||
end
|
||||
|
||||
# this function limits calls to __glow_perform_completion, by caching the result behind $__glow_perform_completion_once_result
|
||||
function __glow_perform_completion_once
|
||||
__glow_debug "Starting __glow_perform_completion_once"
|
||||
|
||||
if test -n "$__glow_perform_completion_once_result"
|
||||
__glow_debug "Seems like a valid result already exists, skipping __glow_perform_completion"
|
||||
return 0
|
||||
end
|
||||
|
||||
set --global __glow_perform_completion_once_result (__glow_perform_completion)
|
||||
if test -z "$__glow_perform_completion_once_result"
|
||||
__glow_debug "No completions, probably due to a failure"
|
||||
return 1
|
||||
end
|
||||
|
||||
__glow_debug "Performed completions and set __glow_perform_completion_once_result"
|
||||
return 0
|
||||
end
|
||||
|
||||
# this function is used to clear the $__glow_perform_completion_once_result variable after completions are run
|
||||
function __glow_clear_perform_completion_once_result
|
||||
__glow_debug ""
|
||||
__glow_debug "========= clearing previously set __glow_perform_completion_once_result variable =========="
|
||||
set --erase __glow_perform_completion_once_result
|
||||
__glow_debug "Succesfully erased the variable __glow_perform_completion_once_result"
|
||||
end
|
||||
|
||||
function __glow_requires_order_preservation
|
||||
__glow_debug ""
|
||||
__glow_debug "========= checking if order preservation is required =========="
|
||||
|
||||
__glow_perform_completion_once
|
||||
if test -z "$__glow_perform_completion_once_result"
|
||||
__glow_debug "Error determining if order preservation is required"
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l directive (string sub --start 2 $__glow_perform_completion_once_result[-1])
|
||||
__glow_debug "Directive is: $directive"
|
||||
|
||||
set -l shellCompDirectiveKeepOrder 32
|
||||
set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2)
|
||||
__glow_debug "Keeporder is: $keeporder"
|
||||
|
||||
if test $keeporder -ne 0
|
||||
__glow_debug "This does require order preservation"
|
||||
return 0
|
||||
end
|
||||
|
||||
__glow_debug "This doesn't require order preservation"
|
||||
return 1
|
||||
end
|
||||
|
||||
|
||||
# This function does two things:
|
||||
# - Obtain the completions and store them in the global __glow_comp_results
|
||||
# - Return false if file completion should be performed
|
||||
function __glow_prepare_completions
|
||||
__glow_debug ""
|
||||
__glow_debug "========= starting completion logic =========="
|
||||
|
||||
# Start fresh
|
||||
set --erase __glow_comp_results
|
||||
|
||||
__glow_perform_completion_once
|
||||
__glow_debug "Completion results: $__glow_perform_completion_once_result"
|
||||
|
||||
if test -z "$__glow_perform_completion_once_result"
|
||||
__glow_debug "No completion, probably due to a failure"
|
||||
# Might as well do file completion, in case it helps
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l directive (string sub --start 2 $__glow_perform_completion_once_result[-1])
|
||||
set --global __glow_comp_results $__glow_perform_completion_once_result[1..-2]
|
||||
|
||||
__glow_debug "Completions are: $__glow_comp_results"
|
||||
__glow_debug "Directive is: $directive"
|
||||
|
||||
set -l shellCompDirectiveError 1
|
||||
set -l shellCompDirectiveNoSpace 2
|
||||
set -l shellCompDirectiveNoFileComp 4
|
||||
set -l shellCompDirectiveFilterFileExt 8
|
||||
set -l shellCompDirectiveFilterDirs 16
|
||||
|
||||
if test -z "$directive"
|
||||
set directive 0
|
||||
end
|
||||
|
||||
set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2)
|
||||
if test $compErr -eq 1
|
||||
__glow_debug "Received error directive: aborting."
|
||||
# Might as well do file completion, in case it helps
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2)
|
||||
set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2)
|
||||
if test $filefilter -eq 1; or test $dirfilter -eq 1
|
||||
__glow_debug "File extension filtering or directory filtering not supported"
|
||||
# Do full file completion instead
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2)
|
||||
set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2)
|
||||
|
||||
__glow_debug "nospace: $nospace, nofiles: $nofiles"
|
||||
|
||||
# If we want to prevent a space, or if file completion is NOT disabled,
|
||||
# we need to count the number of valid completions.
|
||||
# To do so, we will filter on prefix as the completions we have received
|
||||
# may not already be filtered so as to allow fish to match on different
|
||||
# criteria than the prefix.
|
||||
if test $nospace -ne 0; or test $nofiles -eq 0
|
||||
set -l prefix (commandline -t | string escape --style=regex)
|
||||
__glow_debug "prefix: $prefix"
|
||||
|
||||
set -l completions (string match -r -- "^$prefix.*" $__glow_comp_results)
|
||||
set --global __glow_comp_results $completions
|
||||
__glow_debug "Filtered completions are: $__glow_comp_results"
|
||||
|
||||
# Important not to quote the variable for count to work
|
||||
set -l numComps (count $__glow_comp_results)
|
||||
__glow_debug "numComps: $numComps"
|
||||
|
||||
if test $numComps -eq 1; and test $nospace -ne 0
|
||||
# We must first split on \t to get rid of the descriptions to be
|
||||
# able to check what the actual completion will be.
|
||||
# We don't need descriptions anyway since there is only a single
|
||||
# real completion which the shell will expand immediately.
|
||||
set -l split (string split --max 1 \t $__glow_comp_results[1])
|
||||
|
||||
# Fish won't add a space if the completion ends with any
|
||||
# of the following characters: @=/:.,
|
||||
set -l lastChar (string sub -s -1 -- $split)
|
||||
if not string match -r -q "[@=/:.,]" -- "$lastChar"
|
||||
# In other cases, to support the "nospace" directive we trick the shell
|
||||
# by outputting an extra, longer completion.
|
||||
__glow_debug "Adding second completion to perform nospace directive"
|
||||
set --global __glow_comp_results $split[1] $split[1].
|
||||
__glow_debug "Completions are now: $__glow_comp_results"
|
||||
end
|
||||
end
|
||||
|
||||
if test $numComps -eq 0; and test $nofiles -eq 0
|
||||
# To be consistent with bash and zsh, we only trigger file
|
||||
# completion when there are no other completions
|
||||
__glow_debug "Requesting file completion"
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves
|
||||
# so we can properly delete any completions provided by another script.
|
||||
# Only do this if the program can be found, or else fish may print some errors; besides,
|
||||
# the existing completions will only be loaded if the program can be found.
|
||||
if type -q "glow"
|
||||
# The space after the program name is essential to trigger completion for the program
|
||||
# and not completion of the program name itself.
|
||||
# Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.
|
||||
complete --do-complete "glow " > /dev/null 2>&1
|
||||
end
|
||||
|
||||
# Remove any pre-existing completions for the program since we will be handling all of them.
|
||||
complete -c glow -e
|
||||
|
||||
# this will get called after the two calls below and clear the $__glow_perform_completion_once_result global
|
||||
complete -c glow -n '__glow_clear_perform_completion_once_result'
|
||||
# The call to __glow_prepare_completions will setup __glow_comp_results
|
||||
# which provides the program's completion choices.
|
||||
# If this doesn't require order preservation, we don't use the -k flag
|
||||
complete -c glow -n 'not __glow_requires_order_preservation && __glow_prepare_completions' -f -a '$__glow_comp_results'
|
||||
# otherwise we use the -k flag
|
||||
complete -k -c glow -n '__glow_requires_order_preservation && __glow_prepare_completions' -f -a '$__glow_comp_results'
|
||||
@@ -0,0 +1,14 @@
|
||||
# Cute and pastel Fish shell colors
|
||||
set -g fish_color_normal '#7DF9FF' # Pink
|
||||
set -g fish_color_command '#FB48C4' # Neon pink
|
||||
set -g fish_color_quote '#6c71c4' # Lavender
|
||||
set -g fish_color_redirection '#b58900' # Warm gold
|
||||
set -g fish_color_comment '#93a1a1' # Pale aqua
|
||||
set -g fish_color_match --bold '#2aa198' # Aqua
|
||||
set -g fish_color_error --background=#dc322f --foreground=#ffffff # Red error with white text
|
||||
set -g fish_color_selection --background=#fdf6e3 --foreground=#073642 # Cream selection
|
||||
set -g fish_color_search_match --background=#268bd2 --foreground=#ffffff # Blue search highlight
|
||||
set -g fish_color_operator '#859900' # Lime green
|
||||
set -g fish_color_escape '#d33682' # Pink
|
||||
set -g fish_color_autosuggestion '#7DF9FF' # Pale aqua
|
||||
set -g fish_color_end '#859900' # Lime green
|
||||
@@ -0,0 +1,198 @@
|
||||
# Source global definitions (if necessary in fish)
|
||||
if test -f /etc/bashrc
|
||||
source /etc/bashrc
|
||||
end
|
||||
|
||||
if test -f /home/ion606/.config/fish/completions/glow.fish
|
||||
source /home/ion606/.config/fish/completions/glow.fish
|
||||
end
|
||||
|
||||
# Source global definitions (if necessary in fish)
|
||||
if test -f /etc/bashrc
|
||||
source /etc/bashrc
|
||||
end
|
||||
|
||||
if test -f /home/ion606/.config/fish/completions/glow.fish
|
||||
source /home/ion606/.config/fish/completions/glow.fish
|
||||
end
|
||||
|
||||
|
||||
# User specific aliases and functions
|
||||
|
||||
# Function to update Discord
|
||||
function updateDiscord
|
||||
# The directory where the contents will be copied to
|
||||
set target_dir /home/ion606/Discord
|
||||
|
||||
# Find the tar.gz file following the naming pattern
|
||||
set tar_file (find . -type f -name "discord-*.tar.gz" | head -n 1)
|
||||
|
||||
# Check if the file was found
|
||||
if test -z "$tar_file"
|
||||
echo "No matching tar.gz file found."
|
||||
return 1
|
||||
end
|
||||
|
||||
# Extract the tar.gz file
|
||||
tar -xzf "$tar_file"
|
||||
|
||||
# Assuming the extracted content is a directory with a predictable name
|
||||
set extracted_dir (string replace ".tar.gz" "" $tar_file)
|
||||
|
||||
# Copy the extracted contents to the target directory, overwriting existing files
|
||||
cp -rT "$extracted_dir" "$target_dir"
|
||||
|
||||
rm "$tar_file"
|
||||
|
||||
echo "Contents copied to $target_dir"
|
||||
end
|
||||
|
||||
# Aliases
|
||||
function submitty
|
||||
bash /home/ion606/runsubmitty.sh
|
||||
end
|
||||
|
||||
function showinfo
|
||||
bash /home/ion606/.customscripts/swaybackup/auto/shownotif.sh info $argv
|
||||
end
|
||||
|
||||
function sway
|
||||
sway --unsupported-gpu
|
||||
end
|
||||
|
||||
function minecraft
|
||||
portablemc start forge:1.20.1-recommended -l itamar137@outlook.com
|
||||
end
|
||||
|
||||
# Export paths and variables
|
||||
set -x PATH /home/ion606/Downloads/flutter/bin $PATH
|
||||
set -x PATH_TO_FX "/home/ion606/javafx-sdk-22.0.1/lib"
|
||||
set -x HISTCONTROL "shutdown *:ignoredups:erasedups"
|
||||
|
||||
set -x CC /usr/bin/gcc
|
||||
set -x CXX "/usr/bin/g++"
|
||||
set -x EDITOR nvim
|
||||
|
||||
# Clear history alias
|
||||
function clearhist
|
||||
builtin history clear
|
||||
end
|
||||
|
||||
function killvesktop
|
||||
kill -9 $(ps aux | grep vesktop | grep -v grep | awk '{print $2}' | head -n 1)
|
||||
ps aux | grep vesktop
|
||||
end
|
||||
|
||||
# GTK and theme-related exports
|
||||
set -x GTK_THEME "Adwaita:dark"
|
||||
set -x GTK2_RC_FILES "/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc"
|
||||
set -x QT_STYLE_OVERRIDE Adwaita-Dark
|
||||
|
||||
# SDKMAN
|
||||
set -x SDKMAN_DIR "$HOME/.sdkman"
|
||||
if test -s "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
source "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
end
|
||||
|
||||
# PNPM
|
||||
set -x PNPM_HOME "/home/ion606/.local/share/pnpm"
|
||||
if not contains "$PNPM_HOME" $PATH
|
||||
set -x PATH $PNPM_HOME $PATH
|
||||
end
|
||||
|
||||
alias postgres="pg_ctl -D /var/lib/postgres/data -l logfile start"
|
||||
alias temperature="sensors"
|
||||
|
||||
|
||||
# User specific functions
|
||||
|
||||
# Function to update Discord
|
||||
function updateDiscord
|
||||
# The directory where the contents will be copied to
|
||||
set target_dir /home/ion606/Discord
|
||||
|
||||
# Find the tar.gz file following the naming pattern
|
||||
set tar_file (find . -type f -name "discord-*.tar.gz" | head -n 1)
|
||||
|
||||
# Check if the file was found
|
||||
if test -z "$tar_file"
|
||||
echo "No matching tar.gz file found."
|
||||
return 1
|
||||
end
|
||||
|
||||
# Extract the tar.gz file
|
||||
tar -xzf "$tar_file"
|
||||
|
||||
# Assuming the extracted content is a directory with a predictable name
|
||||
set extracted_dir (string replace ".tar.gz" "" $tar_file)
|
||||
|
||||
# Copy the extracted contents to the target directory, overwriting existing files
|
||||
cp -rT "$extracted_dir" "$target_dir"
|
||||
|
||||
rm "$tar_file"
|
||||
|
||||
echo "Contents copied to $target_dir"
|
||||
end
|
||||
|
||||
# Aliases
|
||||
function submitty
|
||||
bash /home/ion606/runsubmitty.sh
|
||||
end
|
||||
|
||||
function showinfo
|
||||
bash /home/ion606/.customscripts/swaybackup/auto/shownotif.sh info $argv
|
||||
end
|
||||
|
||||
function sway
|
||||
sway --unsupported-gpu
|
||||
end
|
||||
|
||||
function minecraft
|
||||
portablemc start forge:1.20.1-recommended -l itamar137@outlook.com
|
||||
end
|
||||
|
||||
# Export paths and variables
|
||||
set -x PATH /home/ion606/Downloads/flutter/bin $PATH
|
||||
set -x PATH_TO_FX "/home/ion606/javafx-sdk-22.0.1/lib"
|
||||
set -x HISTCONTROL "shutdown *:ignoredups:erasedups"
|
||||
|
||||
set -x CC /usr/bin/gcc
|
||||
set -x CXX "/usr/bin/g++"
|
||||
set -x EDITOR nvim
|
||||
|
||||
# Clear history alias
|
||||
function clearhist
|
||||
builtin history clear
|
||||
end
|
||||
|
||||
function killvesktop
|
||||
kill -9 $(ps aux | grep vesktop | grep -v grep | awk '{print $2}' | head -n 1)
|
||||
ps aux | grep vesktop
|
||||
end
|
||||
|
||||
# GTK and theme-related exports
|
||||
set -x GTK_THEME "Adwaita:dark"
|
||||
set -x GTK2_RC_FILES "/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc"
|
||||
set -x QT_STYLE_OVERRIDE Adwaita-Dark
|
||||
|
||||
# SDKMAN
|
||||
set -x SDKMAN_DIR "$HOME/.sdkman"
|
||||
if test -s "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
source "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
end
|
||||
|
||||
# PNPM
|
||||
set -x PNPM_HOME "/home/ion606/.local/share/pnpm"
|
||||
if not contains "$PNPM_HOME" $PATH
|
||||
set -x PATH $PNPM_HOME $PATH
|
||||
end
|
||||
|
||||
alias postgres="pg_ctl -D /var/lib/postgres/data -l logfile start"
|
||||
alias temperature="sensors"
|
||||
|
||||
# colors
|
||||
starship init fish | source
|
||||
|
||||
if test -f /home/ion606/.config/fish/conf.d/colors.fish
|
||||
source /home/ion606/.config/fish/conf.d/colors.fish
|
||||
end
|
||||
@@ -0,0 +1,34 @@
|
||||
# This file contains fish universal variable definitions.
|
||||
# VERSION: 3.0
|
||||
SETUVAR VIRTUAL_ENV_DISABLE_PROMPT:true
|
||||
SETUVAR __fish_initialized:3400
|
||||
SETUVAR _fisher_upgraded_to_4_4:\x1d
|
||||
SETUVAR fish_color_autosuggestion:brblack
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:pink
|
||||
SETUVAR fish_color_comment:lightblue
|
||||
SETUVAR fish_color_cwd:green
|
||||
SETUVAR fish_color_cwd_root:red
|
||||
SETUVAR fish_color_end:green
|
||||
SETUVAR fish_color_error:lightred
|
||||
SETUVAR fish_color_escape:cyan
|
||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||
SETUVAR fish_color_host:normal
|
||||
SETUVAR fish_color_host_remote:yellow
|
||||
SETUVAR fish_color_keyword:lightcyan
|
||||
SETUVAR fish_color_normal:normal
|
||||
SETUVAR fish_color_operator:lightmagenta
|
||||
SETUVAR fish_color_param:lightyellow
|
||||
SETUVAR fish_color_quote:lightgreen
|
||||
SETUVAR fish_color_redirection:bold\x1epink
|
||||
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_status:red
|
||||
SETUVAR fish_color_user:lightcyan
|
||||
SETUVAR fish_color_valid_path:magenta
|
||||
SETUVAR fish_key_bindings:fish_default_key_bindings
|
||||
SETUVAR fish_pager_color_completion:normal
|
||||
SETUVAR fish_pager_color_description:yellow\x1e\x2di
|
||||
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
SETUVAR fish_pager_color_selected_background:\x2dr
|
||||
Reference in New Issue
Block a user