aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2020-09-23 21:18:06 +0200
committerMatěj Cepl <mcepl@cepl.eu>2020-09-23 21:18:06 +0200
commit82a800062d424d2eb47a565463a7ef37f63482ae (patch)
treede1d76de7129ba140fbd502bd0c0e48ea9cc255b
parent473e2ce3c752d375dcff71e5d93da04986c089a5 (diff)
downloadvis-par-82a800062d424d2eb47a565463a7ef37f63482ae.tar.gz
Add option 'autoformat'.
-rw-r--r--init.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index 8d5582b..e2599c7 100644
--- a/init.lua
+++ b/init.lua
@@ -14,3 +14,9 @@ vis:operator_new("gq", function(file, range, pos)
return range.start -- new cursor location
end, "Formating operator, filter range through fmt(1)")
+vis:option_register("autoformat", "bool", function(value, toogle)
+ if not vis.win then return false end
+ vis.win.autoformat = toogle and not vis.win.autoformat or value
+ vis:info("Option autoformat = " .. tostring(vis.win.autoformat))
+ return true
+end, "Automatically format current paragraph.")