diff --git a/init.lua b/init.lua index 033f33d..3e59a7d 100644 --- a/init.lua +++ b/init.lua @@ -62,6 +62,9 @@ require('complete') -- [[ Configure neorg ]] require('neorg-configure') +-- [[ Configure status line ]] +require('statusline') + -- Customizations require('restore-position') require('autocommands') diff --git a/lua/plugins-configure.lua b/lua/plugins-configure.lua index 5d0190e..762149e 100644 --- a/lua/plugins-configure.lua +++ b/lua/plugins-configure.lua @@ -161,58 +161,8 @@ require('lazy').setup({ end, }, - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = true, - theme = 'rose-pine', - component_separators = '|', - section_separators = '', - }, - sections = { - lualine_c = { - { - 'filename', - path = 1, - } - }, - lualine_y = { - { - -- Character, word and line counts - -- https://www.reddit.com/r/neovim/comments/1130kh5/comment/j8navg6/ - function() - local isVisualMode = vim.fn.mode():find("[Vv]") - if not isVisualMode then return "" end - local starts = vim.fn.line("v") - local ends = vim.fn.line(".") - local lines = starts <= ends and ends - starts + 1 or starts - ends + 1 - local wordcount = vim.fn.wordcount() - return tostring(wordcount.visual_words) .. - "W " .. tostring(wordcount.visual_chars) .. "C " .. tostring(lines) .. "L" - end - }, - 'progress' - } - }, - inactive_sections = { - lualine_c = { - { - 'filename', - path = 1, - } - }, - }, - symbols = { - error = " ", - warn = " ", - info = " ", - hint = " ", - } - }, - }, + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', { -- Add indentation guides even on blank lines diff --git a/lua/statusline.lua b/lua/statusline.lua new file mode 100644 index 0000000..1eb661a --- /dev/null +++ b/lua/statusline.lua @@ -0,0 +1,48 @@ +-- Character, word and line counts +-- https://www.reddit.com/r/neovim/comments/1130kh5/comment/j8navg6/ +local function counters() + local isVisualMode = vim.fn.mode():find("[Vv]") + if not isVisualMode then return "" end + local starts = vim.fn.line("v") + local ends = vim.fn.line(".") + local lines = starts <= ends and ends - starts + 1 or starts - ends + 1 + local wordcount = vim.fn.wordcount() + return tostring(wordcount.visual_words) .. + "W " .. tostring(wordcount.visual_chars) .. "C " .. tostring(lines) .. "L" +end + +-- See `:help lualine.txt` +require('lualine').setup({ + options = { + icons_enabled = true, + theme = 'rose-pine', + component_separators = '|', + section_separators = '', + }, + sections = { + lualine_c = { + { + 'filename', + path = 1, + } + }, + lualine_y = { + { counters }, + 'progress' + } + }, + inactive_sections = { + lualine_c = { + { + 'filename', + path = 1, + } + }, + }, + symbols = { + error = " ", + warn = " ", + info = " ", + hint = " ", + } +})