-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlualine.lua
More file actions
56 lines (49 loc) · 1.67 KB
/
lualine.lua
File metadata and controls
56 lines (49 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
-- Lualine word count extension
-- Shows word count in the status line for text files
return {
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
local function is_textfile()
local filetype = vim.bo.filetype
return filetype == "markdown"
or filetype == "asciidoc"
or filetype == "pandoc"
or filetype == "tex"
or filetype == "text"
end
local function wordcount()
local wc = vim.fn.wordcount()
local visual_words = wc.visual_words or wc.words
local word_string = visual_words == 1 and " word" or " words"
return tostring(visual_words) .. word_string
end
table.insert(opts.sections.lualine_z, { wordcount, cond = is_textfile })
-- Agent review comment count
local ok_ar, agent_review = pcall(require, "agent-review")
if ok_ar then
table.insert(opts.sections.lualine_x, 1, agent_review.lualine())
end
-- Obsidian sync status
table.insert(opts.sections.lualine_x, 1, {
require("obsidian.sync.status").icon,
color = require("obsidian.sync.status").color,
cond = require("obsidian.sync.status").cond,
})
-- Native diagnostic status
table.insert(opts.sections.lualine_x, 1, {
function()
return vim.diagnostic.status() or ""
end,
})
-- Native LSP progress status
table.insert(opts.sections.lualine_x, 1, {
function()
return vim.ui.progress_status() or ""
end,
})
-- Update the pretty_path component to not truncate filenames
-- Replace the existing pretty_path component in lualine_c
opts.sections.lualine_c[4] = { LazyVim.lualine.pretty_path({ length = 0 }) }
end,
}