From c7c7ce5bd47030ee9c60a859f25695647610b8bd Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Mon, 1 Jul 2024 11:34:02 -0700 Subject: [PATCH] feat: rename experimental_watch_for_changes -> watch_for_changes I've been using this for a while now and haven't seen any issues. We can take "experimental" out of the name. --- README.md | 2 +- doc/oil.txt | 2 +- lua/oil/config.lua | 7 ++++++- lua/oil/types.lua | 2 +- lua/oil/view.lua | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 524657d..52d6cf5 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ require("oil").setup({ -- Set to `false` to disable, or "name" to keep it on the file names constrain_cursor = "editable", -- Set to true to watch the filesystem for changes and reload oil - experimental_watch_for_changes = false, + watch_for_changes = false, -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) -- Additionally, if it is a string that matches "actions.", diff --git a/doc/oil.txt b/doc/oil.txt index a10cd9f..f34aa1a 100644 --- a/doc/oil.txt +++ b/doc/oil.txt @@ -65,7 +65,7 @@ CONFIG *oil-confi -- Set to `false` to disable, or "name" to keep it on the file names constrain_cursor = "editable", -- Set to true to watch the filesystem for changes and reload oil - experimental_watch_for_changes = false, + watch_for_changes = false, -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) -- Additionally, if it is a string that matches "actions.", diff --git a/lua/oil/config.lua b/lua/oil/config.lua index e1dd950..ba52ed1 100644 --- a/lua/oil/config.lua +++ b/lua/oil/config.lua @@ -50,7 +50,7 @@ local default_config = { -- Set to `false` to disable, or "name" to keep it on the file names constrain_cursor = "editable", -- Set to true to watch the filesystem for changes and reload oil - experimental_watch_for_changes = false, + watch_for_changes = false, -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) -- Additionally, if it is a string that matches "actions.", @@ -207,6 +207,11 @@ M.setup = function(opts) ) end + -- This option was renamed because it is no longer experimental + if new_conf.experimental_watch_for_changes then + new_conf.watch_for_changes = true + end + for k, v in pairs(new_conf) do M[k] = v end diff --git a/lua/oil/types.lua b/lua/oil/types.lua index d7a3a0a..ef6d26b 100644 --- a/lua/oil/types.lua +++ b/lua/oil/types.lua @@ -9,7 +9,7 @@ ---@field cleanup_delay_ms? integer Oil will automatically delete hidden buffers after this delay. You can set the delay to false to disable cleanup entirely. Note that the cleanup process only starts when none of the oil buffers are currently displayed. ---@field lsp_file_methods? oil.LspFileMethods Configure LSP file operation integration. ---@field constrain_cursor? false|"name"|"editable" Constrain the cursor to the editable parts of the oil buffer. Set to `false` to disable, or "name" to keep it on the file names. ----@field experimental_watch_for_changes? boolean Set to true to watch the filesystem for changes and reload oil. +---@field watch_for_changes? boolean Set to true to watch the filesystem for changes and reload oil. ---@field keymaps? table ---@field use_default_keymaps? boolean Set to false to disable all of the above keymaps ---@field view_options? oil.ViewOptions Configure which files are shown and how they are shown. diff --git a/lua/oil/view.lua b/lua/oil/view.lua index cfedcdb..36cc179 100644 --- a/lua/oil/view.lua +++ b/lua/oil/view.lua @@ -447,7 +447,7 @@ M.initialize = function(bufnr) if adapter and adapter.name == "files" - and config.experimental_watch_for_changes + and config.watch_for_changes and not session[bufnr].fs_event then local fs_event = assert(uv.new_fs_event())