initial commit

This commit is contained in:
2024-12-26 18:14:20 +02:00
commit b5eab28b9a
10 changed files with 619 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
# Maintainer: Your Name <your.email@example.com>
pkgname=ion-terminal-config
pkgver=1.0
pkgrel=1
pkgdesc="A custom terminal configuration with Alacritty, Starship, and Fish!"
arch=('any')
url="https://github.com/ION606/terminal-conf"
license=('MIT')
depends=('alacritty' 'starship' 'fish' 'glow')
source=('install.sh' 'terminal/')
sha256sums=('SKIP' 'SKIP')
package() {
install -Dm644 terminal/alacritty.toml "$pkgdir/etc/terminal/alacritty.toml"
install -Dm644 terminal/starship.toml "$pkgdir/etc/terminal/starship.toml"
# Fish config
install -Dm644 terminal/fish/config.fish "$pkgdir/etc/fish/config.fish"
install -Dm644 terminal/fish/fish_variables "$pkgdir/etc/fish/fish_variables"
install -Dm644 terminal/fish/completions/glow.fish "$pkgdir/etc/fish/completions/glow.fish"
install -Dm644 terminal/fish/conf.d/colors.fish "$pkgdir/etc/fish/conf.d/colors.fish"
install -Dm644 terminal/fish/functions/builtins.fish "$pkgdir/etc/fish/functions/builtins.fish"
install -Dm644 terminal/fish/functions/commands.fish "$pkgdir/etc/fish/functions/commands.fish"
# Post-install script
install -Dm755 install.sh "$pkgdir/usr/bin/apply-terminal-config"
}
Executable
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
# script to append my custom fish configs
mkdir -p ~/.config/fish/
for subdir in completions conf.d functions; do
mkdir -p ~/.config/fish/$subdir
for file in terminal/fish/$subdir/*; do
# Check if the file exists in the target directory
if [[ -f ~/.config/fish/$subdir/$(basename "$file") ]]; then
# Append the content to the existing file
cat "$file" >> ~/.config/fish/$subdir/$(basename "$file")
else
# Copy the file if it doesn't already exist
cp "$file" ~/.config/fish/$subdir/
fi
done
done
# Append or create config.fish
if [[ -f ~/.config/fish/config.fish ]]; then
cat terminal/fish/config.fish >> ~/.config/fish/config.fish
else
cp terminal/fish/config.fish ~/.config/fish/config.fish
fi
# Append or create fish_variables
if [[ -f ~/.config/fish/fish_variables ]]; then
cat terminal/fish/fish_variables >> ~/.config/fish/fish_variables
else
cp terminal/fish/fish_variables ~/.config/fish/fish_variables
fi
# Ensure the alacritty configuration directory exists
mkdir -p ~/.config/alacritty/
# Replace the alacritty configuration file (appending is not ideal here)
cp terminal/alacritty.toml ~/.config/alacritty/alacritty.toml
# Replace the starship configuration file (appending is not ideal here)
cp terminal/starship.toml ~/.config/starship.toml
+48
View File
@@ -0,0 +1,48 @@
[colors.bright]
black = "#686868"
blue = "#57C7FF"
cyan = "#A4FFFF"
green = "#5AF78E"
magenta = "#FF92D0"
red = "#FF6E67"
white = "#FFFFFF"
yellow = "#F3F99D"
[colors.normal]
black = "#282A36"
blue = "#57C7FF"
cyan = "#9AEDFE"
green = "#5AF78E"
magenta = "#FF6AC1"
red = "#FF5C57"
white = "#F1F1F0"
yellow = "#F3F99D"
[colors.primary]
background = "#000000"
foreground = "#BF00FF"
[font]
size = 8
[font.bold]
family = "Fira Code"
style = "Bold"
[font.italic]
family = "Fira Code"
style = "Italic"
[font.normal]
family = "Fira Code"
style = "Regular"
[window]
opacity = 0.8
[cursor]
blink_interval = 500
[cursor.style]
shape = "Block"
blinking = "Always"
+235
View File
@@ -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'
+14
View File
@@ -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 '#B98A8F' # Dull pink
set -g fish_color_end '#859900' # Lime green
+22
View File
@@ -0,0 +1,22 @@
if test -f ~/.config/fish/completions/glow.fish
source ~/.config/fish/completions/glow.fish
end
if test -f ~/.config/fish/completions/glow.fish
source ~/.config/fish/completions/glow.fish
end
if test -f ~/.config/fish/functions/builtins.fish
source ~/.config/fish/functions/builtins.fish
end
if test -f ~/.config/fish/functions/commands.fish
source ~/.config/fish/functions/commands.fish
end
# colors
starship init fish | source
if test -f ~/.config/fish/conf.d/colors.fish
source ~/.config/fish/conf.d/colors.fish
end
+34
View File
@@ -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
+15
View File
@@ -0,0 +1,15 @@
function animate_typing
set message $argv
echo -e $message | pv -qL 30
end
function fish_greeting
toilet FIMSH!
# one for the display manager, one user one
if test (count (pgrep -x fish)) -eq 2
animate_typing "\e[38;5;207m❥ Welcome to your Fish shell! \e[0m"
else
echo -e "\e[38;5;207m❥ Welcome to your Fish shell! \e[0m"
end
end
+108
View File
@@ -0,0 +1,108 @@
# Helper function to remove options from $argv
function remove_options
# Filter out arguments starting with '-' using string match
for arg in $argv
if not string match -q -- '-*' $arg
echo $arg
end
end
end
# 'ls' wrapper
function ls_cute
echo "🌸 OWO what's this??? 🌸"
command ls $argv
echo "🌼 look at the stuffs! 🌼"
end
alias ls="ls_cute"
# 'cd' wrapper
function cd_cute
echo "nyooming to $argv[1]! ✨"
builtin cd $argv
end
alias cd="cd_cute"
# 'rm' wrapper
function rm_cute
echo "🗑️ oh nyo! Deleting $argv :<"
command rm $argv
# echo "🗑️ oh nyo! Deleting $argv... Are you sure? 😿"
# read -p "type 'yes' to confirm: " confirm
# if test "$confirm" = "yes"
# command rm $argv
# echo "💔 $argv is gone... but you'll recover! qwq"
# else
# echo "😌 phew! nyo dedge :3 🌈"
# end
end
alias rm="rm_cute"
# 'mkdir' wrapper
function mkdir_cute
echo "🏗️ building diwectowy $(remove_options $argv) uwu! 🏡"
command mkdir $argv
echo "✨ all done! $(remove_options $argv)[1] is ready for use. 🎉"
end
alias mkdir="mkdir_cute"
# 'cp' wrapper
function cp_cute
set args (remove_options $argv) # Extract non-option arguments
echo "📂 copying $args[1] to $args[2]... Be careful with those precious files! 🛠️"
command cp $argv
echo "✨ yay! $args[1] has a shiny twin at $args[2]. 🌟"
end
alias cp="cp_cute"
# 'mv' wrapper
function mv_cute
set args (remove_options $argv) # Extract non-option arguments
echo "🚚 moving $args[1] to $args[2] nyow... 🌈"
command mv $argv
echo "✨ done! $args[1] has found a new home at $args[2]. 🌟"
end
alias mv="mv_cute"
# 'git' wrapper
function git_cute
echo -e "🐙 Git scawy qwq...but I'll twy to do \033[1;32mgit $argv\033[0m anyways!🌟"
command git $argv
echo "🎉 done! (phew) 🌠"
end
alias git="git_cute"
# 'sudo' wrapper
function sudo_cute
echo "🥺 gib power pls, I pwomise I won't rm -rf / --no-preserve-root 🥺"
command sudo $argv
echo "✨ a-am big nyow! a-and scawy!!! ✨"
end
alias sudo="sudo_cute"
# 'yay' wrapper
function yay_cute
echo "✨ Running yay with command: yay $argv"
command yay $argv
if test $status -ne 0
echo "💔 aur naur! The command failed! 💔"
else
echo "🎉 YAY command completed! 🌟"
end
end
alias yay="yay_cute"
# 'exit' wrapper
function exit_cute
echo "😢 qwq, you're leaving the shell... bai baiii! 👋"
builtin exit
end
alias exit="exit_cute"
# 'clear' wrapper
function clear_cute
echo "🌈 Clearing the clutter UMU! ✨"
command clear
end
alias clear="clear_cute"
+74
View File
@@ -0,0 +1,74 @@
# Character module (prompt symbol)
[character]
success_symbol = "[❥ ](#FFB6C1)" # Cute heart or floral symbol
error_symbol = "[✗ ](bold red)" # Error symbol
# Directory module
[directory]
truncation_length = 3
style = "italic bold #FFDDE5" # Pastel pink
truncation_symbol = "…" # Ellipsis with a flower
read_only = "🔒" # Lock icon for read-only directories
# Git branch module
[git_branch]
symbol = " "
style = "bold #FFB6C1" # Pink for Git branches
format = "on [$symbol$branch(:$remote_branch)]($style) "
# Git status module
[git_status]
style = "bold #FFDDEE" # Lighter pink
stashed = "📦 "
untracked = "✨ "
modified = "🛠 "
ahead = "🚀 "
# Time module
[time]
disabled = true
time_range = "01:00:00-00:00:00"
format = '🕙[\[ $time \]]($style) '
time_format = "%T"
utc_time_offset = "+1"
use_12hr = false
style = "bold yellow"
# Battery module
[battery]
disabled = false
full_symbol = "🔋"
charging_symbol = "⚡"
discharging_symbol = "💔"
# style = "bold #FF69B4" # Hot pink
# Line break module
[line_break]
disabled = true
# Jobs module
[jobs]
symbol = "🔧 "
style = "bold #FFD700" # Gold
threshold = 1
# Package version module
[package]
disabled = false
symbol = "📦 "
style = "bold #FFB6C1" # Soft pink
# Kubernetes context module
[kubernetes]
symbol = "☸️ "
style = "bold #FFDDEE"
# Python version module
[python]
symbol = "🐍 "
style = "bold #FFB6C1"
# Node.js version module
[nodejs]
symbol = "🌿 "
style = "bold #87CEEB" # Light blue