refactor(lualine): move lualine config to a new file
- Add a function for the word counter
This commit is contained in:
parent
e934e38bd0
commit
aa829327b5
3
init.lua
3
init.lua
@ -62,6 +62,9 @@ require('complete')
|
|||||||
-- [[ Configure neorg ]]
|
-- [[ Configure neorg ]]
|
||||||
require('neorg-configure')
|
require('neorg-configure')
|
||||||
|
|
||||||
|
-- [[ Configure status line ]]
|
||||||
|
require('statusline')
|
||||||
|
|
||||||
-- Customizations
|
-- Customizations
|
||||||
require('restore-position')
|
require('restore-position')
|
||||||
require('autocommands')
|
require('autocommands')
|
||||||
|
@ -161,58 +161,8 @@ require('lazy').setup({
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
-- Set lualine as statusline
|
||||||
-- Set lualine as statusline
|
'nvim-lualine/lualine.nvim',
|
||||||
'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 = " ",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
-- Add indentation guides even on blank lines
|
-- Add indentation guides even on blank lines
|
||||||
|
48
lua/statusline.lua
Normal file
48
lua/statusline.lua
Normal file
@ -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 = " ",
|
||||||
|
}
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user