all: Initial dotfiles

Import an initial copy of all of my dotfiles

Signed-off-by: Nicholas Mello <nick@nmello.dev>
This commit is contained in:
2025-08-14 19:21:24 -05:00
parent 213a40bc27
commit 65d08b0772
20 changed files with 809 additions and 0 deletions

5
fish/config.fish Normal file
View File

@@ -0,0 +1,5 @@
if status is-interactive
if type -q fzf
fzf --fish | source
end
end

31
fish/fish_variables Normal file
View File

@@ -0,0 +1,31 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_initialized:3800
SETUVAR fish_color_autosuggestion:brblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:blue
SETUVAR fish_color_comment:red
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:green
SETUVAR fish_color_error:brred
SETUVAR fish_color_escape:brcyan
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:brcyan
SETUVAR fish_color_param:cyan
SETUVAR fish_color_quote:yellow
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
SETUVAR fish_color_search_match:white\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:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline
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

View File

@@ -0,0 +1,134 @@
function list-archive-contents --description "Recursively list contents of zip and tar archives"
argparse --name=list-archive-contents h/help 'o=' -- $argv
or return 1
function print_help
echo "
Usage: list-archive-contents [-h] [-o output_file] archive1 [archive2 ...]
Recursively lists the contents of zip and tar files, including nested archives.
Options:
-h, --help Show this help message and exit
-o output_file Write output to the specified file instead of printing
"
end
if set -q _flag_help
print_help
return 0
end
set -g output_file ""
if set -q _flag_o
set output_file $_flag_o
rm -rf $output_file
end
set -l args $argv
if test (count $args) -eq 0
print_help
return 0
end
# Print indentation as real tabs
function _indent
set -l level $argv[1]
printf "%s" (string repeat $level " ")
end
# Print line with indentation, to file or stdout
function _print
set -l depth $argv[1]
set -l message $argv[2..-1]
set -l indent (_indent $depth)
if test -n "$output_file"
printf "%s%s\n" $indent $message >>"$output_file"
else
printf "%s%s\n" $indent $message
end
end
function list_contents_recursive
set -l file $argv[1]
set -l depth $argv[2]
if not test -f "$file"
_print $depth "File not found: $file"
return
end
# Show only basename in header to hide /tmp/
set -l display_file (basename -- "$file")
_print $depth "📦 $display_file"
set -l ext (string lower $display_file)
switch $ext
case '*.zip'
set -l tmpdir (mktemp -d)
unzip -q "$file" -d "$tmpdir"
# Gather nested archives
set -l nested_archives (find "$tmpdir" -type f \( -iname '*.zip' -o -iname '*.tar' -o -iname '*.tar.gz' -o -iname '*.tgz' -o -iname '*.tar.bz2' -o -iname '*.tbz2' -o -iname '*.tar.xz' -o -iname '*.txz' \))
# Print normal files (excluding nested archives)
find "$tmpdir" -type f | while read -l inner
if contains -- "$inner" $nested_archives
continue
end
set -l relpath (string replace -- "$tmpdir/" "" "$inner")
_print (math $depth + 1) "$relpath"
end
# Recurse into each nested archive
for nested in $nested_archives
list_contents_recursive "$nested" (math $depth + 1)
end
rm -rf "$tmpdir"
case '*.tar' '*.tar.gz' '*.tgz' '*.tar.bz2' '*.tbz2' '*.tar.xz' '*.txz'
set -l tmpdir (mktemp -d)
switch $ext
case '*.tar'
tar -xf "$file" -C "$tmpdir"
case '*.tar.gz' '*.tgz'
tar -xzf "$file" -C "$tmpdir"
case '*.tar.bz2' '*.tbz2'
tar -xjf "$file" -C "$tmpdir"
case '*.tar.xz' '*.txz'
tar -xJf "$file" -C "$tmpdir"
end
# Find nested archives in extracted tree
set -l nested_archives (find "$tmpdir" -type f \( -iname '*.zip' -o -iname '*.tar' -o -iname '*.tar.gz' -o -iname '*.tgz' -o -iname '*.tar.bz2' -o -iname '*.tbz2' -o -iname '*.tar.xz' -o -iname '*.txz' \))
# Print all files except nested archives themselves
find "$tmpdir" -type f | while read -l inner
if contains -- "$inner" $nested_archives
continue
end
set -l relpath (string replace -- "$tmpdir/" "" "$inner")
_print (math $depth + 1) "$relpath"
end
# Recurse into nested archives
for nested in $nested_archives
list_contents_recursive "$nested" (math $depth + 1)
end
rm -rf "$tmpdir"
case '*'
_print $depth "❌ Unsupported file format: $file"
end
end
for arg in $args
for file in (eval echo $arg)
list_contents_recursive "$file" 0
end
end
end

3
fish/functions/vi.fish Normal file
View File

@@ -0,0 +1,3 @@
function vi --wraps nvim --description "Alias for neovim"
nvim $argv
end