From c695ae049fd15a90c8c9c1e72b31ee5d929a54c8 Mon Sep 17 00:00:00 2001 From: "John F. Mercer" Date: Thu, 30 Nov 2023 15:22:43 -0500 Subject: [PATCH 1/2] Fix fzf --- .chezmoiexternal.yaml | 7 +++++++ .../run_onchange_before_10_homebrew.sh.tmpl | 7 ++++++- .../linux/run_onchange_before_10_installs.sh.tmpl | 8 ++++---- .../run_onchange_before_30_linux_aliases.sh.tmpl | 1 + .chezmoiscripts/run_after_fzf_install.sh.tmpl | 15 +++++++++++++++ .chezmoiversion | 2 +- fzf/exports.zsh | 9 +++++++-- system/exports.zsh | 1 + 8 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 .chezmoiscripts/run_after_fzf_install.sh.tmpl create mode 100644 system/exports.zsh diff --git a/.chezmoiexternal.yaml b/.chezmoiexternal.yaml index ee5a033..ce1ad91 100644 --- a/.chezmoiexternal.yaml +++ b/.chezmoiexternal.yaml @@ -5,6 +5,13 @@ exact: true stripComponents: 1 refreshPeriod: "168h" +# fzf +".fzf": + type: "archive" + url: "https://github.com/junegunn/fzf/archive/master.tar.gz" + exact: true + stripComponents: 1 + refreshPeriod: "168h" # vim plugin manager ".vim/autoload/plug.vim": type: "file" diff --git a/.chezmoiscripts/darwin/run_onchange_before_10_homebrew.sh.tmpl b/.chezmoiscripts/darwin/run_onchange_before_10_homebrew.sh.tmpl index 761e1a4..e705113 100644 --- a/.chezmoiscripts/darwin/run_onchange_before_10_homebrew.sh.tmpl +++ b/.chezmoiscripts/darwin/run_onchange_before_10_homebrew.sh.tmpl @@ -11,10 +11,11 @@ brew tap homebrew/cask-fonts "brew-cask-completion" "cheat" "chezmoi" + "colordiff" "ctags" "dockutil" "eza" - "fzf" + "fd" "gh" "git" "git-delta" @@ -46,4 +47,8 @@ brew "{{ . }}" cask "{{ . }}" {{- end }} EOF + +# Complete fzf installation +$(brew --prefix)/opt/fzf/install --key-bindings --completion --no-update-rc + {{ end }} diff --git a/.chezmoiscripts/linux/run_onchange_before_10_installs.sh.tmpl b/.chezmoiscripts/linux/run_onchange_before_10_installs.sh.tmpl index 23a33a5..907832e 100644 --- a/.chezmoiscripts/linux/run_onchange_before_10_installs.sh.tmpl +++ b/.chezmoiscripts/linux/run_onchange_before_10_installs.sh.tmpl @@ -18,7 +18,7 @@ packages=( "colordiff" "direnv" "expect" # needed to set shell on Parrot - "fzf" + "fd-find" "gh" "git" "gpg" @@ -38,12 +38,12 @@ packages=( "xclip" ) -# security only packages +# security only packages - kali only # this separate list helps with Github CI to pass -{{ if or (eq .osid "linux-kali") (eq .osid "linux-parrot") }} +# not doing this on parrot because all it does is complain +{{ if eq .osid "linux-kali" }} sec_packages=( - "burpsuite" "gobuster" "seclists" ) diff --git a/.chezmoiscripts/linux/run_onchange_before_30_linux_aliases.sh.tmpl b/.chezmoiscripts/linux/run_onchange_before_30_linux_aliases.sh.tmpl index f9016c7..fae90ee 100644 --- a/.chezmoiscripts/linux/run_onchange_before_30_linux_aliases.sh.tmpl +++ b/.chezmoiscripts/linux/run_onchange_before_30_linux_aliases.sh.tmpl @@ -10,6 +10,7 @@ cat <> "$DOTFILES/system/linux.zsh" alias pbcopy='xclip -selection clipboard' alias pbpaste='xclip -selection clipboard -o' alias bat='batcat' +alias fd='fdfind' EOF {{- end -}} \ No newline at end of file diff --git a/.chezmoiscripts/run_after_fzf_install.sh.tmpl b/.chezmoiscripts/run_after_fzf_install.sh.tmpl new file mode 100644 index 0000000..f6a49c2 --- /dev/null +++ b/.chezmoiscripts/run_after_fzf_install.sh.tmpl @@ -0,0 +1,15 @@ +{{- if and (eq .chezmoi.os "darwin" "linux") -}} +#!/usr/bin/env bash +set -eufo pipefail + +if [ -d "$HOME/.fzf" ]; then + "$HOME"/.fzf/install --key-bindings --completion --no-update-rc + EXIT_STATUS="$?" +else + echo "WARNING: fzf not installed!!!" + EXIT_STATUS=1 +fi + +exit "$EXIT_STATUS" + +{{- end -}} diff --git a/.chezmoiversion b/.chezmoiversion index 2950849..318aa9b 100644 --- a/.chezmoiversion +++ b/.chezmoiversion @@ -1 +1 @@ -2.40.2 +2.42.1 diff --git a/fzf/exports.zsh b/fzf/exports.zsh index 32f80e7..dea4bef 100644 --- a/fzf/exports.zsh +++ b/fzf/exports.zsh @@ -8,5 +8,10 @@ export FZF_DEFAULT_COMMAND="git ls-files --cached --others --exclude-standard | export FZF_CTRL_T_COMMAND="fd $FD_OPTIONS" export FZF_ALT_C_COMMAND="fd --type d $FD_OPTIONS" -export BAT_PAGER="less -R" - +# On Linux, we need fdfind instead of fd and batcat instead of bat. +if [[ "$(uname)" == "Linux" ]]; then + export FZF_DEFAULT_OPTS="--no-mouse --height 90% -1 --reverse --multi --inline-info --preview='[[ \$(file --mime {}) =~ binary ]] && echo {} is a binary file || (batcat --style=numbers --color=always {} || cat {}) 2> /dev/null | head -300'" + export FZF_DEFAULT_COMMAND="git ls-files --cached --others --exclude-standard | fdfind --type f --type l $FD_OPTIONS" + export FZF_CTRL_T_COMMAND="fdfind $FD_OPTIONS" + export FZF_ALT_C_COMMAND="fdfind --type d $FD_OPTIONS" +fi diff --git a/system/exports.zsh b/system/exports.zsh new file mode 100644 index 0000000..a012cf4 --- /dev/null +++ b/system/exports.zsh @@ -0,0 +1 @@ +export BAT_PAGER="less -R" From c82eb891d2d31653eb80b32e16ea5dbbe65ca07a Mon Sep 17 00:00:00 2001 From: "John F. Mercer" Date: Thu, 30 Nov 2023 19:44:08 -0300 Subject: [PATCH 2/2] Remove dead zshrc --- zsh/zshrc | 65 ------------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 zsh/zshrc diff --git a/zsh/zshrc b/zsh/zshrc deleted file mode 100644 index 9f81135..0000000 --- a/zsh/zshrc +++ /dev/null @@ -1,65 +0,0 @@ -# profiling functions -# zmodload zsh/zprof -# for i in $(seq 1 10); do /usr/bin/time /bin/zsh -i -c exit; done - - -# DO NOT RENAME THIS FILE -# unless you enjoy infinite loops - -export DOTFILES="$HOME/.dotfiles" - -# declare an array of our .zsh files -# -U removes duplicate values -typeset -U config_files -config_files=($DOTFILES/*/*.zsh) - -# load the exports files -for file in ${(M)config_files:#*/exports.zsh}; do - source "$file" -done - -# load the path files -for file in ${(M)config_files:#*/path.zsh}; do - source "$file" -done - -# Configure & load the prompt theme, sindresorhus/pure -source $DOTFILES/zsh/prompt.zsh - -# load plugins without a plugin manager -# they must first be installed via plugins/install.sh -# update by running update-zsh-plugins -# inspiration taken from https://github.com/mattmc3/zsh_unplugged -ZPLUGINDIR=$HOME/.dotfiles/plugins/bundle -source $ZPLUGINDIR/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh -source $ZPLUGINDIR/zsh-completions/zsh-completions.plugin.zsh -# N.B.: Load syntax highlighting *before* history search. Cf. https://github.com/zsh-users/zsh-history-substring-search#usage -source $ZPLUGINDIR/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh -source $ZPLUGINDIR/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh -source $ZPLUGINDIR/zsh-z/zsh-z.plugin.zsh - -# load everything but the path and exports files -for file in ${${config_files:#*/path.zsh}:#*/exports.zsh}; do - source "$file" -done - -# initialize autocomplete here, otherwise functions won't be loaded -autoload -Uz compinit -compinit - -unset config_files - -# top secret -if [[ -a $HOME/.localrc ]] -then - source $HOME/.localrc -fi - -# Fixes wonky control flow issues -stty -ixon -ixoff - -# fzf fuzzy finder -# this goes last, I think -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - -# zprof