doc: document some configuration options (#283)

This commit is contained in:
Steven Arcangeli 2024-01-21 09:34:28 -08:00
parent 0ef49e495e
commit f0315c101f
4 changed files with 87 additions and 12 deletions

View file

@ -164,7 +164,7 @@ COL_DEFS = [
def get_options_vimdoc() -> "VimdocSection":
section = VimdocSection("options", "oil-options")
section = VimdocSection("config", "oil-config")
config_file = os.path.join(ROOT, "lua", "oil", "config.lua")
opt_lines = read_section(config_file, r"^local default_config =", r"^}$")
lines = ["\n", ">lua\n", ' require("oil").setup({\n']
@ -174,6 +174,43 @@ def get_options_vimdoc() -> "VimdocSection":
return section
def get_options_detail_vimdoc() -> "VimdocSection":
section = VimdocSection("options", "oil-options")
section.body.append(
"""
skip_confirm_for_simple_edits *oil.skip_confirm_for_simple_edits*
type: `boolean` default: `false`
Before performing filesystem operations, Oil displays a confirmation popup to ensure
that all operations are intentional. When this option is `true`, the popup will be
skipped if the operations:
* contain no deletes
* contain no cross-adapter moves or copies (e.g. from local to ssh)
* contain at most one copy or move
* contain at most five creates
prompt_save_on_select_new_entry *oil.prompt_save_on_select_new_entry*
type: `boolean` default: `true`
There are two cases where this option is relevant:
1. You copy a file to a new location, then you select it and make edits before
saving.
2. You copy a directory to a new location, then you enter the directory and make
changes before saving.
In case 1, when you edit the file you are actually editing the original file because
oil has not yet moved/copied it to its new location. This means that the original
file will, perhaps unexpectedly, also be changed by any edits you make.
Case 2 is similar; when you edit the directory you are again actually editing the
original location of the directory. If you add new files, those files will be
created in both the original location and the copied directory.
When this option is `true`, Oil will prompt you to save before entering a file or
directory that is pending within oil, but does not exist on disk.
"""
)
return section
def get_highlights_vimdoc() -> "VimdocSection":
section = VimdocSection("Highlights", "oil-highlights", ["\n"])
highlights = read_nvim_json('require("oil")._get_highlights()')
@ -269,6 +306,7 @@ def generate_vimdoc():
doc.sections.extend(
[
get_options_vimdoc(),
get_options_detail_vimdoc(),
VimdocSection("API", "oil-api", render_vimdoc_api("oil", funcs)),
get_columns_vimdoc(),
get_actions_vimdoc(),