From 8cc0d0f3e1b30ae59c2b6d4a297318865e07c883 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 28 Apr 2020 17:59:09 +0200 Subject: toggle spellchecking on thanks to @leorosa --- spellcheck.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'spellcheck.lua') diff --git a/spellcheck.lua b/spellcheck.lua index 21f4344..9f57c26 100644 --- a/spellcheck.lua +++ b/spellcheck.lua @@ -74,6 +74,19 @@ vis:map(vis.modes.NORMAL, "d", function(keys) return 0 end, "Disable spellchecking in the current window") +-- toggle spellchecking on +-- is used by some word processors (LibreOffice) for spellchecking +-- Thanks to @leorosa for the hint. +vis:map(vis.modes.NORMAL, "", function(keys) + if not spellcheck.enabled[vis.win] then + spellcheck.enabled[vis.win] = true + else + spellcheck.enabled[vis.win] = nil + vis.win:draw() + end + return 0 +end, "Toggle spellchecking in the current window") + vis:map(vis.modes.NORMAL, "w", function(keys) local win = vis.win local file = win.file -- cgit v1.2.3