feat(user): finalize shell environment, add custom jumpers, and configure monochrome fastfetch
This commit is contained in:
1 parent
6b4e957345
commit
b889045f0f
6 files changed
+422
-34
No files matched your search
+155
-34
@@ -6,30 +6,39 @@
|
||||
git = {
|
||||
enable = true;
|
||||
settings = {
|
||||
user = {
|
||||
name = "kiskaadee";
|
||||
email = "fcortesbio@gmail.com";
|
||||
};
|
||||
alias = {
|
||||
st = "status";
|
||||
co = "checkout";
|
||||
br = "branch";
|
||||
user = {
|
||||
name = "kiskaadee";
|
||||
email = "fcortesbio@gmail.com";
|
||||
};
|
||||
alias = {
|
||||
st = "status";
|
||||
co = "checkout";
|
||||
br = "branch";
|
||||
|
||||
# Undo/Modify
|
||||
unstage = "reset HEAD --";
|
||||
amend = "commit --amend --no-edit";
|
||||
undo = "reset --soft HEAD~1";
|
||||
# Undo/Modify
|
||||
unstage = "reset HEAD --";
|
||||
amend = "commit --amend --no-edit";
|
||||
undo = "reset --soft HEAD~1";
|
||||
|
||||
# Workflow
|
||||
sync = "!git fetch -p && git pull";
|
||||
main = "checkout main";
|
||||
last = "log -1 HEAD~1";
|
||||
# Workflow
|
||||
sync = "!git fetch -p && git pull";
|
||||
main = "checkout main";
|
||||
last = "log -1 HEAD";
|
||||
|
||||
};
|
||||
core.editor = "nvim";
|
||||
init.defaultBranch = "main";
|
||||
merge.conflictstyle = "zdiff3";
|
||||
pull.rebase = true;
|
||||
# Extra aliases from legacy git-ready
|
||||
dc = "!f() { git diff \"$@\" | wl-copy; }; f";
|
||||
acp = "!f() { git add -A && git commit -m \"$2\" && git push origin \"$1\"; }; f";
|
||||
nuke = "!f() { git reset --hard origin/$(git rev-parse --abbrev-ref HEAD) && git clean -fd; }; f";
|
||||
lg = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all";
|
||||
standup = "!git log --since='24 hours ago' --oneline --author=\"$(git config user.email)\"";
|
||||
gsp = "!git stash && git pull";
|
||||
gfo = "fetch origin";
|
||||
gcredential = "config credential.helper store";
|
||||
};
|
||||
core.editor = "nvim";
|
||||
init.defaultBranch = "main";
|
||||
merge.conflictstyle = "zdiff3";
|
||||
pull.rebase = true;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -37,10 +46,10 @@
|
||||
enable = true;
|
||||
enableGitIntegration = true;
|
||||
options = {
|
||||
navigate = true;
|
||||
side-by-side = true;
|
||||
line-numbers = true;
|
||||
hyperlinks = true;
|
||||
navigate = true;
|
||||
side-by-side = true;
|
||||
line-numbers = true;
|
||||
hyperlinks = true;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -54,15 +63,15 @@
|
||||
gh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
git_protocol = "ssh";
|
||||
editor = "nvim";
|
||||
prompt = "enabled";
|
||||
git_protocol = "ssh";
|
||||
editor = "nvim";
|
||||
prompt = "enabled";
|
||||
|
||||
aliases = {
|
||||
co = "pr checkout";
|
||||
pv = "pr review";
|
||||
vw = "repo view --web";
|
||||
};
|
||||
aliases = {
|
||||
co = "pr checkout";
|
||||
pv = "pr review";
|
||||
vw = "repo view --web";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -70,6 +79,9 @@
|
||||
zoxide = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
options = [
|
||||
"--cmd cd"
|
||||
];
|
||||
};
|
||||
|
||||
fzf = {
|
||||
@@ -87,11 +99,120 @@
|
||||
enable = true;
|
||||
settings.updates.auto_update = true;
|
||||
};
|
||||
|
||||
# Catppuccin syntax-highlighted cat replacement
|
||||
bat = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Bash Shell Config
|
||||
bash = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
|
||||
shellAliases = {
|
||||
zed = "zeditor";
|
||||
reload = "exec bash";
|
||||
ff = "fastfetch --logo none";
|
||||
|
||||
# System Navigation
|
||||
".." = "cd ..";
|
||||
"..." = "cd ../..";
|
||||
"...." = "cd ../../..";
|
||||
"....." = "cd ../../../..";
|
||||
|
||||
# System Administration
|
||||
nix-switch = "sudo nixos-rebuild switch --flake ~/Config#$(hostname)";
|
||||
sys = "dgop";
|
||||
wifi = "nmtui";
|
||||
lock = "hyprlock";
|
||||
|
||||
# Audio Control
|
||||
vol1 = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.2";
|
||||
vol2 = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.4";
|
||||
vol3 = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.6";
|
||||
vol4 = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.8";
|
||||
vol5 = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1.0";
|
||||
volM = "wpctl set-mute @DEFAULT_AUDIO_SINK@ 1";
|
||||
volU = "wpctl set-mute @DEFAULT_AUDIO_SINK@ 0";
|
||||
|
||||
# Network Diagnostics
|
||||
pgoog = "ping google.com -c 3";
|
||||
|
||||
# Python / Py5
|
||||
p5 = "uv run py5-run-sketch";
|
||||
p5w = "uv run watchfiles \"py5-run-sketch main.py\"";
|
||||
|
||||
# Editor Shorthand
|
||||
v = "nvim";
|
||||
clock = "tty-clock";
|
||||
ql = "quicklinks";
|
||||
|
||||
# Interactive Jump helper
|
||||
zi = "zoxide query -i --preview 'eza --tree --level 2 --color=always {}'";
|
||||
|
||||
# Git Shorthand
|
||||
gs = "git status";
|
||||
ga = "git add";
|
||||
gc = "git commit -m";
|
||||
gp = "git push";
|
||||
gpl = "git pull";
|
||||
gst = "git stash";
|
||||
gsp = "git stash && git pull";
|
||||
gfo = "git fetch origin";
|
||||
gcheck = "git checkout";
|
||||
gadc = "git add -A && git diff --staged | wl-copy";
|
||||
};
|
||||
|
||||
bashrcExtra = ''
|
||||
${builtins.readFile ./shell/wayland.sh}
|
||||
${builtins.readFile ./shell/git.sh}
|
||||
${builtins.readFile ./shell/pdf.sh}
|
||||
${builtins.readFile ./shell/quicklinks.sh}
|
||||
${builtins.readFile ./shell/jump.sh}
|
||||
|
||||
# --- Visual Entry ---
|
||||
if [[ $- == *i* ]]; then
|
||||
fastfetch --logo none
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# Custom Catnap-style Fastfetch
|
||||
programs.fastfetch = {
|
||||
enable = true;
|
||||
settings = {
|
||||
display = {
|
||||
separator = " ";
|
||||
};
|
||||
modules = [
|
||||
{ key = "╭───────────╮"; type = "custom"; }
|
||||
{ key = "│ user {#keys}│"; type = "title"; format = "{user-name}"; }
|
||||
{ key = "│ hname {#keys}│"; type = "title"; format = "{host-name}"; }
|
||||
{ type = "command"; key = "│ os age {#keys}│"; keyColor = "magenta"; text = "printf \"\\e[0m%s days\\e[0m\" \"$(( ($(date +%s) - $(stat -c %W /)) / 86400 ))\""; }
|
||||
{ key = "│ uptime {#keys}│"; type = "uptime"; }
|
||||
{ key = "│ {icon} distro {#keys}│"; type = "os"; }
|
||||
{ key = "│ kernel {#keys}│"; type = "kernel"; }
|
||||
{ key = "│ wm {#keys}│"; type = "wm"; }
|
||||
{ key = "│ desktop {#keys}│"; type = "de"; }
|
||||
{ key = "│ term {#keys}│"; type = "terminal"; }
|
||||
{ key = "│ shell {#keys}│"; type = "shell"; }
|
||||
{ key = "│ cpu {#keys}│"; type = "cpu"; showPeCoreCount = true; }
|
||||
{ key = "│ root {#keys}│"; type = "disk"; folders = "/"; }
|
||||
{ key = "│ home {#keys}│"; type = "disk"; folders = "/home"; }
|
||||
{ key = "│ media {#keys}│"; type = "disk"; folders = "/media"; }
|
||||
{ key = "│ memory {#keys}│"; type = "memory"; }
|
||||
{ key = "├───────────┤"; type = "custom"; }
|
||||
{ key = "│ colors {#keys}│"; type = "colors"; symbol = "circle"; }
|
||||
{ key = "╰───────────╯"; type = "custom"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Standalone System dependencies
|
||||
home.packages = with pkgs; [
|
||||
ripgrep fd glow jq tree wl-clipboard sqlite python3 nodejs
|
||||
bc qpdf tty-clock grim slurp swappy libnotify fastfetch
|
||||
bc qpdf tty-clock grim slurp swappy libnotify uv
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
# --- Git Automation ---
|
||||
|
||||
gitignore() {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: gitignore <pattern> [pattern...]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local GIT_ROOT=$(git rev-parse --show-toplevel 2> /dev/null)
|
||||
if [ -z "$GIT_ROOT" ]; then
|
||||
echo "Error: Not a Git repository."
|
||||
return 1
|
||||
fi
|
||||
|
||||
local GIT_IGNORE_FILE="$GIT_ROOT/.gitignore"
|
||||
|
||||
if [ ! -f "$GIT_IGNORE_FILE" ]; then
|
||||
touch "$GIT_IGNORE_FILE"
|
||||
fi
|
||||
|
||||
if [ -s "$GIT_IGNORE_FILE" ] && [ "$(tail -c1 "$GIT_IGNORE_FILE" | wc -l)" -eq 0 ]; then
|
||||
echo "" >> "$GIT_IGNORE_FILE"
|
||||
fi
|
||||
|
||||
local added_count=0
|
||||
local commit_msg_list=""
|
||||
|
||||
for pattern in "$@"; do
|
||||
if rg -Fxq "$pattern" "$GIT_IGNORE_FILE"; then
|
||||
echo "Skipping '$pattern' (already in .gitignore)"
|
||||
else
|
||||
echo "$pattern" >> "$GIT_IGNORE_FILE"
|
||||
echo "Added '$pattern'"
|
||||
((added_count++))
|
||||
commit_msg_list+="${pattern}, "
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $added_count -gt 0 ]; then
|
||||
commit_msg_list="${commit_msg_list%, }"
|
||||
echo "Committing and pushing changes..."
|
||||
git add "$GIT_IGNORE_FILE"
|
||||
git commit -m "Add to .gitignore: $commit_msg_list"
|
||||
git push
|
||||
else
|
||||
echo "No new patterns were added."
|
||||
fi
|
||||
}
|
||||
|
||||
gacp() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: gacp <commit-message>"
|
||||
return 1
|
||||
fi
|
||||
git add -A
|
||||
git commit -m "$1"
|
||||
local branch_name=$(git branch --show-current)
|
||||
git push origin "${branch_name}"
|
||||
echo "Pushed to origin/${branch_name}"
|
||||
}
|
||||
|
||||
new-repo() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: new-repo <repository-name>"
|
||||
return 1
|
||||
fi
|
||||
local repo_name="$1"
|
||||
mkdir -p "$repo_name"
|
||||
cd "$repo_name" || return 1
|
||||
git init -b main
|
||||
echo "# $repo_name" > README.md
|
||||
touch .gitignore LICENSE
|
||||
git add -A && git commit -m "Initial commit"
|
||||
gh repo create "$repo_name" --public --source=. --remote=origin --push
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
# Yazi Sticky Navigation
|
||||
fm() {
|
||||
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
|
||||
yazi "$@" --cwd-file="$tmp"
|
||||
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
|
||||
cd -- "$cwd"
|
||||
fi
|
||||
rm -f -- "$tmp"
|
||||
}
|
||||
|
||||
# --- Fuzzy Jumpers ---
|
||||
_fuzzy_select_dir() {
|
||||
local base="$1"
|
||||
local query="$2"
|
||||
local max_depth="${3:-2}"
|
||||
[[ -d "$base" ]] || return 1
|
||||
fd . "$base" --type d --mindepth 1 --max-depth "$max_depth" 2>/dev/null | \
|
||||
fzf --query="$query" --select-1 --exit-0
|
||||
}
|
||||
|
||||
_fuzzy_select_dir_preview() {
|
||||
local base="$1"
|
||||
local query="$2"
|
||||
local max_depth="${3:-2}"
|
||||
[[ -d "$base" ]] || return 1
|
||||
fd . "$base" --type d --mindepth 1 --max-depth "$max_depth" 2>/dev/null | \
|
||||
fzf --query="$query" --select-1 --exit-0 \
|
||||
--preview 'eza --tree --level 2 --icons=always --color=always {}' \
|
||||
--preview-window="right:50%:rounded"
|
||||
}
|
||||
|
||||
_jump_to() {
|
||||
local dir="$1"
|
||||
[[ -d "$dir" ]] || return 1
|
||||
cd "$dir" || return 1
|
||||
if [[ "$JUMP_VERBOSE" == true ]]; then
|
||||
printf "\033[1;32mJumped to:\033[0m %s\n" "$dir"
|
||||
eza -la --icons 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
jump() {
|
||||
local dir
|
||||
dir=$(_fuzzy_select_dir_preview "$1" "$2" "${3:-2}") || return
|
||||
_jump_to "$dir"
|
||||
}
|
||||
|
||||
_fuzzy_search_dir() {
|
||||
local base="$1"
|
||||
local query="$2"
|
||||
[[ -d "$base" ]] || return 1
|
||||
rg --files-with-matches --no-messages "$query" "$base" | \
|
||||
xargs -I {} dirname {} | \
|
||||
sort -u | \
|
||||
fzf --header "Search: $query"
|
||||
}
|
||||
|
||||
jump_search() {
|
||||
local dir
|
||||
dir=$(_fuzzy_search_dir "$1" "$2") || return
|
||||
_jump_to "$dir"
|
||||
}
|
||||
|
||||
edit_dir() {
|
||||
local dir
|
||||
dir=$(_fuzzy_select_dir "$HOME/Projects") || return
|
||||
nvim "$dir"
|
||||
}
|
||||
|
||||
copy_dir() {
|
||||
local dir
|
||||
dir=$(_fuzzy_select_dir "$HOME") || return
|
||||
printf "%s" "$dir" | wl-copy
|
||||
}
|
||||
|
||||
cnf() { jump "$HOME/Config" "$1" 2; }
|
||||
pj() { jump "$HOME/Projects" "$1"; }
|
||||
dl() { jump "$HOME/Downloads" "$1"; }
|
||||
pd() { jump "$HOME/Production" "$1"; }
|
||||
md() { jump "/media"; }
|
||||
@@ -0,0 +1,45 @@
|
||||
# --- PDF Utilities ---
|
||||
|
||||
pdf_dc() {
|
||||
local env_file="$HOME/Secrets/.env"
|
||||
local input_file="$1"
|
||||
local password="$2"
|
||||
|
||||
if [[ -z "$password" ]]; then
|
||||
if [[ -f "$env_file" ]]; then
|
||||
local defpass
|
||||
defpass=$(rg "^defpass=" "$env_file" | cut -d'=' -f2- | tr -d '"' | tr -d "'")
|
||||
password="${defpass}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$password" ]]; then
|
||||
echo "Error: No password provided and 'defpass' not found in .env" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$input_file" ]]; then
|
||||
echo "Error: Input file '$input_file' not found" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local output_file="${input_file%.pdf}_decrypted.pdf"
|
||||
|
||||
if [[ -f "$output_file" ]]; then
|
||||
echo "Error: Output file '$output_file' already exists."
|
||||
read -p "Do you want to overwrite it? (y/n): " overwrite
|
||||
if [[ "$overwrite" != "y" ]]; then
|
||||
echo "Operation cancelled."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Decrypting $input_file..."
|
||||
if qpdf --password="$password" --decrypt "$input_file" "$output_file"; then
|
||||
echo "✅ Decryption successful: $output_file"
|
||||
else
|
||||
local exit_code=$?
|
||||
echo "❌ Decryption failed (qpdf exit code: $exit_code)"
|
||||
return $exit_code
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
# --- Quicklinks Launcher ---
|
||||
|
||||
quicklinks() {
|
||||
local CONFIG_FILE="$HOME/.quicklinks"
|
||||
local SELECTED_LINE
|
||||
local COMMAND
|
||||
|
||||
if [[ ! -f "$CONFIG_FILE" ]]; then
|
||||
echo "--------------------------------------------------------"
|
||||
echo "⚠️ Quicklinks file not found!"
|
||||
echo "Please create: $CONFIG_FILE"
|
||||
echo "Format: Name | Description | Command or Script"
|
||||
echo "--------------------------------------------------------"
|
||||
|
||||
read -p "Create a template file now? (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "Example | This is a description | echo 'Hello World'" > "$CONFIG_FILE"
|
||||
echo "Template created. Please edit it and run the function again."
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
SELECTED_LINE=$(bat "$CONFIG_FILE" | fzf \
|
||||
--style full \
|
||||
--height 40% --layout reverse --border \
|
||||
--prompt "🚀 Quick Access: " \
|
||||
--delimiter "|" --with-nth 1..3)
|
||||
|
||||
[[ -z "$SELECTED_LINE" ]] && return 0
|
||||
|
||||
COMMAND=$(echo "$SELECTED_LINE" | cut -d'|' -f3- | sed 's/^[[:space:]]*//')
|
||||
|
||||
echo "🚀 Executing: $COMMAND"
|
||||
eval "$COMMAND"
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
# --- Wayland Utilities ---
|
||||
|
||||
# Execute command and copy output to Wayland clipboard while viewing it
|
||||
wlc() {
|
||||
local header_mode=false
|
||||
local cmd_str
|
||||
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|--headers) header_mode=true; shift ;;
|
||||
--) shift; break ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$#" -eq 0 ]]; then
|
||||
echo "Usage: wlc [--headers] <command> [args...]" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
cmd_str="$*"
|
||||
|
||||
{
|
||||
if [[ "$header_mode" == true ]]; then
|
||||
printf "# Command: %s\n" "$cmd_str"
|
||||
printf "# Date: %s\n" "$(date '+%Y-%m-%d %H:%M:%S')"
|
||||
printf "# Type: combined (stdout/stderr)\n\n"
|
||||
fi
|
||||
"$@" 2>&1
|
||||
} | tee >(wl-copy)
|
||||
}
|
||||
Reference in new issue
Block a user