• Stars
    star
    807
  • Rank 55,963 (Top 2 %)
  • Language
    Lua
  • License
    MIT License
  • Created almost 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

neovim statusline plugin written in lua

🌌 galaxyline.nvim

Stargazers Issues Contributors

 

💭 About

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.

🧩 Requires

⚙️ Setup

Plug 'glepnir/galaxyline.nvim' , { 'branch': 'main' }

" If you want to display icons, then use one of these plugins:
Plug 'nvim-tree/nvim-web-devicons' " lua
Plug 'ryanoasis/vim-devicons'       " vimscript
use({
  'glepnir/galaxyline.nvim',
  branch = 'main',
  -- your statusline
  config = function()
    require('my_statusline')
  end,
  -- some optional icons
  requires = { 'nvim-tree/nvim-web-devicons', opt = true },
})

🧭 Api

Section Variables

The type of all of these section variables:

  • require('galaxyline').short_line_list some special filetypes that show a short statusline like LuaTree defx coc-explorer vista etc.

  • require('galaxyline').section.left the statusline left section.

  • require('galaxyline').section.mid the statusline mid section.

  • require('galaxyline').section.right the statusline right section.

  • require('galaxyline').section.short_line_left the statusline left section when filetype is in short_line_list and for inactive window.

  • require('galaxyline').section.short_line_right statusline right section when filetype is in short_line_list and for inactive window.

Component Keyword

Example of a FileSize component in the left section:

require('galaxyline').section.left[1] = {
  FileSize = {
    provider = 'FileSize',
    condition = function()
      if vim.fn.empty(vim.fn.expand('%:t')) ~= 1 then
        return true
      end
      return false
    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 function
local diagnostic = require('galaxyline.provider_diagnostic')
local vcs = require('galaxyline.provider_vcs')
local fileinfo = require('galaxyline.provider_fileinfo')
local extension = require('galaxyline.provider_extensions')
local colors = require('galaxyline.colors')
local buffer = require('galaxyline.provider_buffer')
local whitespace = require('galaxyline.provider_whitespace')
local lspclient = require('galaxyline.provider_lsp')

-- provider
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
-- 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,
FilePath = fileinfo.get_current_file_path,
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

require('galaxyline.provider_fileinfo').get_file_icon_color -- get file icon color
-- custom file icon with color
local my_icons = require('galaxyline.provider_fileinfo').define_file_icon() -- get file icon color
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 condition
local condition = require('galaxyline.condition')
condition.buffer_not_empty  -- if buffer not empty return true else false
condition.hide_in_width  -- if winwidth(0)/ 2 > 40 true else false
-- 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.theme').default

bg = '#202328',
fg = '#bbc2cf',
yellow = '#ecbe7b',
cyan = '#008080',
darkblue = '#081633',
green = '#98be65',
orange = '#ff8800',
violet = '#a9a1e1',
magenta = '#c678dd',
blue = '#51afef';
red = '#ec5f67';

You can also use the source of the provider function.

  • condition is a function that must return a boolean. If it returns true then it will load the component.

  • icon is a string that will be added to the head of the provider result. It can also be a function that returns a string.

  • highlight is a string, function or table that can be used in two ways. The first is to pass three elements: the first element is fg, the second is bg, and the third is gui. The second method is to pass a highlight group as a string (such as IncSearch) that galaxyline will link to.

  • separator is a string, function or table. notice that table type only work in mid section, It is not just a separator. Any statusline item can be defined here, like %<,%{},%n, and so on.

  • separator_highlight same as highlight.

  • event type is string. You configure a plugin's event that will reload the statusline.

🎉 Awesome Show

eviline

galaxyline

galaxyline

galaxyline

galaxyline

You can find more custom galaxyline examples here.

 

Copyright © 2020-present Raphael

More Repositories

1

lspsaga.nvim

neovim lsp plugin
Lua
2,484
star
2

dashboard-nvim

vim dashboard
Lua
1,337
star
3

nvim-lua-guide-zh

https://github.com/nanotee/nvim-lua-guide chinese version
1,165
star
4

nvim

neovim configuration written in lua
Lua
726
star
5

dope

a modern structure neovim config template write in lua
Lua
286
star
6

spaceline.vim

vim statusline like spacemacs
Vim Script
279
star
7

zephyr-nvim

A dark neovim colorscheme written in lua
Lua
272
star
8

oceanic-material

Oceanic Material Colorscheme on Vim/NeoVim
Vim Script
174
star
9

indent-guides.nvim

Lua
149
star
10

GoDoc-CN

Go标准库的中文版Dash文档
HTML
133
star
11

jarvim

Generate a module vim configruation like a VIM PRO
Go
112
star
12

leaseapp

go开发的后台API
Go
102
star
13

template.nvim

Quickly insert templates into file
Lua
90
star
14

coman.nvim

neovim plugin for comment and annotation
Lua
57
star
15

prodoc.nvim

a neovim comment and annotation plugin using coroutine
Lua
48
star
16

mcc.nvim

neovim macgic char
Lua
35
star
17

DailyTasks

🌼 A simple go web app without framework
Go
30
star
18

dotfiles

my personal dotfiles on mac or arch
Shell
25
star
19

golang-advance

Go 数据结构与算法 设计模式
Go
23
star
20

mutchar.nvim

a neovim plugin that change type character to other characters accroding rules and filter.
Lua
19
star
21

smartinput.nvim

Lua
15
star
22

hlsearch.nvim

auto remove search highlight and rehighlight when using n or N
Lua
14
star
23

porcelain.nvim

personal colorscheme
Lua
13
star
24

lspmeta.nvim

Go
11
star
25

whiskyline.nvim

whisky line a neovim statusline using coroutine and cache just for fun.
Lua
10
star
26

dashboard-imageview

work for dashboard-nvim
Rust
9
star
27

nerdicons.nvim

get the nerdfont icons inside neovim
Lua
8
star
28

dbsession.nvim

a simple small powerful session for neovim
Lua
8
star
29

go-react-jwt

Golang with React Jwt.
TypeScript
6
star
30

ziglearn-cn

zig programming language tutorial
Zig
6
star
31

glepnir.github.io

Personal Blog
HTML
4
star
32

glepnir

4
star
33

watchdog

Go
3
star
34

fuckcd

2
star
35

GoDDDExample

golang in ddd example
Go
2
star
36

umijs3-crud-example

antd umijs3 crud example
TypeScript
1
star
37

hugo-xshell

HTML
1
star
38

snowflake

Twitter snowflake by go
Go
1
star
39

zapecho

zap logger for echo web framework
Go
1
star