diff --git a/.config/nvim/lua/plugins/camelcasemotion.lua b/.config/nvim/lua/plugins/camelcasemotion.lua new file mode 100644 index 00000000..cbccce94 --- /dev/null +++ b/.config/nvim/lua/plugins/camelcasemotion.lua @@ -0,0 +1 @@ +return { "chrisgrieser/nvim-spider", lazy = true } diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index f0c7f2c7..3c098aec 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua @@ -1,12 +1,3 @@ -local function getWords() - local wc = vim.api.nvim_eval("wordcount()") - local w = "w:" - if wc["visual_words"] then - return w .. wc["visual_words"] - else - return w .. wc["words"] - end -end local modes = { NORMAL = "NRM", INSERT = "INS", @@ -23,6 +14,24 @@ local modes = { REPLACE = "REP", ["V-REPLACE"] = "V-R", } + +local wordCountFiletypes = { + markdown = true, + txt = true, + tex = true, +} + +local wcCache = "" +local function updateWordCount() + local ft = vim.bo.filetype + local wc = vim.api.nvim_eval("wordcount()") + local w = "w:" + if wc["visual_words"] then + wcCache = w .. wc["visual_words"] + else + wcCache = w .. wc["words"] + end +end local sections = { lualine_a = { { @@ -32,10 +41,13 @@ local sections = { end, }, }, - -- lualine_a = { "mode" }, lualine_b = { "branch", "diff" }, lualine_c = { { "filename", path = 1 } }, - lualine_x = { "diagnostics", { "filetype", colored = false }, { getWords } }, + lualine_x = { "diagnostics", { "filetype", colored = false }, { + function() + return wcCache + end, + } }, lualine_y = { "progress" }, lualine_z = { "location" }, } @@ -48,6 +60,12 @@ return { local noirbuddy_lualine = require("noirbuddy.plugins.lualine") local theme = noirbuddy_lualine.theme local nb_inactive_sections = noirbuddy_lualine.inactive_sections + + vim.api.nvim_create_autocmd( + { "TextChanged", "TextChangedI", "CursorHold" }, + { pattern = "*", callback = updateWordCount } + ) + require("lualine").setup({ options = { theme = theme,