Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
general: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanaraps committed Feb 6, 2019
1 parent c81b2f4 commit 7bebeb2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions fff
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ get_ls_colors() {
ls_patterns="${ls_patterns%?}"

# Define the ls_ variables.
# 'declare' can't be used here as variables are scoped
# locally. 'declare -g' is not available in 'bash 3'.
# 'export' is a viable alternative.
export "${ls_cols[@]}" &>/dev/null
}

Expand Down Expand Up @@ -185,14 +188,14 @@ status_line() {

read_dir() {
# Read a directory to an array and sort it directories first.
local dirs=()
local files=()
local dirs
local files
local item_index

# If '$PWD' is '/', unset it to avoid '//'.
[[ $PWD == / ]] && PWD=

for item in "$PWD"/*; do
for item in "$PWD"/*; {
if [[ -d $item ]]; then
dirs+=("$item")
((item_index++))
Expand All @@ -204,7 +207,7 @@ read_dir() {
else
files+=("$item")
fi
done
}

list=("${dirs[@]}" "${files[@]}")

Expand Down Expand Up @@ -519,7 +522,7 @@ trash() {
cd "$FFF_TRASH" && mv -f "$@"

# Go back to where we were.
cd - &>/dev/null ||:
cd "$OLDPWD" ||:
fi
}

Expand Down Expand Up @@ -690,7 +693,7 @@ cmd_line() {
;;

# Anything else, add it to read reply.
" "|*)
*)
cmd_reply+="$read_reply"

# Clear tab-completion.
Expand Down Expand Up @@ -808,7 +811,7 @@ key() {
# Go to top.
"${FFF_KEY_TO_TOP:=g}")
((scroll != 0)) && {
((scroll=0))
scroll=0
redraw
}
;;
Expand Down

0 comments on commit 7bebeb2

Please sign in to comment.