Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/tamton-aquib/staline.nvim

A modern lightweight statusline and bufferline plugin for neovim in lua.
https://github.com/tamton-aquib/staline.nvim

bufferline lua neovim neovim-plugin statusline

Last synced: about 2 months ago
JSON representation

A modern lightweight statusline and bufferline plugin for neovim in lua.

Lists

README

        

# staline.nvim
TLDR;
staline(**sta**tus**line**): 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.7
* `vim.opt.laststatus=2` in your init.lua for statusline. (or `3` for global line)
* `vim.opt.showtabline=2` in your init.lua for bufferline.
* `vim.opt.termguicolors = true` must be set.

### Installation
```lua
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](https://i.imgur.com/LFmEROF.png)
![insert](https://i.imgur.com/rzqMwXU.png)
![command](https://i.imgur.com/jDuOdpK.png)
![visual](https://i.imgur.com/dO1pKaj.png)

#### Configuration
```lua
require('staline').setup()
```
>
> Click to see default configuration
>
> ```lua
> require('staline').setup {
> defaults = {
> expand_null_ls = false, -- This expands out all the null-ls sources to be shown
> left_separator = "",
> right_separator = "",
> full_path = false,
> line_column = "[%l/%L] :%c 並%p%% ", -- `:h stl` to see all flags.
>
> fg = "#000000", -- Foreground text color.
> bg = "none", -- Default background is transparent.
> inactive_color = "#303030",
> inactive_bgcolor = "none",
> true_colors = false, -- true lsp colors.
> font_active = "none", -- "bold", "italic", "bold,italic", etc
>
> mod_symbol = "  ",
> lsp_client_symbol = " ",
> lsp_client_character_length = 12, -- Shorten LSP client names.
> branch_symbol = " ",
> cool_symbol = " ", -- Change this to override default OS icon.
> null_ls_symbol = "", -- A symbol to indicate that a source is coming from null-ls
> },
> 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' },
> },
> inactive_sections = {
> left = { 'branch' },
> mid = { 'file_name' },
> right = { 'line_column' }
> },
> special_table = {
> NvimTree = { 'NvimTree', ' ' },
> packer = { 'Packer',' ' }, -- etc
> },
> lsp_symbols = {
> Error=" ",
> Info=" ",
> Warn=" ",
> Hint="",
> },
> }
> ```
>

> 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 |
> | cwd | Current working directory |
>

To know more about colors and highlights, check [highlights wiki](https://github.com/tamton-aquib/staline.nvim/wiki/Highlights)

__A section (left, right or mid) can take:__
* Already defnined section or a simple string:
* `"branch"`
* `"a simple string"`
* An array of { highlight, string }
* `{ "DiagnosticsError", "danger_icon" }`
* `{ "CustomHighlight", "simple_string" }`
* A function for dynamic content
```lua
function()
return "computed_dynamic_string"
end
```

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

#### Showcase

* Evil Line
![evil_line](https://i.imgur.com/q64sLaw.png)

* Pebble Line
![pebble_line](https://i.imgur.com/iieuF1h.png)

* Simple Line
![simple_line](https://i.imgur.com/o3OAdLi.png)

Check out [wiki](https://github.com/tamton-aquib/staline.nvim/wiki) to see some premade configs and tips.

# Bufferline

### Screenshots
![bar mode](https://i.imgur.com/stkcUAu.png)

![slant mode](https://i.imgur.com/UVS9ii5.png)

![arrow mode](https://i.imgur.com/ERDzicw.png)

![bubble mode](https://i.imgur.com/UjbeyjR.png)

* Configuration
```lua
require('stabline').setup()
```

> The Default configuration looks something like
>
> ```lua
> require('stabline').setup {
> 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' },
> stab_start = "", -- The starting of stabline
> stab_end = "",
> numbers = function(bufn, n)
> return '*'..n..' '
> end
> }
> ```
>

> My personal config as of editing this file
>
> ![my stabline config](https://i.imgur.com/cmBdfzx.png)
>
> ```lua
> require('stabline').setup {
> style = "slant",
> bg = "#986fec",
> fg = "black",
> stab_right = "",
> }
> ```
>
>

### Features
* Lightweight and Fast. staline+stabline took **< 1ms**. (packers profiling)
* Unicode current mode info. Needs a Nerd Font to be installed.
* Has few builtin sections to chose from.
* Mouse buffer selection on stabline.
* Uses [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons) if installed, else uses a default table.

#### Cons
* No ordering or sorting functions for stabline.
* No lsp info in stabline.
* No git related info on staline except branch name.

---

#### Inspiration and credits:
* [This](https://www.reddit.com/r/vim/comments/ld8h2j/i_made_a_status_line_from_scratch_no_plugins_used/) reddit post for staline.
* [akinsho/nvim-bufferline](https://github.com/akinsho/nvim-bufferline.lua) for stabline.
* [vhyrro](https://github.com/vhyrro) for helping out.

### TODO

- [x] ~User configuration options. Needs more work.~
- [x] ~Git info. Only branch info for now, *(or ever)*~
- [x] ~Adding "opt-in" bufferline function.~
- [x] ~Add config options for bufferline.~
- [x] ~lsp client name in staline.~
- [x] buf numbers in stabline.
- [x] ~transparency problem when changed to 0.7 api.~