Bundle curated community plugins (2.1.8-4)
Vendored from upstream, pinned by commit (see debian/extra/README.source): - gitstatus, gitopen, fontconfig, open_ext, select_colorscheme, smoothcaret, nerdicons (font mapping patched to DATADIR, Ships the Symbols Nerd Font Mono TTF, SIL OFL 1.1) - lite-xl-lsp (complete LSP client; idle until a language server is configured) plus the lite-xl-widgets library it requires - 104 language syntax plugins (none duplicate the nine bundled in core) settings GUI left out upstream is broken: it requires a libraries.widget.fonts widget that does not exist in lite-xl-widgets at any revision. Co-developed-with: ZCode (Z.ai)
This commit is contained in:
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
-- mod-version:3
|
||||
local core = require "core"
|
||||
local command = require "core.command"
|
||||
local common = require "core.common"
|
||||
local config = require "core.config"
|
||||
|
||||
local function exec(cmd)
|
||||
local proc = process.start(cmd)
|
||||
while proc:running() do
|
||||
coroutine.yield(0.1)
|
||||
end
|
||||
if proc:returncode() > 0 then
|
||||
core.error("ERROR - command: " .. table.concat(cmd, " "))
|
||||
end
|
||||
return proc:read_stdout() or ""
|
||||
end
|
||||
|
||||
local function git_find_files_and_open(commit)
|
||||
local git_root = exec({"git", "rev-parse", "--show-toplevel"}):match("^%s*(.-)%s*$")
|
||||
local file_list_str = exec({"git", "show", "--name-only", "--pretty=format:", commit})
|
||||
|
||||
for str in string.gmatch(file_list_str, "([^\n]+)") do
|
||||
-- Nomalize path as Git for Windows uses / as Unix based systems
|
||||
local filename = common.normalize_path(git_root .. PATHSEP .. str)
|
||||
|
||||
-- Only open files within the commit whose names do not match the configured ignore file patterns
|
||||
if not common.match_pattern(common.basename(filename), config.ignore_files) then
|
||||
core.root_view:open_doc(core.open_doc(filename))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- works in any context
|
||||
command.add(nil, {
|
||||
["gitopen:open-from-commit"] = function(dv)
|
||||
core.command_view:enter("Which commit? (default=HEAD)", {
|
||||
submit = function(commit)
|
||||
if commit == nil or commit == "" then
|
||||
commit = "HEAD"
|
||||
end
|
||||
-- open the files in the background, return immediately
|
||||
core.add_thread(
|
||||
function ()
|
||||
git_find_files_and_open(commit)
|
||||
end
|
||||
)
|
||||
end
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user