2023-02-06 18:32:44 +01:00
|
|
|
local common = require "core.common"
|
|
|
|
|
2019-12-28 12:16:32 +01:00
|
|
|
local config = {}
|
|
|
|
|
2023-08-26 17:32:39 +02:00
|
|
|
---The frame rate of Lite XL.
|
|
|
|
---Note that setting this value to the screen's refresh rate
|
|
|
|
---does not eliminate screen tearing.
|
|
|
|
---
|
|
|
|
---Defaults to 60.
|
|
|
|
---@type number
|
2019-12-28 12:16:32 +01:00
|
|
|
config.fps = 60
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Maximum number of log items that will be stored.
|
|
|
|
---When the number of log items exceed this value, old items will be discarded.
|
|
|
|
---
|
|
|
|
---Defaults to 800.
|
|
|
|
---@type number
|
2022-07-01 05:27:18 +02:00
|
|
|
config.max_log_items = 800
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The timeout, in seconds, before a message dissapears from StatusView.
|
|
|
|
---
|
|
|
|
---Defaults to 5.
|
|
|
|
---@type number
|
2021-05-27 08:28:58 +02:00
|
|
|
config.message_timeout = 5
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The number of pixels scrolled per-step.
|
|
|
|
---
|
|
|
|
---Defaults to 50 * SCALE.
|
|
|
|
---@type number
|
2020-05-16 10:46:31 +02:00
|
|
|
config.mouse_wheel_scroll = 50 * SCALE
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Enables/disables transitions when scrolling with the scrollbar.
|
|
|
|
---When enabled, the scrollbar will have inertia and slowly move towards the cursor.
|
|
|
|
---Otherwise, the scrollbar will immediately follow the cursor.
|
|
|
|
---
|
|
|
|
---Defaults to false.
|
|
|
|
---@type boolean
|
2022-04-26 15:54:11 +02:00
|
|
|
config.animate_drag_scroll = false
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Enables/disables scrolling past the end of a document.
|
|
|
|
---
|
|
|
|
---Defaults to true.
|
|
|
|
---@type boolean
|
2021-09-30 22:10:38 +02:00
|
|
|
config.scroll_past_end = true
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---@alias config.scrollbartype
|
|
|
|
---| "expanded" # A thicker scrollbar is shown at all times.
|
|
|
|
---| "contracted" # A thinner scrollbar is shown at all times.
|
|
|
|
---| false # The scrollbar expands when the cursor hovers over it.
|
|
|
|
|
|
|
|
---Controls whether the DocView scrollbar is always shown or hidden.
|
|
|
|
---This option does not affect other View's scrollbars.
|
|
|
|
---
|
|
|
|
---Defaults to false.
|
|
|
|
---@type config.scrollbartype
|
2022-11-01 23:38:50 +01:00
|
|
|
config.force_scrollbar_status = false
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The file size limit, in megabytes.
|
|
|
|
---Files larger than this size will not be shown in the file picker.
|
|
|
|
---
|
|
|
|
---Defaults to 10.
|
|
|
|
---@type number
|
2019-12-28 12:16:32 +01:00
|
|
|
config.file_size_limit = 10
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---A list of files and directories to ignore.
|
|
|
|
---Each element is a Lua pattern, where patterns ending with a forward slash
|
|
|
|
---are recognized as directories while patterns ending with an anchor ("$") are
|
|
|
|
---recognized as files.
|
|
|
|
---@type string[]
|
2022-10-20 04:23:01 +02:00
|
|
|
config.ignore_files = {
|
|
|
|
-- folders
|
|
|
|
"^%.svn/", "^%.git/", "^%.hg/", "^CVS/", "^%.Trash/", "^%.Trash%-.*/",
|
|
|
|
"^node_modules/", "^%.cache/", "^__pycache__/",
|
|
|
|
-- files
|
|
|
|
"%.pyc$", "%.pyo$", "%.exe$", "%.dll$", "%.obj$", "%.o$",
|
|
|
|
"%.a$", "%.lib$", "%.so$", "%.dylib$", "%.ncb$", "%.sdf$",
|
|
|
|
"%.suo$", "%.pdb$", "%.idb$", "%.class$", "%.psd$", "%.db$",
|
|
|
|
"^desktop%.ini$", "^%.DS_Store$", "^%.directory$",
|
|
|
|
}
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Lua pattern used to find symbols when advanced syntax highlighting
|
|
|
|
---is not available.
|
|
|
|
---This pattern is also used for navigation, e.g. move to next word.
|
|
|
|
---
|
|
|
|
---The default pattern matches all letters, followed by any number
|
|
|
|
---of letters and digits.
|
|
|
|
---@type string
|
2019-12-28 12:16:32 +01:00
|
|
|
config.symbol_pattern = "[%a_][%w_]*"
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---A list of characters that delimits a word.
|
|
|
|
---
|
|
|
|
---The default is ``" \t\n/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-"``
|
|
|
|
---@type string
|
2019-12-28 12:16:32 +01:00
|
|
|
config.non_word_chars = " \t\n/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-"
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The timeout, in seconds, before several consecutive actions
|
|
|
|
---are merged as a single undo step.
|
|
|
|
---
|
|
|
|
---The default is 0.3 seconds.
|
|
|
|
---@type number
|
2019-12-28 12:16:32 +01:00
|
|
|
config.undo_merge_timeout = 0.3
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The maximum number of undo steps per-document.
|
|
|
|
---
|
|
|
|
---The default is 10000.
|
|
|
|
---@type number
|
2019-12-28 12:16:32 +01:00
|
|
|
config.max_undos = 10000
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The maximum number of tabs shown at a time.
|
|
|
|
---
|
|
|
|
---The default is 8.
|
|
|
|
---@type number
|
2021-10-02 18:44:05 +02:00
|
|
|
config.max_tabs = 8
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Shows/hides the tab bar when there is only one tab open.
|
|
|
|
---
|
|
|
|
---The tab bar is always shown by default.
|
|
|
|
---@type boolean
|
2021-10-02 18:44:05 +02:00
|
|
|
config.always_show_tabs = true
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---@alias config.highlightlinetype
|
|
|
|
---| true # Always highlight the current line.
|
|
|
|
---| false # Never highlight the current line.
|
|
|
|
---| "no_selection" # Highlight the current line if no text is selected.
|
|
|
|
|
|
|
|
---Highlights the current line.
|
|
|
|
---
|
|
|
|
---The default is true.
|
|
|
|
---@type config.highlightlinetype
|
2019-12-28 12:16:32 +01:00
|
|
|
config.highlight_current_line = true
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The spacing between each line of text.
|
|
|
|
---
|
|
|
|
---The default is 120% of the height of the text (1.2).
|
|
|
|
---@type number
|
2019-12-28 12:16:32 +01:00
|
|
|
config.line_height = 1.2
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The number of spaces each level of indentation represents.
|
|
|
|
---
|
|
|
|
---The default is 2.
|
|
|
|
---@type number
|
2019-12-28 12:16:32 +01:00
|
|
|
config.indent_size = 2
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The type of indentation.
|
|
|
|
---
|
|
|
|
---The default is "soft" (spaces).
|
|
|
|
---@type "soft" | "hard"
|
2019-12-28 12:16:32 +01:00
|
|
|
config.tab_type = "soft"
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Do not remove whitespaces when advancing to the next line.
|
|
|
|
---
|
|
|
|
---Defaults to false.
|
|
|
|
---@type boolean
|
2022-11-03 17:40:27 +01:00
|
|
|
config.keep_newline_whitespace = false
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Maximum number of characters per-line for the line guide.
|
|
|
|
---
|
|
|
|
---Defaults to 80.
|
|
|
|
---@type number
|
2019-12-28 12:16:32 +01:00
|
|
|
config.line_limit = 80
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Maximum number of project files to keep track of.
|
|
|
|
---If the number of files in the project exceeds this number,
|
|
|
|
---Lite XL will not be able to keep track of them.
|
|
|
|
---They will be not be searched when searching for files or text.
|
|
|
|
---
|
|
|
|
---Defaults to 2000.
|
|
|
|
---@type number
|
2020-11-16 14:45:45 +01:00
|
|
|
config.max_project_files = 2000
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Enables/disables all transitions.
|
|
|
|
---
|
|
|
|
---Defaults to true.
|
|
|
|
---@type boolean
|
2021-02-21 11:08:25 +01:00
|
|
|
config.transitions = true
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Enable/disable individual transitions.
|
|
|
|
---These values are overriden by `config.transitions`.
|
2022-04-26 02:35:35 +02:00
|
|
|
config.disabled_transitions = {
|
2023-08-26 17:32:39 +02:00
|
|
|
---Disables scrolling transitions.
|
2022-04-26 02:35:35 +02:00
|
|
|
scroll = false,
|
2023-08-26 17:32:39 +02:00
|
|
|
---Disables transitions for CommandView's suggestions list.
|
2022-04-26 02:35:35 +02:00
|
|
|
commandview = false,
|
2023-08-26 17:32:39 +02:00
|
|
|
---Disables transitions for showing/hiding the context menu.
|
2022-04-26 02:35:35 +02:00
|
|
|
contextmenu = false,
|
2023-08-26 17:32:39 +02:00
|
|
|
---Disables transitions when clicking on log items in LogView.
|
2022-04-26 02:35:35 +02:00
|
|
|
logview = false,
|
2023-08-26 17:32:39 +02:00
|
|
|
---Disables transitions for showing/hiding the Nagbar.
|
2022-04-26 02:35:35 +02:00
|
|
|
nagbar = false,
|
2023-08-26 17:32:39 +02:00
|
|
|
---Disables transitions when scrolling the tab bar.
|
2022-04-26 02:35:35 +02:00
|
|
|
tabs = false,
|
2023-08-26 17:32:39 +02:00
|
|
|
---Disables transitions when a tab is being dragged.
|
2022-04-26 02:35:35 +02:00
|
|
|
tab_drag = false,
|
2023-08-26 17:32:39 +02:00
|
|
|
---Disables transitions when a notification is shown.
|
2022-04-26 02:35:35 +02:00
|
|
|
statusbar = false,
|
|
|
|
}
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The rate of all transitions.
|
|
|
|
---
|
|
|
|
---Defaults to 1.
|
|
|
|
---@type number
|
2021-03-10 16:35:37 +01:00
|
|
|
config.animation_rate = 1.0
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---The caret's blinking period, in seconds.
|
|
|
|
---
|
|
|
|
---Defaults to 0.8.
|
|
|
|
---@type number
|
2021-03-06 11:03:12 +01:00
|
|
|
config.blink_period = 0.8
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Disables caret blinking.
|
|
|
|
---
|
|
|
|
---Defaults to false.
|
|
|
|
---@type boolean
|
2021-10-02 16:38:10 +02:00
|
|
|
config.disable_blink = false
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Draws whitespaces as dots.
|
|
|
|
---This option is deprecated.
|
|
|
|
---Please use the drawwhitespace plugin instead.
|
|
|
|
---@deprecated
|
2021-03-31 17:33:35 +02:00
|
|
|
config.draw_whitespace = false
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Disables system-drawn window borders.
|
|
|
|
---
|
|
|
|
---When set to true, Lite XL draws its own window decorations,
|
|
|
|
---which can be useful for certain setups.
|
|
|
|
---
|
|
|
|
---Defaults to false.
|
|
|
|
---@type boolean
|
2021-04-21 09:05:15 +02:00
|
|
|
config.borderless = false
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Shows/hides the close buttons on tabs.
|
|
|
|
---When hidden, users can close tabs via keyboard shortcuts or commands.
|
|
|
|
---
|
|
|
|
---Defaults to true.
|
|
|
|
---@type boolean
|
2021-06-18 03:35:36 +02:00
|
|
|
config.tab_close_button = true
|
2023-08-26 17:32:39 +02:00
|
|
|
|
|
|
|
---Maximum number of clicks recognized by Lite XL.
|
|
|
|
---
|
|
|
|
---Defaults to 3.
|
|
|
|
---@type number
|
2021-11-14 21:44:54 +01:00
|
|
|
config.max_clicks = 3
|
2019-12-28 12:16:32 +01:00
|
|
|
|
2023-08-26 17:32:39 +02:00
|
|
|
---Disables plugin version checking.
|
|
|
|
---Do not change this unless you know what you are doing.
|
|
|
|
---
|
|
|
|
---Defaults to false.
|
|
|
|
---@type boolean
|
2022-03-11 03:29:33 +01:00
|
|
|
config.skip_plugins_version = false
|
|
|
|
|
2023-02-06 18:32:44 +01:00
|
|
|
-- holds the plugins real config table
|
|
|
|
local plugins_config = {}
|
|
|
|
|
2023-08-26 17:32:39 +02:00
|
|
|
---A table containing configuration for all the plugins.
|
|
|
|
---
|
|
|
|
---This is a metatable that automaticaly creates a minimal
|
|
|
|
---configuration when a plugin is initially configured.
|
|
|
|
---Each plugins will then call `common.merge()` to get the finalized
|
|
|
|
---plugin config.
|
|
|
|
---Do not use raw operations on this table.
|
|
|
|
---@type table
|
2021-07-13 16:14:00 +02:00
|
|
|
config.plugins = {}
|
2023-02-06 18:32:44 +01:00
|
|
|
|
|
|
|
-- allows virtual access to the plugins config table
|
2022-01-28 22:30:19 +01:00
|
|
|
setmetatable(config.plugins, {
|
2023-02-06 18:32:44 +01:00
|
|
|
__index = function(_, k)
|
|
|
|
if not plugins_config[k] then
|
|
|
|
plugins_config[k] = { enabled = true, config = {} }
|
|
|
|
end
|
|
|
|
if plugins_config[k].enabled ~= false then
|
|
|
|
return plugins_config[k].config
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end,
|
|
|
|
__newindex = function(_, k, v)
|
|
|
|
if not plugins_config[k] then
|
|
|
|
plugins_config[k] = { enabled = nil, config = {} }
|
|
|
|
end
|
|
|
|
if v == false and package.loaded["plugins."..k] then
|
|
|
|
local core = require "core"
|
|
|
|
core.warn("[%s] is already enabled, restart the editor for the change to take effect", k)
|
|
|
|
return
|
|
|
|
elseif plugins_config[k].enabled == false and v ~= false then
|
|
|
|
plugins_config[k].enabled = true
|
|
|
|
end
|
|
|
|
if v == false then
|
|
|
|
plugins_config[k].enabled = false
|
|
|
|
elseif type(v) == "table" then
|
|
|
|
plugins_config[k].enabled = true
|
|
|
|
plugins_config[k].config = common.merge(plugins_config[k].config, v)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
__pairs = function()
|
|
|
|
return coroutine.wrap(function()
|
|
|
|
for name, status in pairs(plugins_config) do
|
|
|
|
coroutine.yield(name, status.config)
|
|
|
|
end
|
|
|
|
end)
|
2022-01-28 22:30:19 +01:00
|
|
|
end
|
2021-12-06 00:32:20 +01:00
|
|
|
})
|
2021-07-13 16:14:00 +02:00
|
|
|
|
2021-01-13 14:50:24 +01:00
|
|
|
|
2019-12-28 12:16:32 +01:00
|
|
|
return config
|