konapun/vacuumline.nvim

github github
bars-and-linesstatusline
stars 28
issues 1
subscribers 1
forks 2
CREATED

2021-07-24

UPDATED

3 years ago


vacuumline.nvim

Airline in the vacuum of space

vacuumline is a prebuilt configuration for galaxyline based on the look and functionality of Airline. It can be further configured to style icons, colors, and segments.

full pane vacuumline

split pane vacuumline showing inctive and active styling

Features

  • Built on galaxyline
  • Adaptive segments based on pane size (expand/collapse - guarantees vim mode indicator is never hidden)
  • Dynamic theming
  • Active/inactive segment styling
  • Customizable
  • Prebuilt segments:

Install

The goal of vacuumline is just to expose a galaxyline configuration and thus requires galaxyline and its dependencies:

vim-plug

Plug 'konapun/vacuumline.nvim'
Plug 'glepnir/galaxyline.nvim', {'branch': 'main'}
" One of the following is required for showing icons
Plug 'kyazdani42/nvim-web-devicons' " lua
Plug 'ryanoasis/vim-devicons' " vimscript

" Somewhere after plug#end()

lua require('vacuumline').setup()

packer

use {'konapun/vacuumline.nvim', requires = {
  'glepnir/galaxyline.nvim', branch = 'main',
  'kyazdani42/nvim-web-devicons', opt = true
}, config = function() require('vacuumline').setup() end} -- Add this line to use defaults; otherwise, call `setup` with your config as described below wherever you configure your plugins

Want to try out beta features before they make it into master? Use branch next!

Caution: beta features are considered experimental and may introduce breaking changes.

use {'konapun/vacuumline.nvim', branch = 'next', requires = {
  'glepnir/galaxyline.nvim', branch = 'main',
  'kyazdani42/nvim-web-devicons', opt = true
}, config = function() require('vacuumline').setup() end} -- Add this line to use defaults; otherwise, call `setup` with your config as described below wherever you configure your plugins

Collapse Behavior

One of the big advantages of vacuumline over a standard galaxyline config is the builtin responsiveness:

uncollapsed vacuumline

collapse level 1

collapse level 2

collapse level 3

collapse level 4

Configuration

Theming

For convenience, rather than configuring colors for each segment separately, you may want to apply a theme.

require('vacuumline').setup({
  theme = require('vacuumline.theme.nord')
})

Builtin Themes

The follow themes are built in. If you'd like to contribute a theme, please feel free to submit a PR.

  • gruvbox: theme = require('vacuumline.theme.gruvbox')
  • nord: theme = require('vacuumline.theme.nord')
  • one-dark: theme = require('vacuumline.theme.one-dark')

Custom Theme

You can also use a custom theme:

require('vacuumline').setup({
  theme = {
    line             = {foreground = '#98971a', background = '#282828'},
    segment_odd      = {foreground = '#282828', background = '#b16286'},
    segment_even     = {foreground = '#282828', background = '#98971a'},
    mode_normal      = {foreground = '#b16286'},
    mode_insert      = {foreground = '#98971a'},
    mode_command     = {foreground = '#458588'},
    mode_visual      = {foreground = '#d79921'},
    mode_visual_line = {foreground = '#689d6a'},
    mode_terminal    = {foreground = '#cc241d'},
    warning          = {foreground = '#282828', background = '#fabd2f'},
    error            = {foreground = '#282828', background = '#fb4934'},
    scroll           = {foreground = '#d79921'}
  }
})

Defaults

Here is the full default configuration. Individual pieces are described in more depth below.

