aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--plugins/centerdoc.lua1
-rw-r--r--plugins/closeconfirmx.lua54
-rw-r--r--plugins/colorpreview.lua1
-rw-r--r--plugins/copyfilelocation.lua8
-rw-r--r--plugins/datetimestamps.lua1
-rw-r--r--plugins/detectindent.lua64
-rw-r--r--plugins/dragdropselected.lua1
-rw-r--r--plugins/drawwhitespace.lua38
9 files changed, 11 insertions, 163 deletions
diff --git a/README.md b/README.md
index 66ab4a8..0859664 100644
--- a/README.md
+++ b/README.md
@@ -18,14 +18,14 @@ Plugin | Description
[`black`](https://git.sr.ht/~tmpod/black-lite)* | Integrates the [black](https://github.com/psf/black) Python formatter with lite
[`bracketmatch`](plugins/bracketmatch.lua?raw=1) | Underlines matching pair for bracket under the caret *([screenshot](https://user-images.githubusercontent.com/3920290/80132745-0c863f00-8594-11ea-8875-c455c6fd7eae.png))*
[`centerdoc`](plugins/centerdoc.lua?raw=1) | Centers document's content on the screen *([screenshot](https://user-images.githubusercontent.com/3920290/82127896-bf6e4500-97ae-11ea-97fc-ba9a552bc9a4.png))*
-[`closeconfirmx`](plugins/closeconfirmx.lua?raw=1) | Replaces a system close confirmation dialog with a command view, like for individual files *([screenshot](https://user-images.githubusercontent.com/1689801/107596774-afa76280-6c53-11eb-80ab-22e73058c097.png))*
+~~[`closeconfirmx`](plugins/closeconfirmx.lua?raw=1)~~ | Replaced by NagView dialog ~~Replaces a system close confirmation dialog with a command view, like for individual files *([screenshot](https://user-images.githubusercontent.com/1689801/107596774-afa76280-6c53-11eb-80ab-22e73058c097.png))*~~
[`colorpreview`](plugins/colorpreview.lua?raw=1) | Underlays color values (eg. `#ff00ff` or `rgb(255, 0, 255)`) with their resultant color. *([screenshot](https://user-images.githubusercontent.com/3920290/80743752-731bd780-8b15-11ea-97d3-847db927c5dc.png))*
*[`console`](https://github.com/franko/console)* | A console for running external commands and capturing their output *([gif](https://user-images.githubusercontent.com/3920290/81343656-49325a00-90ad-11ea-8647-ff39d8f1d730.gif))*
-[`copyfilelocation`](plugins/copyfilelocation.lua?raw=1) | Copy file location to clipboard
+*[`copyfilelocation`](plugins/copyfilelocation.lua?raw=1)* | Copy file location to clipboard
[`datetimestamps`](plugins/datetimestamps.lua?raw=1) | Insert date-, time- and date-time-stamps
~~[`detectindent`](plugins/detectindent.lua?raw=1)~~ | Included with lite-xl ~~Automatically detects and uses the indentation size and tab type of a loaded file~~
[`dragdropselected`](plugins/dragdropselected.lua?raw=1) | Provides basic drag and drop of selected text (in same document)
-*[`drawwhitespace`](plugins/drawwhitespace.lua?raw=1)* | Draws tabs and spaces *([screenshot](https://user-images.githubusercontent.com/3920290/80573013-22ae5800-89f7-11ea-9895-6362a1c0abc7.png))*
+~~*[`drawwhitespace`](plugins/drawwhitespace.lua?raw=1)*~~ | Integrated with lite-xl reducing CPU usage ~~Draws tabs and spaces *([screenshot](https://user-images.githubusercontent.com/3920290/80573013-22ae5800-89f7-11ea-9895-6362a1c0abc7.png))*~~
[`eofnewline`](https://github.com/bokunodev/lite_modules/blob/master/plugins/eofnewline.lua?raw=1) | Make sure the file ends with one blank line.
[`eval`](plugins/eval.lua?raw=1) | Replaces selected Lua code with its evaluated result
[`exec`](plugins/exec.lua?raw=1) | Runs selected text through shell command and replaces with result
diff --git a/plugins/centerdoc.lua b/plugins/centerdoc.lua
index 1921467..ee4bb2b 100644
--- a/plugins/centerdoc.lua
+++ b/plugins/centerdoc.lua
@@ -1,3 +1,4 @@
+-- lite-xl 1.16
local config = require "core.config"
local DocView = require "core.docview"
diff --git a/plugins/closeconfirmx.lua b/plugins/closeconfirmx.lua
deleted file mode 100644
index 805fe3b..0000000
--- a/plugins/closeconfirmx.lua
+++ /dev/null
@@ -1,54 +0,0 @@
--- CloseConfirmX plugin for lite text editor
--- implementation by chekoopa
-
-local core = require "core"
-local config = require "core.config"
-
-config.closeconfirmx_use_legacy = false
-config.closeconfirmx_use_short_name = true
-
-local legacy_confirm = core.confirm_close_all
-
-local function commandful_confirm()
- local dirty_count = 0
- local dirty_name
- for _, doc in ipairs(core.docs) do
- if doc:is_dirty() then
- dirty_count = dirty_count + 1
- dirty_name = doc:get_name()
- end
- end
- if dirty_count > 0 then
- local text
- if dirty_count == 1 then
- if config.closeconfirmx_use_short_name then
- dirty_name = dirty_name:match("[^/%\\]*$")
- end
- text = string.format("Unsaved changes in \"%s\"; Confirm Exit", dirty_name)
- else
- text = string.format("Unsaved changes in %d docs; Confirm Exit", dirty_count)
- end
- core.command_view:enter(text, function(_, item)
- if item.text:match("^[cC]") then
- core.quit(true)
- end
- end, function(text)
- local items = {}
- if not text:find("^[^sS]") then table.insert(items, "Stay here") end
- if not text:find("^[^cC]") then table.insert(items, "Close Without Saving") end
- return items
- end)
- -- as we delegate a choice inside the callback,
- return false
- end
- return true
-end
-
-function core.confirm_close_all()
- if config.closeconfirmx_use_legacy then
- return legacy_confirm()
- else
- return commandful_confirm()
- end
-end
-
diff --git a/plugins/colorpreview.lua b/plugins/colorpreview.lua
index dca419c..1289357 100644
--- a/plugins/colorpreview.lua
+++ b/plugins/colorpreview.lua
@@ -1,3 +1,4 @@
+-- lite-xl 1.16
local common = require "core.common"
local DocView = require "core.docview"
diff --git a/plugins/copyfilelocation.lua b/plugins/copyfilelocation.lua
index d365240..48520b8 100644
--- a/plugins/copyfilelocation.lua
+++ b/plugins/copyfilelocation.lua
@@ -1,3 +1,4 @@
+-- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local config = require "core.config"
@@ -6,12 +7,11 @@ local config = require "core.config"
command.add("core.docview", {
["copy-file-location:copy-file-location"] = function()
local doc = core.active_view.doc
- if not doc.filename then
+ if not doc.abs_filename then
core.error "Cannot copy location of unsaved doc"
return
end
- local filename = system.absolute_path(doc.filename)
- core.log("Copying to clipboard \"%s\"", filename)
- system.set_clipboard(filename)
+ core.log("Copying to clipboard \"%s\"", doc.abs_filename)
+ system.set_clipboard(doc.abs_filename)
end
})
diff --git a/plugins/datetimestamps.lua b/plugins/datetimestamps.lua
index 518f0a9..e1d7d3b 100644
--- a/plugins/datetimestamps.lua
+++ b/plugins/datetimestamps.lua
@@ -1,3 +1,4 @@
+-- lite-xl 1.16
local core = require "core"
local config = require "core.config"
local command = require "core.command"
diff --git a/plugins/detectindent.lua b/plugins/detectindent.lua
deleted file mode 100644
index 9c473b5..0000000
--- a/plugins/detectindent.lua
+++ /dev/null
@@ -1,64 +0,0 @@
-local core = require "core"
-local command = require "core.command"
-local config = require "core.config"
-local DocView = require "core.docview"
-local Doc = require "core.doc"
-
-local cache = setmetatable({}, { __mode = "k" })
-
-
-local function detect_indent(doc)
- for _, text in ipairs(doc.lines) do
- local str = text:match("^ +")
- if str then return "soft", #str end
- local str = text:match("^\t+")
- if str then return "hard" end
- end
-end
-
-
-local function update_cache(doc)
- local type, size = detect_indent(doc)
- if type then
- cache[doc] = { type = type, size = size }
- end
-end
-
-
-local new = Doc.new
-function Doc:new(...)
- new(self, ...)
- update_cache(self)
-end
-
-local clean = Doc.clean
-function Doc:clean(...)
- clean(self, ...)
- update_cache(self)
-end
-
-
-local function with_indent_override(doc, fn, ...)
- local c = cache[doc]
- if not c then
- return fn(...)
- end
- local type, size = config.tab_type, config.indent_size
- config.tab_type, config.indent_size = c.type, c.size or config.indent_size
- local r1, r2, r3 = fn(...)
- config.tab_type, config.indent_size = type, size
- return r1, r2, r3
-end
-
-
-local perform = command.perform
-function command.perform(...)
- return with_indent_override(core.active_view.doc, perform, ...)
-end
-
-
-local draw = DocView.draw
-function DocView:draw(...)
- return with_indent_override(self.doc, draw, self, ...)
-end
-
diff --git a/plugins/dragdropselected.lua b/plugins/dragdropselected.lua
index a2ce67f..5364fa4 100644
--- a/plugins/dragdropselected.lua
+++ b/plugins/dragdropselected.lua
@@ -1,3 +1,4 @@
+-- lite-xl 1.16
--[[
dragdropselected.lua
provides basic drag and drop of selected text (in same document)
diff --git a/plugins/drawwhitespace.lua b/plugins/drawwhitespace.lua
deleted file mode 100644
index 4e2e109..0000000
--- a/plugins/drawwhitespace.lua
+++ /dev/null
@@ -1,38 +0,0 @@
-local common = require "core.common"
-local config = require "core.config"
-local style = require "core.style"
-local DocView = require "core.docview"
-local command = require "core.command"
-
--- originally written by luveti
-
-config.whitespace_map = { [" "] = "·", ["\t"] = "»" }
-config.draw_whitespace = true
-
-local draw_line_text = DocView.draw_line_text
-
-function DocView:draw_line_text(idx, x, y)
- draw_line_text(self, idx, x, y)
- if not config.draw_whitespace then return end
-
- local text = self.doc.lines[idx]
- local font = self:get_font()
- local ss = font:subpixel_scale()
- local tx, ty = ss * x, y + self:get_line_text_y_offset()
- local color = style.whitespace or style.syntax.comment
- local map = config.whitespace_map
-
- for chr in common.utf8_chars(text) do
- local rep = map[chr]
- if rep then
- renderer.draw_text_subpixel(font, rep, tx, ty, color)
- end
- tx = tx + font:get_width_subpixel(chr)
- end
-end
-
-command.add("core.docview", {
- ["draw-whitespace:toggle"] = function() config.draw_whitespace = not config.draw_whitespace end,
- ["draw-whitespace:disable"] = function() config.draw_whitespace = false end,
- ["draw-whitespace:enable"] = function() config.draw_whitespace = true end,
-})