Skip to content

Commit

Permalink
Fix fzf
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmercer committed Nov 30, 2023
1 parent 5010706 commit 4e3d268
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .chezmoiexternal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ brew tap homebrew/cask-fonts
"brew-cask-completion"
"cheat"
"chezmoi"
"colordiff"
"ctags"
"dockutil"
"eza"
"fzf"
"fd"
"gh"
"git"
"git-delta"
Expand Down Expand Up @@ -46,4 +47,8 @@ brew "{{ . }}"
cask "{{ . }}"
{{- end }}
EOF

# Complete fzf installation
$(brew --prefix)/opt/fzf/install --key-bindings --completion --no-update-rc

{{ end }}
8 changes: 4 additions & 4 deletions .chezmoiscripts/linux/run_onchange_before_10_installs.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ packages=(
"colordiff"
"direnv"
"expect" # needed to set shell on Parrot
"fzf"
"fd-find"
"gh"
"git"
"gpg"
Expand All @@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cat <<EOF >> "$DOTFILES/system/linux.zsh"
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
alias bat='batcat'
alias fd='fdfind'
EOF

{{- end -}}
15 changes: 15 additions & 0 deletions .chezmoiscripts/run_after_fzf_install.sh.tmpl
Original file line number Diff line number Diff line change
@@ -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 -}}
2 changes: 1 addition & 1 deletion .chezmoiversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.40.2
2.42.1
9 changes: 7 additions & 2 deletions fzf/exports.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions system/exports.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export BAT_PAGER="less -R"

0 comments on commit 4e3d268

Please sign in to comment.