diff options
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 |
