summaryrefslogtreecommitdiff
path: root/dot_config/micro/init.lua
diff options
context:
space:
mode:
authorChloe Kudryavtsev <toast@toast.cafe>2021-07-07 17:39:55 -0400
committerChloe Kudryavtsev <toast@toast.cafe>2021-07-07 17:39:55 -0400
commit97bdcb51d04f302965c8e49a1d7173dddbf1cc31 (patch)
tree4e492f70a75a735d4a47c6585ac61ad6974e9c73 /dot_config/micro/init.lua
parentfish: exa: remove lr/lp, just set tree instead (diff)
micro: add textcount plugin, enable it for .md/.adoc
Diffstat (limited to 'dot_config/micro/init.lua')
-rw-r--r--dot_config/micro/init.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/dot_config/micro/init.lua b/dot_config/micro/init.lua
new file mode 100644
index 0000000..03238df
--- /dev/null
+++ b/dot_config/micro/init.lua
@@ -0,0 +1,21 @@
+local config = import 'micro/config'
+
+local function wantwords(ft)
+ return ft == 'markdown'
+ or ft == 'asciidoc'
+end
+
+local function appendsep(s, a)
+ if s ~= '' then s = s .. ' | ' end
+ return s .. a
+end
+
+function onBufferOpen(b)
+ if wantwords(b:FileType()) then
+ local format = config.GetGlobalOption 'statusformatr'
+ local add = '$(textcount.words) Words'
+ if not string.find(format, add) then
+ b:SetOption('statusformatr', appendsep(format, add))
+ end
+ end
+end