vim.g.canola config system #16
Labels
No labels
autorelease: pending
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
upstream/digest
upstream/pr
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
barrettruth/canola.nvim#16
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
vim.g.canolais the canonical configuration mechanism for canola v1.1. It replacesrequire('canola').setup({})entirely — there is nosetup()call at all, and no compat shim. Configuration lives invim.g.canola, which Neovim evaluates before any plugin loads, making lazy-loading and session restore work without any extra configuration from the user.plugin/canola.luais the entry point. It readsvim.g.canolaat Neovim startup and calls the internal initializer. Users never callrequire('canola')for configuration — only for setter API functions (see below).Serializable config fields
All of the following accept the same types they did under
setup(). Strings, numbers, booleans, and tables of those are fully serializable and belong directly invim.g.canola.Top-level options
default_file_explorer(boolean, defaulttrue) — take over directory buffersdefault_to_float(boolean, defaultfalse) — always open in a floating windowcolumns(list of column specs, default{"icon"}) — see:help canola-columnsbuf_options(table) — buffer-local options; default setsbuflisted=false,bufhidden="hide"win_options(table) — window-local options; default setswrap=false,signcolumn="no",cursorcolumn=false,foldcolumn="0",spell=false,list=false,conceallevel=3,concealcursor="nvic"delete_to_trash(boolean, defaultfalse) — send deleted files to the trashcleanup_buffers_on_delete(boolean, defaultfalse) — wipe open buffers for deleted filesskip_confirm_for_simple_edits(boolean, defaultfalse) — skip confirmation for simple opsskip_confirm_for_delete(boolean, defaultfalse) — skip confirmation when all actions are deletesprompt_save_on_select_new_entry(boolean, defaulttrue) — prompt before navigating away with unsaved changesauto_save_on_select_new_entry(boolean, defaultfalse) — auto-save instead of promptingcleanup_delay_ms(integer, default2000) — ms before hidden oil buffers are wiped;falsedisablesconstrain_cursor("editable","name", orfalse, default"editable") — cursor confinementwatch_for_changes(boolean, defaultfalse) — reload oil when the filesystem changesuse_default_keymaps(boolean, defaulttrue) — whether the built-in keymaps are registerednew_file_mode(integer, default420= 0644) — permission mode for created filesnew_dir_mode(integer, default493= 0755) — permission mode for created directoriesextra_scp_args(list of strings) — extra args passed to SCPextra_s3_args(list of strings) — extra args passed toaws s3extra_curl_args(list of strings) — extra args passed tocurlfor FTPssh_hosts(table, keyed by hostname) — per-hostextra_scp_argsoverrides3_buckets(table, keyed by bucket name) — per-bucketextra_s3_argsoverrideftp_hosts(table, keyed by hostname) — per-hostextra_curl_argsoverridelsp_file_methodsenabled(boolean, defaulttrue)timeout_ms(integer, default1000)autosave_changes(boolean or"unmodified", defaultfalse)view_optionsshow_hidden(boolean, defaultfalse)show_hidden_when_empty(boolean, defaultfalse)natural_order(boolean or"fast", default"fast")case_insensitive(boolean, defaultfalse)sort(list of{column, "asc"|"desc"}pairs)keymapsEach entry is a string key mapped to either a string action name (
"actions.select") or a table{action, mode = "n", opts = {...}}. Callbacks are not permitted invim.g— see Setter API below for keymap callbacks.floatpadding(integer, default2)max_width(integer or float 0–1, default0)max_height(integer or float 0–1, default0)border(string or list)win_options(table)preview_split("auto","left","right","above","below", default"auto")preview_winupdate_on_cursor_moved(boolean, defaulttrue)preview_method("load","scratch", or"fast_scratch", default"fast_scratch")max_file_size(number in MB, default10)win_options(table)confirmationmax_width,min_width,width,max_height,min_height,height,border,win_optionsprogressmax_width,min_width,width,max_height,min_height,height,border,minimized_border,win_optionssshborderkeymaps_helpborderWhat is NOT in vim.g.canola
vim.gonly holds Lua-serializable values. Functions cannot be stored there. These config fields are function-valued and use the setter API instead:view_options.is_hidden_filerequire('canola').set_is_hidden_file(fn)view_options.is_always_hiddenrequire('canola').set_is_always_hidden(fn)view_options.highlight_filenamerequire('canola').set_highlight_filename(fn)preview_win.disable_previewrequire('canola').set_disable_preview(fn)Hook functions (
git.add,git.mv,git.rm,float.override,float.get_win_title) are replaced by User autocmds. The exact event names are tracked in #182.Entry point
plugin/canola.luaruns at startup. It readsvim.g.canola, merges it with defaults, and initializes the plugin. Norequire()call is needed from the user's config.lazy.nvim integration
Because
plugin/canola.luahandles initialization, lazy.nvim users set config via theinitkey, notopts:The
optskey is forsetup()— sincesetup()is gone,optsdoes nothing in canola v1.1.Related
setup()entirely (implementation issue)vim.g.canolatracking issuemove oil-ssh, oil-s3, oil-ftp, etc. into separate backends