philss / staline.nvim

A modern lightweight statusline and bufferline for neovim in lua. Mainly uses unicode symbols for showing info.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

staline.nvim

TLDR;
staline(statusline): A simple statusline for neovim written in lua.
stabline(s-tabline): A simple bufferline for neovim written in lua. (sry didnt get a better name.)

Requirements

  • Requires neovim version 0.5.0+
  • vim.opt.laststatus=2 in your init.lua for statusline.
  • vim.opt.showtabline=2 in your init.lua for bufferline.

Installation

  • Vim-plug:
    Plug 'tamton-aquib/staline.nvim'
  • Packer
    use 'tamton-aquib/staline.nvim'

NOTE: Doing this will install both staline and stabline.
But separate setup() is required for each to load up.

Statusline

Screenshots

normal insert command visual

Configuration

require('staline').setup{}
Click to see default configuration
require('staline').setup {
	defaults = {
		left_separator  = "",
		right_separator = "",
		line_column     = "[%l/%L] :%c 並%p%% ", -- `:h stl` to see all flags.
		fg              = "#000000",  -- Foreground text color.
		bg              = "none",     -- Default background is transparent.
		cool_symbol     = "",       -- Change this to override defult OS icon.
		full_path       = false
		font_active     = "none",     -- "bold", "italic", "bold,italic", etc
		true_colors     = false       -- true lsp colors.
	},
	mode_colors = {
		n = "#2bbb4f",
		i = "#986fec",
		c = "#e27d60",
		v = "#4799eb",   -- etc..
	},
	mode_icons = {
		n = "",
		i = "",
		c = "",
		v = "",   -- etc..
	},
	sections = {
		left = { '- ', '-mode', 'left_sep_double', ' ', 'branch' },
		mid  = { 'file_name' },
		right = { 'cool_symbol','right_sep_double', '-line_column' }
	}
}

Sections:

section use
mode shows the mode
branch shows git branch
file_name shows filename
file_size shows file size
cool_symbol an icon according to the OS type (cutomizable)
lsp lsp diagnostics (number of errors, warnings, etc)
lsp_name lsp client name
line_column shows line, column, percentage, etc
left_sep single left separator
right_sep single right separator
left_sep_double Double left separator with a shade of gray
right_sep_double Double right separator with a shade of gray

lsp, lsp_name, file_size are not included in the default settings.

Check out wiki to see some premade configs and tips.

Bufferline

Screenshots

bar mode slant mode arrow mode bubble mode

  • Configuration
     require('stabline').setup{}
  • The Default configuration looks something like:
    require('stabline').setup {
        defaults = {
            style       = "bar", -- others: arrow, slant, bubble
            stab_left   = "",   -- 😬
            stab_right  = " ",
            fg          = Default is fg of "Normal".
            bg          = Default is bg of "Normal".
            inactive_bg = "#1e2127",
            inactive_fg = "#aaaaaa",
            stab_bg     = Default is darker version of bg.,
            font_active = "bold",
    		exclude_fts = {'NvimTree', 'dashboard', 'lir'}
        },
    }
My personal config as of editing this file:

my stabline config

require'stabline'.setup {
	style = "slant",
	bg = "#986fec",
	fg = "black",
	stab_right = ""
}

Features

  • Lightweight ( below 150 LOC each)
  • Fast. staline+stabline took < 1ms. (packers profiling)
  • Unicode current mode info. Needs a Nerd Font to be installed.
  • Shows current git branch if plenary is installed.
  • Uses nvim-web-devicons if installed, else uses a default table.

Cons

  • No mouse functions for stabline.
  • No ordering or sorting functions for stabline.
  • No lsp info in stabline.
  • No git related info on staline except branch name.

Inspirations:

TODO

  • Include more filetype support.
  • User configuration options. Needs more work.
  • Git info. Only branch info for now, (or ever)
  • Adding "opt-in" bufferline function.
  • Add config options for bufferline.
  • lsp client name in staline.
  • buf numbers in stabline.

About

A modern lightweight statusline and bufferline for neovim in lua. Mainly uses unicode symbols for showing info.

License:MIT License


Languages

Language:Lua 100.0%