Skip to content
This repository was archived by the owner on Feb 14, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ if zplug check 'ytet5uy4/fzf-widgets'; then

# Start fzf in a tmux pane
FZF_WIDGET_TMUX=1

# use fd for finding directories and files
FZF_CHANGE_DIR_FIND_COMMAND="fd -t d"
FZF_INSERT_DIR_FIND_COMMAND="fd -t d"
FZF_INSERT_FILE_COMMAND="fd -t f"
FZF_EDIT_FILES_COMMAND="fd -t f"

# modify history command to remove duplicates
FZF_HISTORY_COMMAND="fc -l 1 | sed 's/^ *[0-9]*\*? //g' | awk '!seen[\$0]++'"
fi
```

Expand Down
2 changes: 1 addition & 1 deletion autoload/widgets/fzf-change-directory
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__fzf::widget::init 'cd --' || return 1

find . -mindepth 1 -type d -o -type l 2>/dev/null | \
eval "${FZF_CHANGE_DIR_FIND_COMMAND:-"find . -mindepth 1 -type d -o -type l 2>/dev/null"}" | \
sed 's|\./||g' | \
__fzf::widget::select $FZF_WIDGET_OPTS[change-dir] +m | \
__fzf::widget::insert -q
Expand Down
8 changes: 4 additions & 4 deletions autoload/widgets/fzf-edit-files
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

__fzf::widget::init "$EDITOR --" || return 1

find -L . -type f -print -o -type l -print -o \
\( -path '*/\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \) -prune \
2> /dev/null | \
sed 's|\./||g' | \
eval "${FZF_EDIT_FILES_COMMAND:-"find -L . -type f -print -o -type l -print -o \\
\\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \\
2> /dev/null | \\
sed 's|\\./||g'"}" | \
__fzf::widget::select $FZF_WIDGET_OPTS[edit-files] -m | \
__fzf::widget::insert -q

Expand Down
12 changes: 7 additions & 5 deletions autoload/widgets/fzf-insert-directory
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

__fzf::widget::init || return 1

find -L . -type d -print -o -type l -print -o \
\( -path '*/\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \) -prune \
2> /dev/null | \
grep -v '^.$' | \
sed 's|\./||g' | \
eval "${FZF_INSERT_DIR_FIND_COMMAND:-"find -L . \\
-type d -print -o -type l -print -o \\
\\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) \\
-prune 2> /dev/null | \\
grep -v '^.$' | \\
sed 's|\\./||g'
"}" | \
__fzf::widget::select $FZF_WIDGET_OPTS[insert-directory] +m | \
__fzf::widget::insert -q
8 changes: 4 additions & 4 deletions autoload/widgets/fzf-insert-files
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

__fzf::widget::init || return 1

find -L . -type f -print -o -type l -print -o \
\( -path '*/\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \) -prune \
2> /dev/null | \
sed 's|\./||g' | \
eval "${FZF_INSERT_FILE_COMMAND:-"find -L . -type f -print -o -type l -print -o \\
\\( -path '*/\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \\
2> /dev/null | \\
sed 's|\./||g'"}" | \
__fzf::widget::select $FZF_WIDGET_OPTS[insert-files] -m | \
__fzf::widget::insert -q
4 changes: 2 additions & 2 deletions autoload/widgets/fzf-insert-history
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

__fzf::widget::init || return 1

fc -l 1 | \
eval "${FZF_HISTORY_COMMAND:-"fc -l 1"}" | \
__fzf::widget::select --tac --tiebreak=index \
--bind=ctrl-r:toggle-sort $FZF_WIDGET_OPTS[insert-history] --query="$LBUFFER" +m | \
sed 's/ *[0-9]* //g' | \
sed 's/^ *[0-9]*\*? //g' | \
__fzf::widget::replace