{
  separator = {
    segment = {
      left = '',
      right = ''
    },
    section = {
      left = '',
      right = ''
    }
  },
  color = {
    foreground = {line = '#98971a', even = '#282828', odd = '#282828'},
    background = {line = '#282828', even = '#b16286', odd = '#98971a'},
  },
  segment = {
    mode = {
      map = {
        n = {label = ' ', background = '#b16286'}, -- NORMAL
        i = {label = ' ', background = '#98971a'}, -- INSERT
        c = {label = ' ', background = '#458588'}, -- COMMAND
        v = {label = ' ', background = '#d79921'}, -- VISUAL
        V = {label = ' ', background = '#fabd2f'}, -- VISUAL LINE
        t = {label = ' ', background = '#d3869b'}, -- TERMINAL
      }
    },
    file = {},
    vcs = {},
    scroll = {
      accent = '#d79921',
    },
    lines = {},
    diagnostics = {
      background = '#fb4934',
      errors = {
        foreground = '#282828',
        background = '#fb4934'
      },
      warnings = {
        foreground = '#282828',
        background = '#fabd2f'
      }
    },
    search = {},
    lsp = {
      foreground = '#98971a',
      background = '#282828'
    }
  }
}

Global configurations

Global config values are used when no specific value is provided for a segment.

separator = {
  segment = {
    left = '',
    right = ''
  },
  section = {
    left = '',
    right = ''
  }
},
color = {
  foreground = {line = '#98971a', even = '#282828', odd = '#282828'},
  background = {line = '#282828', even = '#b16286', odd = '#98971a'},
}

Separators

Segment separators are used to separate segments, obviously.

Colors

These are colors which are applied to segments depending on their order in the vacuumline.

  • line: default line colors - line foreground and background
  • even: default colors for even-numbered segments - foreground and background
  • odd: default colors for odd-numbered segments - foreground and background

Segments

Mode

Displays the current vim mode as a color indicator and text/icon display

Collapse behavior: None

mode = {
  foreground = '', -- dynamic by default
  background = '', -- dynamic by default
  separator = '', -- dynamic by default
  map = {
    n = {label = ' ', background = '#b16286'}, -- NORMAL
    i = {label = ' ', background = '#98971a'}, -- INSERT
    c = {label = ' ', background = '#458588'}, -- COMMAND
    v = {label = ' ', background = '#d79921'}, -- VISUAL
    V = {label = ' ', background = '#fabd2f'}, -- VISUAL LINE
    t = {label = ' ', background = '#d3869b'}, -- TERMINAL
  }
}

File

Displays an icon for the current filetype, the current file name, edit status, and file size

Collapse behavior:

  • Truncates filename depending on available width
  • Hides filename and file size depending on available width
file = {
  foreground = '', -- dynamic by default
  background = '', -- dynamic by default
  separator = '' -- dynamic by default
}

VCS

Displays current branch name along with additions, changes, and deletions

Collapse behavior:

  • Collapses entire segment depending on available width
vcs = {
  foreground = '', -- dynamic by default
  background = '', -- dynamic by default
  separator = '' -- dynamic by default
}

Scroll

Displays current scroll position in the file as both percentage and visual indicator

Collapse behavior:

  • Hides percent indicator depending on available width
scroll = {
  accent = '', -- used to color the scroll indicator
  foreground = '', -- dynamic by default
  background = '', -- dynamic by default
  separator = '' -- dynamic by default
}

Lines

Displays current line and column along with line endings

Collapse behavior:

  • Hides line endings depending on available width
  • Collapses entire segment depending on available width
lines = {
  foreground = '', -- dynamic by default
  background = '', -- dynamic by default
  separator = '', -- dynamic by default
  section_separator = '', -- dynamic by default
}

Diagnostics

Displays errors, warnings, and info from LSP diagnostics

Collapse behavior: None

diagnostics = {
  separator = '', -- dynamic by default
  errors = {
    foreground = '',
    background = ''
  },
  warnings = {
    foreground = '',
    background = ''
  }
}

Search

Displays current search term, current match, and total matches

Collapse behavior: None

search = {
  foreground = '', -- dynamic by default
  background = '', -- dynamic by default
  separator = '' -- dynamic by default
}

LSP

Displays the active language server

Collapse behavior:

  • Hides depending on available width
lsp = {
  foreground = '', -- dynamic by default
  background = '' -- dynamic by default
}

Developing

Using packer

Link your local vacuumline directory into your packer destination directory

cd <packer plugin directory> # ~/.local/share/nvim/site/pack/packer/start on my config
ln -s <local dev vacuumline> vacuumline.nvim