diff options
-rw-r--r-- | plugins/drawwhitespace.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/drawwhitespace.lua b/plugins/drawwhitespace.lua index 016d18c..a0eb77d 100644 --- a/plugins/drawwhitespace.lua +++ b/plugins/drawwhitespace.lua @@ -1,15 +1,18 @@ 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 tx, ty = x, y + self:get_line_text_y_offset() @@ -27,3 +30,8 @@ function DocView:draw_line_text(idx, x, y) end end +command.add("core.docview", { + ["drawwhitespace:toggle"] = function() config.draw_whitespace = not config.draw_whitespace end, + ["drawwhitespace:disable"] = function() config.draw_whitespace = false end, + ["drawwhitespace:enable"] = function() config.draw_whitespace = true end, +}) |