aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/init.lua b/init.lua
index 4f23eac..793a9d3 100644
--- a/init.lua
+++ b/init.lua
@@ -1,11 +1,13 @@
require("vis")
-par_prg = "par"
-par_tw = 65
-ex_args = "RET4bhgqw" .. par_tw
+
+local M = {}
+
+M.par_prg = "par"
+M.par_tw = 72
+M.ex_args = function () return "RET4bhgqw" .. M.par_tw end
-- ex_args = "RET4bhgqB=.,?_A_aQ=_s>|w" .. par_tw
-- export PARINIT='Tbp2hgqR B=.,?_A_a Q=_s>|'
-
function print(...)
_print_ = _print_ or io.open("/tmp/visprint", "w")
_print_:write(..., "\n")
@@ -126,7 +128,7 @@ end
function new_segment(segment, p_arg)
if next(segment) then
- local new_text = run_shell_cmd(par_prg, ex_args .. p_arg,
+ local new_text = run_shell_cmd(M.par_prg, M.ex_args() .. p_arg,
table.concat(segment, "\n"))
print("new_text = " .. new_text)
return new_text, {}, 0 -- add-to-out, segment, p_arg
@@ -166,7 +168,7 @@ vis:operator_new(
-- continuous line in a segment, just collect it
table.insert(segment, line)
end
- else -- this is an empty line, so do whole circus FIXME
+ else -- this is an empty line
seg_pared, segment, p_arg = new_segment(segment, p_arg)
if seg_pared then
out = out .. seg_pared
@@ -198,3 +200,5 @@ vis:option_register(
end,
"Automatically format current paragraph."
)
+
+return M