aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-04-28 17:59:09 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-04-28 17:59:09 +0200
commit8cc0d0f3e1b30ae59c2b6d4a297318865e07c883 (patch)
tree0695fc8b3dbd5f7590b673324bcf7ed2e9062efc
parentfb4e9cc708b48e9b169138a3d64abf1cbe8882d2 (diff)
downloadvis-spellcheck-8cc0d0f3e1b30ae59c2b6d4a297318865e07c883.tar.gz
vis-spellcheck-8cc0d0f3e1b30ae59c2b6d4a297318865e07c883.zip
toggle spellchecking on <F7> thanks to @leorosa
-rw-r--r--spellcheck.lua13
1 files changed, 13 insertions, 0 deletions
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, "<C-w>d", function(keys)
return 0
end, "Disable spellchecking in the current window")
+-- toggle spellchecking on <F7>
+-- <F7> is used by some word processors (LibreOffice) for spellchecking
+-- Thanks to @leorosa for the hint.
+vis:map(vis.modes.NORMAL, "<F7>", 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, "<C-w>w", function(keys)
local win = vis.win
local file = win.file