diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-26 16:57:37 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-26 16:57:37 -0600 |
| commit | 7d490453085ae084ce0e3875952eae1d3ad7b1ab (patch) | |
| tree | d6f76ded02d541107271dc2b04cac34435c81a26 /dotfiles/system/.profile.d/fzf.sh | |
| parent | feb8dfaae9b0172c9d24e7e0d115754a467b4627 (diff) | |
refactor(shell): reorganize shell config for proper separation
Restructure shell configuration to follow standard conventions:
- .profile: Environment variables only (POSIX compatible)
- .bash_profile: NEW - sources .profile and .bashrc for login shells
- .bashrc: Bash-specific settings, sources .bashrc.d/
- .zshrc: Zsh-specific settings, sources .zshrc.d/
New modular directories:
- .bashrc.d/: aliases, emacs, fzf, git, media, utilities
- .zshrc.d/: same as bashrc.d plus arch-downgrade (zsh-only)
- .profile.d/: reduced to env-only files (display, framework, auto-tmux)
Fixes:
- Remove duplicate .profile sourcing in .bashrc
- Remove broken XDG_CURRENT_DESKTOP=GNOME line from display.sh
- Move aliases/functions from .profile to appropriate .d/ directories
- Shell-specific init (zoxide, fzf) now in .bashrc/.zshrc directly
- FreeBSD bindkey fix now in .zshrc directly
Also adds CLAUDE.md session context file.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'dotfiles/system/.profile.d/fzf.sh')
| -rw-r--r-- | dotfiles/system/.profile.d/fzf.sh | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/dotfiles/system/.profile.d/fzf.sh b/dotfiles/system/.profile.d/fzf.sh deleted file mode 100644 index 5fab752..0000000 --- a/dotfiles/system/.profile.d/fzf.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/sh - -# fzf.sh -# Craig Jennings <c@cjennings.net> -# fuzzy find settings and utilities, sourced by .profile - -# otherwise ** doesn't expand -source /usr/share/fzf/completion.zsh - -### SETTINGS -export FZF_DEFAULT_OPTS='--height=70%' -export FZF_DEFAULT_COMMAND='rg --files' -export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" -export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden' - -# Directory paths for convenience functions -IF_GAMES_DIR="$HOME/sync/org/text.games" -BOOKS_DIR="$HOME/sync/books" - -### NAVIGATION - -# cdff - change directory find file -# change to the directory where the file resides. -cdff() { - - file=$(fzf +m -q "$1") - dir=$(dirname "$file") - cd "$dir" || exit -} - -# CD to a directory with fzf -cdd () { - destdir=$(find "${1:-.}" -path '*/\.*' -prune \ - -o -type d -print 2> /dev/null | fzf +m) && - cd "$destdir" -} - -### SYSTEM ADMIN - -# Kill a process with fzf -kp () { - pid=$(ps -ef | sed 1d | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[kill:process]'" | awk '{print $2}') - - if [ "x$pid" != "x" ] - then - echo "$pid" | xargs kill -${1:-9} - kp - fi -} - -# list available packages, show info in preview, and install selection -yinstall() { - yay -Slq | fzf --multi --preview 'yay -Si {1}' | xargs -ro yay -S --noconfirm -} - - -yinstall-skipverify() { - yay -Slq | fzf --multi --preview 'yay -Si {1}' | xargs -ro yay -S --noconfirm --mflags --skipinteg -} - -# list installed packages, show info in preview, and remove selection -yrm() { - yay -Qq | fzf --multi --preview 'yay -Qi {1}' | xargs -ro yay -Rns -} - -# find-in-file - usage: fif <searchTerm> -fif() { - if [ ! "$#" -gt 0 ]; then echo "Need a string to search for!"; return 1; fi - rg --files-with-matches --no-messages "$1" | fzf --preview "highlight -O ansi -l {} 2> /dev/null | rg --colors 'match:bg:yellow' --ignore-case --pretty --context 10 '$1' || rg --ignore-case --pretty --context 10 '$1' {}" -} - -### CONVENIENCE - -# Find an epub book in the library and open it in epr terminal reader. -# previously: find ~/books \( -iname \*.epub -o -iname \*.pdf -o -iname \*.djvu \) | fzf | xargs emacs -bk() { - bkfile=$(find "$BOOKS_DIR" -iname "*.epub" -print | fzf) - if [ -n "$bkfile" ]; then - epr "$bkfile" - fi -} - -# Find an interactive fiction game and open it in frotz. -# Supports Z-machine files (.z1-.z8, .zblorb, .blorb) -tg() { - gamefile=$(find "$IF_GAMES_DIR" -type f \( -iname "*.z[1-8]" -o -iname "*.zblorb" -o -iname "*.blorb" \) -print | fzf) - if [ -n "$gamefile" ]; then - frotz "$gamefile" - fi -} - - - -# close wireguard connection first if already running, then -# run wireguard, selecting the configuration file. -wgup() { - # Check if wireguard is running - output=$(sudo wg) - if [[ -n "$output" ]]; then - # Shutdown all wg interfaces if WireGuard is currently running. - for iface in $(sudo wg show interfaces); do - sudo wg-quick down "${iface}" - done - fi - # Get the list of config files - wgfile=$(sudo find /etc/wireguard/ -iname "*.conf" -exec basename -s .conf {} \; | fzf) - - if [ -n "$wgfile" ]; then - sudo wg-quick up $wgfile - sudo wg - fi -} -wgdown() { - # Check if wireguard is running - output=$(sudo wg) - if [[ -n "$output" ]]; then - # Shutdown all wg interfaces if WireGuard is currently running. - for iface in $(sudo wg show interfaces); do - sudo wg-quick down "${iface}" - done - fi -} -alias wg=wgup |
