This commit is contained in:
Dylan Araps 2020-08-04 01:02:11 +03:00
parent 09d8840b1a
commit 0e835364f5
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
2 changed files with 32 additions and 3 deletions

3
README
View File

@ -41,6 +41,9 @@ G - go to bottom
q - quit
: - cd to <input>
/ - search current directory *<input>*
- - go to last directory
~ - go home
! - spawn shell
opener

32
shfm
View File

@ -109,6 +109,7 @@ main() {
set -e
esc_char=$(printf '\033')
bs_char=$(printf '\177')
cd "${1:-"$PWD"}"
set -- *
@ -166,7 +167,7 @@ main() {
esac
;;
l?|C2) # ARROW RIGHT
l?|C2|"$esc") # ARROW RIGHT
if cd "$cur"; then
set -- *
y=1 y2=1
@ -179,7 +180,7 @@ main() {
redraw "$@"
;;
h?|D2) # ARROW LEFT
h?|D2|"$bs_char"?) # ARROW LEFT
old_pwd=$PWD
case $search in
@ -217,12 +218,37 @@ main() {
prompt / r
set -- *"$ans"*
y=1 y2=1 cur=$1 search=1
redraw "$@"
status_line "search: $ans ($y/$#)"
;;
-?)
cd "$OLDPWD" >/dev/null 2>&1|| continue
set -- *
y=1 y2=1 cur=$1
redraw "$@"
;;
\~?)
cd || continue
set -- *
y=1 y2=1 cur=$1
redraw "$@"
;;
\!?)
export SHFM_LEVEL
SHFM_LEVEL=$((SHFM_LEVEL + 1))
term_reset
"${SHELL:=/bin/sh}"
term_setup
redraw "$@"
;;
q?)
exit 0
;;