summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2019-01-05 18:43:47 +0200
committerDylan Araps <dylan.araps@gmail.com>2019-01-05 18:43:47 +0200
commitf293c54fce8b6593a0b29d15d89b15ca4d7c8217 (patch)
treed6a4bb8ac445c8e8f44b6c7836621b9ee83a78c2
parent03966668879780fd556a3d82f1c1d753003c878f (diff)
bug fixes0.3.1
-rw-r--r--README.md2
-rwxr-xr-xfff10
-rw-r--r--fff.12
3 files changed, 7 insertions, 7 deletions
diff --git a/README.md b/README.md
index 05a5c43..825b700 100644
--- a/README.md
+++ b/README.md
@@ -85,7 +85,7 @@ export FFF_COL3=6
export FFF_COL4=1
# Text Editor
-export FFF_EDITOR="vim" # alternative: export EDITOR="vim"
+export EDITOR="vim"
# File Opener
export FFF_OPENER="xdg-open"
diff --git a/fff b/fff
index 2dfa19e..ec4153f 100755
--- a/fff
+++ b/fff
@@ -4,7 +4,7 @@
refresh() {
printf '\e[?7l\e[?25l\e[2J\e[H'
- (:;:); ((LINES==0)) && read -r LINES _ < <(stty size)
+ LINES=; (:;:); ((LINES==0)) && read -r LINES _ < <(stty size)
((m=LINES-3,j=l>m/2?l>=c-m/2?c+1:l+m/2+1:m,k=k>=0?j-m>=0?j-m:k:k,l=l>c?k:l))
}
@@ -42,7 +42,7 @@ open() {
[[ -f $1 ]] && {
[[ "$OSTYPE" == darwin* ]] && { oc=open; fa="bIL"; }
case "$(file "-${fa:-biL}" "$1")" in
- text/*) "${FFF_EDITOR:-${EDITOR:-vi}}" "$1"; printf '\e[?25l' ;;
+ text/*|inode/x-empty*) "${EDITOR:-vi}" "$1"; printf '\e[?25l' ;;
*) nohup "${FFF_OPENER:-${oc:-xdg-open}}" "$1" &>/dev/null & disown
esac
}
@@ -51,12 +51,12 @@ open() {
prompt() {
printf '\e[999B\e[?25h'
case "${1: -1}" in
- r) read -rp "rename ${f[l]##*/}: "; [[ $REPLY ]] && \
+ r) read -erp "rename ${f[l]##*/}: "; [[ $REPLY ]] && \
mv "${f[l]}" "$PWD/$REPLY" ;;
d) read -n 1 -rp "trash ${f[l]##*/}? [y/n]: " y; [[ $y == y ]] && {
mv "${f[l]}" "$FFF_TRASH"; ((l>0?l--:l)); } ;;
- n) read -rp "mkdir: "; [[ $REPLY ]] && mkdir -p "$PWD/$REPLY" ;;
- f) read -rp "mkfile: "; [[ $REPLY ]] && : > "$PWD/$REPLY" ;;
+ n) read -erp "mkdir: "; [[ $REPLY ]] && mkdir -p "$PWD/$REPLY" ;;
+ f) read -erp "mkfile: "; [[ $REPLY ]] && : > "$PWD/$REPLY" ;;
/) g="$PWD"; IFS= read -n 1 -rsp $'\e[2K\r'"/$s2" s1
[[ $s1 == $'\177' ]] && s2="${s2%?}" || s2+="$s1"
[[ $s1 == $'\e' ]] && { refresh; get_dir; return; }
diff --git a/fff.1 b/fff.1
index b4daaff..24b3918 100644
--- a/fff.1
+++ b/fff.1
@@ -111,7 +111,7 @@ export FFF_COL3=1
export FFF_COL4=6
.TP
\fBText Editor\fR
-export FFF_EDITOR="vim" # alternative: export EDITOR="vim"
+export EDITOR="vim"
.TP
\fBFile Opener\fR
export FFF_OPENER="xdg-open"