nvim: add word count

This commit is contained in:
Marco Thomas
2022-08-01 23:47:24 +02:00
parent 7d23bbbb59
commit 23cfca2f10
2 changed files with 19 additions and 1 deletions

View File

@@ -72,6 +72,24 @@ return require('packer').startup(function(use)
},
lualine_c = { 'filename', require('nvim-navic').get_location },
lualine_x = { 'lsp_progress', 'encoding', 'fileformat', 'filetype' },
lualine_y = {
'progress',
function()
-- show wordcount in md and tex file
-- show precise count when selecting
if vim.bo.filetype == "md" or vim.bo.filetype == "tex" then
if vim.fn.wordcount().visual_words == 1 then
return tostring(vim.fn.wordcount().visual_words) .. " word"
elseif not (vim.fn.wordcount().visual_words == nil) then
return tostring(vim.fn.wordcount().visual_words) .. " words"
else
return tostring(vim.fn.wordcount().words) .. " words"
end
else
return ""
end
end
},
lualine_z = {
'location',
function()

View File

@@ -4,7 +4,7 @@ opt.colorcolumn = "80" -- Colored column at 80c
opt.cursorline = true -- Highlight entire current row
opt.number = true -- Show line numbers
opt.relativenumber = true -- Show relative line numbers from cursor
opt.scrolloff = 12 -- Minimum lines at top and bottom
opt.scrolloff = 5 -- Minimum lines at top and bottom
opt.signcolumn = "yes" -- Show icons column at on the left side
opt.swapfile = false -- Do not create a swapfile
opt.smartindent = true -- Autoindent new lines