feat(config): add default_to_float option (#173)

Problem: opening oil as a float requires users to remap every entry
point (`-`, `:Oil`, startup autocmd) individually. There is no single
flag to make float the default everywhere.

Solution: add `default_to_float = false` to config. When `true`,
`M.open()` delegates to `M.open_float()` (covers `:Oil` and all keymap
invocations), and a `VimEnter` hook replaces the initial directory
buffer with a float when starting Neovim on a directory (e.g. `nvim .`).
No recursion risk — `open_float()` calls `vim.cmd.edit()` directly and
never goes through `M.open()`.

Based on: stevearc/oil.nvim#298
This commit is contained in:
Barrett Ruth 2026-03-18 14:12:55 -04:00 committed by GitHub
parent 91f4b13810
commit 3fede7d809
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 34 additions and 1 deletions

View file

@ -51,7 +51,7 @@ issues against this fork.
| [#288](https://github.com/stevearc/oil.nvim/issues/288) | Oil failing to load | not actionable — no reliable repro, likely lazy.nvim timing |
| [#289](https://github.com/stevearc/oil.nvim/issues/289) | Show absolute path toggle | not actionable — display solved by `get_win_title`, editing consolidated into [#32](https://github.com/barrettruth/canola.nvim/issues/32) |
| [#294](https://github.com/stevearc/oil.nvim/issues/294) | Can't handle emojis in filenames | not actionable — libuv bug ([nodejs/node#49042](https://github.com/nodejs/node/issues/49042)) |
| [#298](https://github.com/stevearc/oil.nvim/issues/298) | Open float on neovim directory startup | open |
| [#298](https://github.com/stevearc/oil.nvim/issues/298) | Open float on neovim directory startup | fixed ([#173](https://github.com/barrettruth/canola.nvim/pull/173)) |
| [#302](https://github.com/stevearc/oil.nvim/issues/302) | `buflisted=true` after jumplist nav | fixed ([#71](https://github.com/barrettruth/canola.nvim/pull/71)) |
| [#303](https://github.com/stevearc/oil.nvim/issues/303) | Preview in float window mode | fixed — upstream [#403](https://github.com/stevearc/oil.nvim/pull/403), `config.float.preview_split` |
| [#325](https://github.com/stevearc/oil.nvim/issues/325) | oil-ssh error from command line | fixed |