" autoload/latex_wordcount.vim function! latex_wordcount#GetWordCountSingle() abort lua << EOF local wc = require("latex_wordcount") local config = wc.default_config() local json_path = vim.g.json_path if json_path and json_path ~= "" then local ok, err = pcall(wc.load_config, config, vim.fn.expand(json_path)) if not ok then vim.notify(tostring(err), vim.log.levels.ERROR) return end end local count = wc.count_buffer(0, config, { follow_includes = false }) vim.notify(string.format("Real words (this file only): %d", count)) EOF endfunction function! latex_wordcount#GetWordCountMulti() abort lua << EOF local wc = require("latex_wordcount") local config = wc.default_config() local json_path = vim.g.json_path if json_path and json_path ~= "" then local ok, err = pcall(wc.load_config, config, vim.fn.expand(json_path)) if not ok then vim.notify(tostring(err), vim.log.levels.ERROR) return end end local count, _, _, warnings = wc.count_buffer(0, config, { follow_includes = true }) vim.notify(string.format("Real words (including \\input/\\include): %d", count)) if warnings and #warnings > 0 then vim.notify("include warnings:\n" .. table.concat(warnings, "\n"), vim.log.levels.WARN) end EOF endfunction