lf File Manager Configuration Comparison C
18. profile Command
Key Binding: z2
(extra), z3
(disk), z4
(convert), z5
(develop), z6
(auto-redraw), z7
(tarzip)
Code Comparison:
- Lumesh: Uses string interpolation and array access
lf -remote `send $id source ~/.config/lf/profiles/${$argv[0]}` |
- Bash:
lf -remote "send $id source ~/.config/lf/profiles/$1" |
Advantages:
- Lumesh: Supports configuration file switching, string interpolation syntax is concise
- Bash: String interpolation syntax is straightforward
19. zox/z Command (zoxide Integration)
Key Binding: ;
(push :zoxgz
(push :zox
Code Comparison:
- Lumesh: Uses conditional expressions and function calls
if len($argv) { |
- Bash: Uses conditional checks and command substitution
if [ -n "$@" ]; then |
Advantages:
- Lumesh:
len()
function is clear in semantics,pwd()
function call is intuitive - Bash: Logical operators allow for standard chaining, error handling is explicit
20. cd-usermedia Command
Key Binding: gi
Code Comparison:
- Lumesh: Uses environment variables
lf -remote `send $id cd $XDG_RUNTIME_DIR/media` |
- Bash: Uses command substitution
lf -remote "send $id cd /run/user/$(id -u)/media" |
Advantages:
- Lumesh: Directly uses environment variables, more compliant with XDG specifications
- Bash: Dynamically retrieves user ID, better compatibility
21. follow-link Command
Key Binding: gL
Code Comparison:
- Lumesh: Uses variable assignment
lf -remote `send $id select ${readlink $f}` |
- Bash: Uses command substitution
lf -remote "send ${id} select '$(readlink $f)'" |
Advantages:
- Lumesh: Variable assignment syntax is clear and readable
- Bash: Inline command substitution is compact, reducing variable usage
22. fzf-edit Command
Key Binding: fe
Code Comparison:
- Lumesh: Simple command invocation
hx (fzf) |
- Bash: Uses command substitution
hx $(fzf) |
Advantages:
- Lumesh: Parentheses syntax is more modern
- Bash: Traditional command substitution syntax is standard
23. fzf-file Command
Key Binding: ff<space>
, fft
(txt), ffg
(gz), ffm
(md), ffs
(sh), ffy
(py)
Code Comparison:
- Lumesh: Uses ternary operator and string concatenation
let ext = len($argv) ? '-e'+$argv[0] : '' |
- Bash: Uses conditional checks and variable assignment
[ -n ${1:-''} ] && E="-e$1" || E='-S-50k' |
Advantages:
- Lumesh: Ternary operator is concise, string concatenation is intuitive
- Bash: Parameter expansion syntax is flexible, logical operators are standard
24. fzf-folder Command
Key Binding: fd
Code Comparison:
- Lumesh: Uses variable assignment and conditional checks
select = $lf_user_wheel fd --type d '.' -d 5 | fzf --preview 'ls {}' |
- Bash: Uses command substitution and logical operators
select=$($lf_user_wheel fd --type d . -d 5 | fzf --preview 'ls {}') \ |
Advantages:
- Lumesh: Variable assignment syntax is clear, no explicit error handling needed
- Bash: Logical operators allow for standard chaining, error handling is explicit
25. filter Series Commands
Key Binding: \\
(filter), F<space>
(filter), Ft
(.txt), Fp
(.png), Fj
(.jpg), Fa
(.mp3), Fv
(.mp4), Fw
(.docx), Fx
(.xlsx), Fg
(.gz), Fz
(.zip), Fm
(.md), Fs
(.sh), Fy
(.py), Fc
(clear)
Code Comparison:
- Code is consistent across both implementations.
26. delete Command
Key Binding: dD
Code Comparison:
- Lumesh: Uses modern output and confirmation
println '=====DELETE====='.red().bold() $fx '================'.red() |
- Bash: Uses traditional echo and read
echo -e "=====\033[31mDELETE\033[0m=====" |
Advantages:
- Lumesh: Built-in color methods and confirmation functions, syntax is more modern
- Bash: ANSI escape sequences allow for direct control,
wc
accurately counts files
27. trash Command
Key Binding: dd
Code Comparison:
- Lumesh: Uses built-in functions and string interpolation
let files = $fx.lines() | List.map(Fs.base_name) |
- Bash: Uses traditional tools and command substitution
printf "Temporary Trash %d files? [y/N]" $(wc -w <<< $fx) |
Advantages:
- Lumesh: Functional handling of file lists, string interpolation displays file names
- Bash: Accurate file count statistics, conditional directory creation is concise
28. link Command
Key Binding: pL
Code Comparison:
- Lumesh: Uses filesystem functions and loops
let load= Fs.read ~/.local/share/lf/files | .lines() |
- Bash: Uses sed and basename
load=$(cat ~/.local/share/lf/files) |
Advantages:
- Lumesh: Built-in filesystem functions are rich, existence checks are type-safe
- Bash: Sed text processing is efficient, basename handles batch processing standard
29. paste-rsync Command
Key Binding: pr
Code Comparison:
- Lumesh: Uses pattern matching
let load= Fs.read ~/.local/share/lf/files | .lines() |
- Bash: Uses case statement and pipeline processing
set -- $(cat ~/.local/share/lf/files) |
Advantages:
- Lumesh: Modern syntax for pattern matching, array operations are intuitive
- Bash: Positional parameter handling is flexible, real-time progress display is comprehensive
30. paste-to/paste-from Command
Key Binding: pt
(paste-to), pf
(paste-from)
Code Comparison:
- Lumesh: Uses error handling operators and conditional checks
let dest = $argv[0] ?: {print 'Cancelled';exit 0} |
- Bash: Uses parameter expansion and conditional checks
if [ -n "${1:-}" ]; then |
Advantages:
- Lumesh: Error handling operators are concise, filesystem functions are type-safe
- Bash: Parameter expansion is standard, logical operators allow for clear chaining
Complete Functionality Comparison Summary
Advanced Feature Comparison
Feature Category | Lumesh Features | Bash Features |
---|---|---|
Error Handling | ?: , ?. , ?! operators |
&& , ` |
Data Processing | Chained calls, functional programming | Pipelines, text processing tools |
File Operations | Built-in Fs module, type safety | Standard Unix tools |
User Interaction | Ui.confirm, Ui.pick | read, fzf |
String Processing | Built-in methods, interpolation | cut, sed, awk |
Code Maintainability
Lumesh Advantages:
- Modern syntax improves readability
- Type safety reduces runtime errors
- Unified API design
- Built-in error handling mechanisms
Bash Advantages:
- Extensive community support
- Rich documentation resources
Notes
Through the complete comparison of all commands, it is evident that Lumesh has significant advantages in syntax modernization, type safety, and code readability, while Bash is more mature in compatibility. Both implementations can accomplish the same file management tasks, and the choice primarily depends on the user’s preference for modern syntax versus reliance on traditional Unix tools.
Read more: