Skip to content

feat!: remove recursive dir support for setlocal - #2415

Merged
joelim-work merged 3 commits into
gokcehan:masterfrom
joelim-work:remove-recusrive-setlocal
Mar 5, 2026
Merged

feat!: remove recursive dir support for setlocal#2415
joelim-work merged 3 commits into
gokcehan:masterfrom
joelim-work:remove-recusrive-setlocal

Conversation

@joelim-work

Copy link
Copy Markdown
Contributor

Reasons for removal

  • setlocal in Vim is simple and applies only to the current buffer/window. For lf, this can be extended to apply to a specific directory instead of the current one, but including direct support for recursive directories introduces additional complexity.
  • Despite the additional complexity, recursive directories still cannot handle all use cases:
    • Recursion depth cannot be specified setlocal depth/glob specificationΒ #1656
    • String matching is not supported (e.g. directories with names starting with foo)
    • Other user-specific rules (e.g. directories containing .git)
  • User-specific rules for applying setlocal to directories satisfying some condition can be implemented via on-load hooks (see below for examples)
  • The distinction between /homdie/user/foo and /home/user/foo/ is not intuitive for users, as most commands (rsync is a notable exception) treat them as equivalent.

Examples

Apply setlocal to a directory and its subdirectories:

cmd on-load &{{
    root="$HOME"/Downloads
    dir=$(dirname "$1")

    case $dir in
        "$root"|"$root"/*) lf -remote "send $id setlocal $dir info size";;
    esac
}}

Apply setlocal to Git repos:

cmd on-load &{{
    dir=$(dirname "$1")

    if [ -d "$dir"/.git ]; then
        lf -remote "send $id setlocal $dir hidden"
    fi
}}

@CatsDeservePets CatsDeservePets added the breaking Pull requests that introduce breaking changes label Mar 5, 2026
@joelim-work joelim-work added this to the r42 milestone Mar 5, 2026
@joelim-work
joelim-work merged commit 374ae19 into gokcehan:master Mar 5, 2026
32 checks passed
@joelim-work
joelim-work deleted the remove-recusrive-setlocal branch March 5, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Pull requests that introduce breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants