aboutsummaryrefslogtreecommitdiffstats
path: root/init.lua
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2020-02-27 00:14:45 +0100
committerMatěj Cepl <mcepl@cepl.eu>2020-02-27 00:14:45 +0100
commitdd2001c698c57c99fa471fc17575e7236a426548 (patch)
treee53a3c689e73e1c6804e90d44465ac8289f48c39 /init.lua
parent853221ace588fcf741d72db92f2c7668cf47d844 (diff)
downloadvis-par-dd2001c698c57c99fa471fc17575e7236a426548.tar.gz
The first attempt for init.lua
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..9c9cd38
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,13 @@
+require('vis')
+
+vis:operator_new("gq", function(file, range, pos)
+ local status, out, err = vis:pipe(file, range, "fmt -w 65")
+ if not status then
+ vis:info(err)
+ else
+ file:delete(range)
+ file:insert(range.start, out)
+ end
+ return range.start -- new cursor location
+end, "Formating operator, filter range through fmt(1)")
+