-- Lite XL default configuration (shipped via /etc/skel or the first-run -- template). This file is yours to edit; it is reloaded automatically on save. -- It gives the editor a VSCode-style dark look out of the box. local core = require "core" local common = require "core.common" local config = require "core.config" local style = require "core.style" ------------------------------ Appearance ------------------------------------- -- VSCode "Dark Modern" theme (shipped in /usr/share/lite-xl/colors). core.reload_module("colors.vscode_dark") -- Sharp text: grayscale antialiasing with light autohinting renders crisper -- than the defaults on high-DPI panels. local font_opts = { antialiasing = "grayscale", hinting = "slight", smoothing = true } -- Bump these for a bigger/smaller UI; ctrl+wheel also zooms live. local UI_FONT_SIZE = 15 local CODE_FONT_SIZE = 16 style.font = renderer.font.load(DATADIR .. "/fonts/FiraSans-Regular.ttf", UI_FONT_SIZE * SCALE, font_opts) style.big_font = style.font:copy(46 * SCALE) style.code_font = renderer.font.load( "/usr/share/fonts/truetype/jetbrains-mono/JetBrainsMono-Regular.ttf", CODE_FONT_SIZE * SCALE, font_opts) ------------------------------ Behavior --------------------------------------- config.line_height = 1.3 -- airy lines, like VSCode's default config.indent_size = 4 config.plugins.lineguide = true -- indent guides, like VSCode ------------------------------ Treeview sidebar ------------------------------- -- Tighter rows and VSCode-style hover/selection highlight. Method overrides so -- the shared style.padding used by the editor margins is untouched. local TreeView = require "plugins.treeview" local tv_row_pad = common.round(3 * SCALE) function TreeView:get_item_height() return style.font:get_height() + tv_row_pad end local tv_base_indent = common.round(8 * SCALE) local tv_level_indent = common.round(10 * SCALE) function TreeView:draw_item(item, active, hovered, x, y, w, h) self:draw_item_background(item, active, hovered, x, y, w, h) x = x + tv_base_indent + item.depth * tv_level_indent x = x + self:draw_item_chevron(item, active, hovered, x, y, w, h) self:draw_item_body(item, active, hovered, x, y, w, h) end function TreeView:get_item_text(item, active, hovered) local color = (active or hovered) and (style.treeview_text_active or style.accent) or (style.treeview_text or style.text) return item.name, style.font, color end function TreeView:draw_item_background(item, active, hovered, x, y, w, h) if hovered then local c = { table.unpack(style.treeview_hover_bg or style.line_highlight) } c[4] = 160 renderer.draw_rect(x, y, w, h, c) elseif active then renderer.draw_rect(x, y, w, h, style.treeview_active_bg or style.line_highlight) end end ------------------------------ Status bar ------------------------------------- -- Keep the status bar always visible: show it at startup and turn the -- status-bar:hide / status-bar:toggle commands into no-ops so it cannot -- be dismissed (from the command palette or by any plugin). core.status_view:show() local StatusView = require "core.statusview" function StatusView:toggle() self:show() end function StatusView:hide() self:show() end