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.
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'" vimscriptuse({
'glepnir/galaxyline.nvim',
branch='main',
-- your statuslineconfig=function()
require('my_statusline')
end,
-- some optional iconsrequires= { 'nvim-tree/nvim-web-devicons', opt=true },
})The type of all of these section variables:
require('galaxyline').short_line_listsome special filetypes that show a short statusline likeLuaTree defx coc-explorer vistaetc.require('galaxyline').section.leftthe statusline left section.require('galaxyline').section.midthe statusline mid section.require('galaxyline').section.rightthe statusline right section.require('galaxyline').section.short_line_leftthe statusline left section when filetype is inshort_line_listand for inactive window.require('galaxyline').section.short_line_rightstatusline right section when filetype is inshort_line_listand for inactive window.
Example of a FileSize component in the left section:
require('galaxyline').section.left[1] = {
FileSize= {
provider='FileSize',
condition=function()
ifvim.fn.empty(vim.fn.expand('%:t')) ~=1thenreturntrueendreturnfalseend,
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.
-- source provider functionlocaldiagnostic=require('galaxyline.provider_diagnostic')
localvcs=require('galaxyline.provider_vcs')
localfileinfo=require('galaxyline.provider_fileinfo')
localextension=require('galaxyline.provider_extensions')
localcolors=require('galaxyline.colors')
localbuffer=require('galaxyline.provider_buffer')
localwhitespace=require('galaxyline.provider_whitespace')
locallspclient=require('galaxyline.provider_lsp')
-- providerBufferIcon=buffer.get_buffer_type_icon,
BufferNumber=buffer.get_buffer_number,
FileTypeName=buffer.get_buffer_filetype,
-- Git ProviderGitBranch=vcs.get_git_branch,
DiffAdd=vcs.diff_add, -- support vim-gitgutter vim-signify gitsignsDiffModified=vcs.diff_modified, -- support vim-gitgutter vim-signify gitsignsDiffRemove=vcs.diff_remove, -- support vim-gitgutter vim-signify gitsigns-- File ProviderLineColumn=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,
-- WhitespaceWhitespace=whitespace.get_item,
-- Diagnostic ProviderDiagnosticError=diagnostic.get_diagnostic_error,
DiagnosticWarn=diagnostic.get_diagnostic_warn,
DiagnosticHint=diagnostic.get_diagnostic_hint,
DiagnosticInfo=diagnostic.get_diagnostic_info,
-- LSPGetLspClient=lspclient.get_lsp_client,
-- public libsrequire('galaxyline.provider_fileinfo').get_file_icon_color-- get file icon color-- custom file icon with colorlocalmy_icons=require('galaxyline.provider_fileinfo').define_file_icon() -- get file icon colormy_icons['your file type here'] = { colorcode, icon}
-- if your filetype does is not defined in neovim you can use file extensionsmy_icons['your file ext in here'] = { colorcode, icon}
-- built-in conditionlocalcondition=require('galaxyline.condition')
condition.buffer_not_empty-- if buffer not empty return true else falsecondition.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 workspacecondition.check_git_workspace()
-- built-in themelocalcolors=require('galaxyline.theme').defaultbg='#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.
conditionis a function that must return a boolean. If it returns true then it will load the component.iconis a string that will be added to the head of the provider result. It can also be a function that returns a string.highlightis a string, function or table that can be used in two ways. The first is to pass three elements: the first element isfg, the second isbg, and the third isgui. The second method is to pass a highlight group as a string (such asIncSearch) that galaxyline will link to.separatoris 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_highlightsame as highlight.eventtype is string. You configure a plugin's event that will reload the statusline.
- Author: glepnir
- Author: Christian Chiarulli
- Author: BenoitPingris
- Author: Th3Whit3Wolf
- Author: voitd
You can find more custom galaxyline examples here.
Copyright © 2020-present Raphael




