Home

Awesome

galaxyline.nvim

galaxyline is a light-weight and Super Fast statusline plugin. Galaxyline componentizes Vim's statusline by having a provider for each text area.

This means you can use the api provided by galaxyline to create the statusline that you want, easily.

IMPORTANT: galaxyline requires Neovim 0.5 onwards (0.6 is recommended!)

Install

use({
  "NTBBloodbath/galaxyline.nvim",
  -- your statusline
  config = function()
    require("galaxyline.themes.eviline")
  end,
  -- some optional icons
  requires = { "kyazdani42/nvim-web-devicons", opt = true }
})

Api

Section Variables

The type of all of these section variables:

Component keyword

Example of a FileSize component in the left section:

require("galaxyline").section.left[1] = {
  FileSize = {
    provider = "FileSize",
    condition = function()
      return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
    end,
    icon = "   ",
    highlight = { colors.green, colors.purple },
    separator = "",
    separator_highlight = { colors.purple, colors.darkblue },
  }
}

provider can be a string, function or table. When it's a string, it will match the default provider group. If it doesn't match an existing group you will get an error. You can also use multiple default providers in provider. If you are using multiple then you must provide an array table for provider.

Default provider groups:

---- source provider functions
-- Code diagnostics
local diagnostic = require("galaxyline.providers.diagnostic")
-- Version control
local vcs = require("galaxyline.providers.vcs")
-- Core files information
local fileinfo = require("galaxyline.providers.fileinfo")
-- Extensions, aka plugins
local extension = require("galaxyline.providers.extensions")
-- Neovim highlighting
local colors = require("galaxyline.highlighting")
-- Buffer information, e.g. corresponding icon
local buffer = require("galaxyline.providers.buffer")
-- Search results
local search = require("galaxyline.providers.search")
-- Spacing
local whitespace = require("galaxyline.providers.whitespace")
-- Active language server information
local lspclient = require("galaxyline.providers.lsp")


---- Providers
BufferIcon  = buffer.get_buffer_type_icon
BufferNumber = buffer.get_buffer_number
FileTypeName = buffer.get_buffer_filetype
-- Git Provider
GitBranch = vcs.get_git_branch
DiffAdd = vcs.diff_add             -- support vim-gitgutter vim-signify gitsigns
DiffModified = vcs.diff_modified   -- support vim-gitgutter vim-signify gitsigns
DiffRemove = vcs.diff_remove       -- support vim-gitgutter vim-signify gitsigns
-- Search Provider
SearchResults = search.get_results,
-- File Provider
LineColumn = fileinfo.line_column
FileFormat = fileinfo.get_file_format
FileEncode = fileinfo.get_file_encode
FileSize = fileinfo.get_file_size
FileIcon = fileinfo.get_file_icon
FileName = fileinfo.get_current_file_name
LinePercent = fileinfo.current_line_percent
ScrollBar = extension.scrollbar_instance
VistaPlugin = extension.vista_nearest
-- Whitespace
Whitespace = whitespace.get_item
-- Diagnostic Provider
DiagnosticError = diagnostic.get_diagnostic_error
DiagnosticWarn = diagnostic.get_diagnostic_warn
DiagnosticHint = diagnostic.get_diagnostic_hint
DiagnosticInfo = diagnostic.get_diagnostic_info
-- LSP
GetLspClient = lspclient.get_lsp_client


---- Public libs
-- Get file icon color
require("galaxyline.providers.fileinfo").get_file_icon_color
-- Custom file icon with color
local my_icons = require("galaxyline.providers.fileinfo").define_file_icon()
my_icons['your file type here'] = { color code, icon}
-- If your filetype does is not defined in neovim  you can use file extensions
my_icons['your file ext  in here'] = { color code, icon}

---- built-in conditions
local condition = require("galaxyline.condition")
-- if buffer not empty return true else false
condition.buffer_not_empty
-- if winwidth(0)/ 2 > 40 true else false
condition.hide_in_width
-- find git root, you can use this to check if the project is a git workspace
condition.check_git_workspace()


---- built-in theme
local colors = require("galaxyline.themes.colors").default
--- Palette:
-- bg = "#202328"
-- fg = "#bbc2cf"
-- yellow = "#ECBE7B"
-- cyan = "#008080"
-- darkblue = "#081633"
-- green = "#98be65"
-- orange = "#FF8800"
-- violet = "#a9a1e1"
-- magenta = "#c678dd"
-- blue = "#51afef"
-- red = "#ec5f67"

Do you want to use other themes than default or even make your own? Please refer to themes.md!

You can also use the source of the provider function.

Awesome Show

eviline

You can find more custom galaxyline examples here

License

MIT