diff options
| author | 2021-07-07 17:39:55 -0400 | |
|---|---|---|
| committer | 2021-07-07 17:39:55 -0400 | |
| commit | 97bdcb51d04f302965c8e49a1d7173dddbf1cc31 (patch) | |
| tree | 4e492f70a75a735d4a47c6585ac61ad6974e9c73 /dot_config/micro/init.lua | |
| parent | fish: 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.lua | 21 |
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 |
