Skip to content

1.0.0

Latest
Compare
Choose a tag to compare
@rbong rbong released this 02 Sep 17:10
· 10 commits to master since this release

vim-crystalline is a plugin that lets you build your own statusline/tabline in Vim (and Neovim as of v1) in a vanilla style.

vim-crystalline is fast and easy to use.

Version 1 of vim-crystalline is a total overhaul and comes with many improvements.

Why another statusline plugin?

Other statusline plugins look nice, but customizing the statusline in vanilla vim is easier.
I created vim-crystalline so you can build your own statusline like in vanilla vim but with all the fanciness of statusline plugins.

Read the statusline configuration comparison here.

Sample

Here's what a basic statusline and tabline look like in version 1:

function! g:CrystallineStatuslineFn(winnr)
  let l:s = crystalline#ModeSection('>', 'A', 'B')
  let l:s .= ' %f%h%w%m%r '
  let l:s .= crystalline#Sep('>', 'B', 'Fill') . ' %{fugitive#Head()}'

  let l:s .= '%='

  let l:s .= crystalline#Sep('<', 'Fill', 'B') . (&paste ? ' PASTE ' : ' ')
  let l:s .= crystalline#Sep('<', 'B', 'A')
  let l:s .= ' %{&ft} %l/%L %2v '

  return l:s
endfunction

function! g:CrystallineTablineFn()
  return crystalline#DefaultTabline({ 'enable_sep': 1, 'sep_index': '>' })
endfunction

set showtabline=2
set guioptions-=e
set laststatus=2
let g:crystalline_auto_prefix_groups = 1

" By default, these are powerline-style separators
let g:crystalline_separators = {
      \ '>': { 'ch': '>', 'alt_ch': '|', 'dir': '>' },
      \ '<': { 'ch': '>', 'alt_ch': '|', 'dir': '<' },
      \ }

See the examples for more.

New Enhancements in Version 1

General

  • Command mode and terminal mode are now available.

  • Separator functions are much clearer:

" By default, these are powerline-style separators
let g:crystalline_separators = [
      \ { 'ch': '>', 'alt_ch': '|', 'dir': '>' },
      \ { 'ch': '<', 'alt_ch': '|', 'dir': '<' },
      \ ]
" Use separator 0 between highlight groups CrystallineA and CrystallineB
let l:sep = crystalline#Sep(0, 'A', 'B')
  • Added compatibility with Neovim and Lua, example:
-- ~/.config/nvim/init.lua

require("packer").startup(function(use)
  use("rbong/vim-crystalline")

  function vim.g.CrystallineStatuslineFn(winnr)
    local cl = require("crystalline")
    return cl.ModeSection(0, "A", "Fill") .. " %f%h%w%m%r "
  end
  
  function vim.g.CrystallineTablineFn()
    local cl = require("crystalline")
    return cl.DefaultTabline()
  end
end)
  • Plugin performance has been improved.

  • Other functions are now clearer (see :help crystalline-functions).

Tabline

  • Tabline functions are much more flexible.
    Functions such as crystalline#Tabs() and crystalline#Buffers() are available for showing tabs/buffers anywhere on the statusline or tabline.

  • The tabline now updates more responsively when the current mode changes.

Highlight Groups and Themes

  • Highlight group names are now clearer, for example CrystallineA, CrystallineB, etc.
    (See :help crystalline-highlight-groups.)

  • Every highlight group now has a variation for the current mode, for example CrystallineNormalModeFill, CrystallineCommandModeTab, etc.
    These groups have been added to many existing themes.

  • You can automatically add the current mode/inactive status to highlight groups with let g:crystalline_auto_prefix_groups = 1

  • Themes can now define variants for highlight groups, for example CrystallineA1, CrystallineA2, CrystallineB1, etc.
    These can be used for showing different settings and state in the statusline, such as if the file has been modified or if the paste setting is active.
    Variants have been added to many existing themes.

  • You can automatically add variants onto highlight groups with let g:crystalline_group_suffix = 1

  • You no longer have to define every highlight group/attribute in a theme, they will fall back on reasonable defaults.

  • Added new themes: ayu (dark)/ayu (light), iceberg (dark)/iceberg (light), onehalfdark/onehalflight, and nord.

  • Added function to port vim-airline themes (see Porting Airline Themes).

Migrating to v1

Almost everything has changed, so please review :help vim-crystalline and the examples.
You'll get deprecation warnings when possible.