mirror of
https://github.com/aquatix/dotfiles.git
synced 2025-12-07 03:35:10 +01:00
Quickly find and edit files
This commit is contained in:
21
bin/fuz
Executable file
21
bin/fuz
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Taken from https://medium.com/adorableio/simple-note-taking-with-fzf-and-vim-2a647a39cfa
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
main() {
|
||||||
|
previous_file="$1"
|
||||||
|
file_to_edit=`select_file $previous_file`
|
||||||
|
|
||||||
|
if [ -n "$file_to_edit" ] ; then
|
||||||
|
"$EDITOR" "$file_to_edit"
|
||||||
|
main "$file_to_edit"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
select_file() {
|
||||||
|
given_file="$1"
|
||||||
|
fzf --preview="cat {}" --preview-window=right:70%:wrap --query="$given_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
main ""
|
||||||
Reference in New Issue
Block a user