Commit graph

9 commits

Author SHA1 Message Date
Barrett Ruth
4a8d57a269
feat: add max_file_size preview limit and show_hidden_when_empty (#85)
* feat(preview): add `max_file_size` config to skip large file previews

Problem: previewing large files (e.g. 500 MB logs, binaries) loads them
into a buffer and can freeze or OOM Neovim. `disable_preview` only
receives the filename, so users cannot gate on file size.

Solution: add `preview_win.max_file_size` (number, MB, default 10). In
`open_preview`, check `entry.meta.stat.size` and fall back to
`vim.uv.fs_stat` when the cached stat is absent. If the file exceeds
the limit and a preview window is already open, render "File too large
to preview" in it; if not, emit a WARN notify and return early. The
cursor-moved auto-update path only fires when a window already exists,
so no flag threading is needed to distinguish explicit from implicit.

Based on: stevearc/oil.nvim#213

* feat(view): add `show_hidden_when_empty` for hidden-only directories

Problem: with `show_hidden = false`, a directory containing only
dotfiles renders as just `..`, giving no indication that entries exist.

Solution: add `view_options.show_hidden_when_empty` (boolean, default
false). After the main filter loop in `render_buffer`, if the option is
set and `#line_table <= 1`, iterate `entry_list` again and render any
entry not matched by `is_always_hidden`, using `is_hidden = true` so
they render with the dimmed hidden style.

Based on: stevearc/oil.nvim#473

* docs(upstream): fix formatting

* docs(upstream): update #213 and #473 with PR and commit links
2026-03-07 16:52:57 -05:00
Barrett Ruth
a9a06b8f3b
feat: add auto_save_on_select_new_entry config option (#84)
Problem: users who want hands-off behaviour had no way to skip the
`prompt_save_on_select_new_entry` confirmation dialog — enabling the
prompt meant always being asked, with no silent auto-save path.

Solution: add `auto_save_on_select_new_entry` (default `false`) which,
when true, calls `M.save()` and proceeds immediately instead of showing
the confirm dialog. Includes type annotations, vimdoc, and upstream
tracker update for stevearc/oil.nvim#393.
2026-03-07 16:08:34 -05:00
Barrett Ruth
082573d779
feat: add open_split/toggle_split API and upstream triage batch (#83)
* docs(upstream): triage batch — #739 cherry-pick, 10 issue updates

* feat: add `open_split` and `toggle_split` API

Problem: canola had no way to open a browser in a normal split window;
only floating windows were supported via `open_float`/`toggle_float`.
`M.close` also crashed with E444 when called from the last window.

Solution: port stevearc/oil.nvim#728 — add `open_split(dir, opts, cb)`
and `toggle_split(dir, opts, cb)` mirroring the float API. Use
`is_canola_win`/`canola_original_win` window vars (not the upstream
`is_oil_win` names). Wrap `nvim_win_close` in `pcall` with `enew()`
fallback to handle the last-window E444 case.

Based on: stevearc/oil.nvim#728

* docs: add vimdoc for `open_split`/`toggle_split` and macOS trash recipe

Cherry-picked from: stevearc/oil.nvim#739

* docs(upstream): fix prettier formatting
2026-03-07 15:45:23 -05:00
Barrett Ruth
01f10e1d79
refactor: drop nvim 0.8/0.9 compat shims from init.lua (#79) 2026-03-06 16:36:37 -05:00
Barrett Ruth
0f386bb69c
fix: show float title when border is nil (#78)
* fix: show float title when border is nil

Problem: the float title was only shown via the native `nvim_win_set_config`
path, which requires a border to render. The guard `config.float.border ~=
'none'` did not account for `nil`, which is the default — so users with no
explicit `border` config never saw the path title in the floating window.

Solution: require both `~= nil` and `~= 'none'` before using the native
title. In all other cases (border nil, 'none', or nvim < 0.9), fall back to
`util.add_title_to_win`, which renders a child floating window for the title.

Based on: stevearc/oil.nvim#683

* refactor: drop nvim-0.9 version checks in float title logic
2026-03-06 16:29:47 -05:00
Barrett Ruth
7a46246062
fix: escape on save prompt cancels select (#76)
Problem: when `prompt_save_on_select_new_entry` is enabled and the user
presses Escape on the "Save changes?" confirm dialog, `vim.fn.confirm`
returns 0, but the select continued as if the user had chosen "No".

Solution: add an explicit `choice == 0` branch that returns immediately,
aborting the select without saving or opening any files.
2026-03-06 16:28:57 -05:00
Barrett Ruth
41f375ee9e
fix: restore buflisted on jumplist buffer re-entry (#71)
* fix: restore `buflisted` on jumplist buffer re-entry

Problem: Neovim's jumplist machinery re-enters canola buffers via an
internal `:edit`-equivalent path, which unconditionally sets
`buflisted = true`. The existing workaround in `open()` and
`open_float()` only covers canola-initiated navigation, leaving
`<C-o>` and `<C-i>` unhandled.

Solution: Apply the same `buf_options.buflisted` guard in the
`BufEnter` autocmd, directly after `set_win_options()`. This fires
on every buffer entry — including all jumplist paths — and mirrors
the pattern already used at the two `:edit` callsites.

* docs: mark upstream #302 as fixed in tracker
2026-03-06 11:55:37 -05:00
c3de0004d1
ci: format 2026-03-05 14:53:30 -05:00
Barrett Ruth
0d3088f57e
refactor: rename oil to canola across entire codebase (#70)
Problem: the codebase still used the upstream \`oil\` naming everywhere —
URL schemes, the \`:Oil\` command, highlight groups, user events, module
paths, filetypes, buffer/window variables, LuaCATS type annotations,
vimdoc help tags, syntax groups, and internal identifiers.

Solution: mechanical rename of every reference. URL schemes now use
\`canola://\` (plus \`canola-ssh://\`, \`canola-s3://\`, \`canola-sss://\`,
\`canola-trash://\`, \`canola-test://\`). The \`:Canola\` command replaces
\`:Oil\`. All highlight groups, user events, augroups, namespaces,
filetypes, require paths, type annotations, help tags, and identifiers
follow suit. The \`upstream\` remote to \`stevearc/oil.nvim\` has been
removed and the \`vim.g.oil\` deprecation shim dropped.
2026-03-05 14:50:10 -05:00
Renamed from lua/oil/init.lua (Browse further)