Warning
The project is new, does not have releases and is a Work in Progress. Therefore interfaces can change frequently
A minimal Neovim statusline written in Lua. Do we need another statusline? Probably not, do we have one? Yep
It started with doing my own statusline implementation. Reason for writing it was mainly just 4 fun and having exactly what I want, function and aesthetic wise.
Here are some screenshots. See recipes for config examples.
Available components:
mode
, well, you know what it ispath
, shows the filename and the relative path + modified / read-only infogit
, shows the git branch + file diff infos (added, modified and removed lines) (requires gitsigns)diagnostics
, showsvim.diagnostic
infosfiletype_lsp
, shows the filetype and attached LSPsprogress
, shows the file progress in % and the overall number of lines
Which components to show in which section (left
, right
, center
) can be configured.
Components can be configured more than once if desired.
The components configuration accepts function calls and strings so that you can hook custom content into the line.
See Custom components for an introduction.
Feel free to create an issue/PR if you want to see anything else implemented.
{
-- Calls `require('slimline').setup({})`
"sschleemilch/slimline.nvim",
opts = {}
},
Optional dependencies:
- gitsigns if you want the
git
component. Otherwise it will just not be shown - mini.icons if you want icons next to the filetype
You'll also need to have a patched nerd font if you want icons and separators.
require('slimline').setup {
bold = false, -- makes primary parts and mode bold
verbose_mode = false, -- Mode as single letter or as a word
style = 'bg', -- or "fg". Whether highlights should be applied to bg or fg of components
mode_follow_style = true, -- Whether the mode color components should follow the style option
components = { -- Choose components and their location
left = {
"mode",
"path",
"git"
},
center = {},
right = {
"diagnostics",
"filetype_lsp",
"progress"
}
},
spaces = {
components = ' ', -- string between components
left = ' ', -- string at the start of the line
right = ' ', -- string at the end of the line
},
sep = {
hide = {
first = false, -- hides the first separator
last = false, -- hides the last separator
},
left = '', -- left separator of components
right = '', -- right separator of components
},
hl = {
modes = {
normal = 'Type', -- highlight base of modes
insert = 'Function',
pending = 'Boolean',
visual = 'Keyword',
command = 'String',
},
base = 'Comment', -- highlight of everything in in between components
primary = 'Normal', -- highlight of primary parts (e.g. filename)
secondary = 'Comment', -- highlight of secondary parts (e.g. filepath)
},
icons = {
diagnostics = {
ERROR = ' ',
WARN = ' ',
HINT = ' ',
INFO = ' ',
},
git = {
branch = '',
},
folder = ' ',
lines = ' ',
},
}
Slimline creates highlight groups with the base highlights chosen in the hl
section of the config.
The default ones should be a safe choice to work well with most colorschemes but of course you can adapt
them to your liking. Depending on the chosen style
(fg or bg) the color will be used as a foreground
or as a background color.
Note
When using a transparent colorscheme and using style=bg
it means that the actual
background will be used as a foreground color for text. Since a transparent theme has
no background color, Slimline will fall back to #000000
for dark themes and to #ffffff
for white themes
A Slimline
command is available with the following sub commands:
switch
: Accepts only one parameter until now:style
. Will switch the style for the current session
opts = {
style = "fg"
}
opts = {
spaces = {
components = "",
left = "",
right = "",
},
sep = {
hide = {
first = true,
last = true,
},
left = "",
right = "",
},
}
opts = {
spaces = {
components = "─",
left = "─",
right = "─",
},
},
And adding fillchars stl
nvim setting:
vim.opt.fillchars = {
stl = "─",
}
The components
part of the config accepts function calls.
This opens the door extending Slimline with your own content.
Warning
This section uses internal APIs. Since I am not committing to stable internal APIs yet, it can change! Be carfeul when using it. The section will be updated accordingly when interfaces change though.
Let's create a center component using a function like this directly in the config:
center = {
function ()
return "Hello World"
end
},
It will render to something like this (depending on your colorscheme):
If you want to use internal render functionality of a component you can do it like that:
function ()
local h = require("slimline.highlights")
local c = require("slimline").config
return h.hl_component({primary = "Hello", secondary = "World"}, h.hls.component, c.sep)
end
It will now render to that (depending on the config)
Of course you can use Slimline*
highlight groups on your own to create your own styled component