Skip to content

Commit

Permalink
lfrc.example: Remove rename, add mkdir, add "show execution result"
Browse files Browse the repository at this point in the history
The mapping for `mkdir` is `C` by default, though I expect many users to change
the binding when they copy from lfrc.example. "show execution result" maps to
`` ` ``. Norton Commander & its successors map it to `<c-o>`, but I think that's
better for something opening-relatred.

The `rename` command implements something `lf` has a good built-in for, and I
think can be removed. The remaining redefinition of `open` and such teach the
user all the things that the rename example did.

Many people want a keybinding for `mkdir`. Moreover, the new example shows how
to select the newly created dir, which is a feature I like but would be too
lazy to implement myself.

Finally, whenever a `$` command gives an unexpected error, I want to see what
happened. There are many ways to do so, but the one I added here seems the
simplest and it took me a while to think of it. We could also have an option to
have `$` commands pause like `!` commands when there's an error.
  • Loading branch information
ilyagr committed Apr 2, 2023
1 parent 27ab67a commit 94b770c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions etc/lfrc.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ set cursorpreviewfmt "\033[7;2m"
# use enter for shell commands
map <enter> shell

# show the result of execution of previous commands
map ` !true

# execute current file (must be executable)
map x $$f
map X !$f
Expand All @@ -45,9 +48,11 @@ cmd open &{{
esac
}}

# define a custom 'rename' command without prompt for overwrite
# cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
# map r push :rename<space>
cmd mkdir %{{
mkdir -p -- "$1" &&
lf -remote "send $id select \"$1\""
}}
map C push :mkdir<space>""<left>

# make sure trash folder exists
# %mkdir -p ~/.trash
Expand Down

0 comments on commit 94b770c

Please sign in to comment.