{"id":13485331,"url":"https://github.com/rbong/vim-crystalline","last_synced_at":"2025-03-27T17:30:58.843Z","repository":{"id":40315784,"uuid":"187239514","full_name":"rbong/vim-crystalline","owner":"rbong","description":"Build your own fancy statusline/tabline in Vim/Neovim","archived":false,"fork":false,"pushed_at":"2025-01-03T21:17:55.000Z","size":260,"stargazers_count":276,"open_issues_count":0,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-03T22:24:54.491Z","etag":null,"topics":["bufferline","neovim","plugin","powerline","statusline","tabline","vim"],"latest_commit_sha":null,"homepage":"","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rbong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-17T15:22:39.000Z","updated_at":"2025-01-03T21:17:59.000Z","dependencies_parsed_at":"2024-10-30T19:41:15.500Z","dependency_job_id":null,"html_url":"https://github.com/rbong/vim-crystalline","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbong%2Fvim-crystalline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbong%2Fvim-crystalline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbong%2Fvim-crystalline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbong%2Fvim-crystalline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbong","download_url":"https://codeload.github.com/rbong/vim-crystalline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245892520,"owners_count":20689511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bufferline","neovim","plugin","powerline","statusline","tabline","vim"],"created_at":"2024-07-31T17:01:55.596Z","updated_at":"2025-03-27T17:30:58.532Z","avatar_url":"https://github.com/rbong.png","language":"Vim Script","funding_links":[],"categories":["Vim Script","Vim script"],"sub_categories":[],"readme":"# vim-crystalline\n\n[![test status](https://github.com/rbong/vim-crystalline/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/rbong/vim-crystalline/actions/workflows/test.yml)\n\nWant a nice statusline in Vim?\nOther statusline plugins too [slow](https://github.com/rbong/vim-crystalline/wiki/Performance-Comparison)\nand [uncustomizable](https://github.com/rbong/vim-crystalline/wiki/Configuration-Comparison)?\n`vim-crystalline` is for you.\n\n`vim-crystalline` lets you build your own statusline and tabline in a vanilla Vim style.\n\n## Obligatory Colorful Theme Screenshots\n\n**default**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/default.png)\n\n**ayu (dark)**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/ayu_dark.png)\n\n**ayu (light)**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/ayu_light.png)\n\n**badwolf**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/badwolf.png)\n\n**dracula**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/dracula.png)\n\n**gruvbox (dark)**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/gruvbox_dark.png)\n\n**gruvbox (light)**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/gruvbox_light.png)\n\n**hybrid (dark)**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/hybrid_dark.png)\n\n**hybrid (light)**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/hybrid_light.png)\n\n**iceberg (dark)**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/iceberg_dark.png)\n\n**iceberg (light)**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/iceberg_light.png)\n\n**jellybeans**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/jellybeans.png)\n\n**molokai**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/molokai.png)\n\n**nord**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/nord.png)\n\n**onedark**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/onedark.png)\n\n**onehalfdark**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/onehalfdark.png)\n\n**onehalflight**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/onehalflight.png)\n\n**papercolor**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/papercolor.png)\n\n**shadesofpurple**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/shadesofpurple.png)\n\n**solarized (dark)**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/solarized_dark.png)\n\n**solarized (light)**\n\n![img](https://github.com/rbong/vim-crystalline/wiki/screenshots/solarized_light.png)\n\n**Making your own theme**\n\nSee also [`:help crystalline-creating-themes`](https://raw.githubusercontent.com/rbong/vim-crystalline/master/doc/crystalline.txt)\nand [Porting Airline Themes](https://github.com/rbong/vim-crystalline/wiki/Porting-Airline-Themes).\n\n## Installation\n\n### Installation with [vim-plug](https://github.com/junegunn/vim-plug)\n\n```vim\ncall plug#begin()\nPlug 'rbong/vim-crystalline'\ncall plug#end()\n```\n\nRun `:PlugInstall` after restarting vim.\n\n### Installation with [packer.nvim](https://github.com/wbthomason/packer.nvim)\n\n```lua\nrequire(\"packer\").startup(function(use)\n  use(\"rbong/vim-crystalline\")\nend)\n```\n\nRun `:PackerInstall` after restarting neovim.\n\n## Examples\n\nThese examples use vimscript.\nExamples are also available in [neovim-flavored Lua](examples/neovim_lua_examples.md).\n\nAll examples belong in `.vimrc` before `vim-crystalline` is loaded.\n\n### Creating a Basic Statusline\n\n```vim\nfunction! g:CrystallineStatuslineFn(winnr)\n  let l:s = ''\n\n  \" Add file name and modification status\n  let l:s .= ' %f%h%w%m%r '\n\n  \" Start the right side of the statusline\n  let l:s .= '%='\n\n  \" Add file type and position info\n  let l:s .= '%{\u0026ft} %l/%L %2v '\n\n  return l:s\nendfunction\n\n\" Always show the statusline\nset laststatus=2\n```\n\nSee [`:help 'statusline'`](https://vimhelp.org/options.txt.html#%27statusline%27) for more info.\n\n### Creating a Basic Tabline\n\n```vim\nfunction! g:CrystallineTablineFn()\n  return crystalline#DefaultTabline()\nendfunction\n\n\" Always show the tabline\nset showtabline=2\n\" Show the tabline in gvim\nset guioptions-=e\n```\n\nSee [`:help 'tabline'`](https://vimhelp.org/options.txt.html#%27statusline%27) for more info.\n\n### Hiding Sections\n\n```vim\nfunction! g:CrystallineStatuslineFn(winnr)\n  let l:s = ''\n\n  let l:s .= ' %f%h%w%m%r '\n\n  let l:s .= '%='\n\n  \" Only add this section in active windows\n  if a:winnr == winnr()\n    let l:s .= '%{\u0026ft} '\n  endif\n  \" Only add this section in wide enough windows\n  if winwidth(a:winnr) \u003e= 80\n    let l:s .= '%l/%L %2v '\n  endif\n\n  return l:s\nendfunction\n\nset laststatus=2\n```\n\n### Using Highlight Groups\n\n```vim\nfunction! g:CrystallineStatuslineFn(winnr)\n  let l:s = ''\n\n  if a:winnr == winnr()\n    \" Start highlighting section A\n    let l:s .= crystalline#HiItem('A')\n  else\n    \" Start highlighting Fill section for inactive windows\n    let l:s .= crystalline#HiItem('InactiveFill')\n  endif\n\n  let l:s .= ' %f%h%w%m%r '\n\n  return l:s\nendfunction\n\nset laststatus=2\n\" Default theme\nlet g:crystalline_theme = 'default'\n```\n\nSee [`:help crystalline-highlight-groups`](https://raw.githubusercontent.com/rbong/vim-crystalline/master/doc/crystalline.txt)\nfor the full list of groups.\n\nSee [screenshots](#obligatory-colorful-theme-screenshots)\nfor the full list of themes.\n\n### Using Separators\n\n```vim\nfunction! g:CrystallineStatuslineFn(winnr)\n  let l:s = ''\n\n  let l:s .= crystalline#HiItem('A')\n\n  let l:s .= ' %f%h%w%m%r '\n\n  \" Add separator 0 between section A and the statusline fill section\n  let l:s .= crystalline#Sep(0, 'A', 'Fill')\n\n  let l:s .= '%='\n\n  \" Add separator 1 between the fill section and section A\n  let l:s .= crystalline#Sep(1, 'Fill', 'A')\n\n  let l:s .= '%{\u0026ft} %l/%L %2v '\n\n  return l:s\nendfunction\n\nfunction! g:CrystallineTablineFn()\n  \" Add separators to the tabline\n  return crystalline#DefaultTabline({ 'enable_sep': 1 })\nendfunction\n\nset laststatus=2\nset showtabline=2\nset guioptions-=e\n\" By default, these are powerline-style separators\nlet g:crystalline_separators = [\n      \\ { 'ch': '\u003e', 'alt_ch': '|', 'dir': '\u003e' },\n      \\ { 'ch': '\u003c', 'alt_ch': '|', 'dir': '\u003c' },\n      \\ ]\n```\n\n### Using Mode Colors\n\nUsing mode colors manually:\n\n```vim\nfunction! g:CrystallineStatuslineFn(winnr)\n  let l:s = ''\n\n  \" In different modes, this will be 'NormalModeA', 'InsertModeA', etc.\n  let l:s .= crystalline#ModeHiItem('A')\n\n  let l:s .= ' %f%h%w%m%r '\n\n  \" The mode prefix is added to all separator groups\n  let l:s .= crystalline#Sep(0, crystalline#ModeGroup('A'), crystalline#ModeGroup('Fill'))\n\n  return l:s\nendfunction\n\nfunction! g:CrystallineTablineFn()\n  \" auto_prefix_groups automatically uses mode colors\n  return crystalline#DefaultTabline({ 'auto_prefix_groups': 1 })\nendfunction\n\nset laststatus=2\nset showtabline=2\nset guioptions-=e\n```\n\nUsing mode colors automatically:\n\n```vim\nfunction! g:CrystallineStatuslineFn(winnr)\n  let l:s = ''\n\n  \" In different modes, this will be 'NormalModeA', 'InsertModeA', etc.\n  \" In inactive windows, this will be 'InactiveA'\n  let l:s .= crystalline#HiItem('A')\n\n  let l:s .= ' %f%h%w%m%r '\n\n  \" The prefix will automatically be added to separator groups\n  let l:s .= crystalline#Sep(0, 'A', 'Fill')\n\n  return l:s\nendfunction\n\nfunction! g:CrystallineTablineFn()\n  \" auto_prefix_groups will default to true\n  \" 'Inactive*' groups will not be used in the tabline\n  return crystalline#DefaultTabline()\nendfunction\n\nset laststatus=2\nset showtabline=2\nset guioptions-=e\n\" This enables auto mode/inactive colors\n\" All functions work with this option\nlet g:crystalline_auto_prefix_groups = 1\n```\n\nAdd a mode section:\n\n```vim\nfunction! g:CrystallineStatuslineFn(winnr)\n  let l:s = ''\n\n  \" Automatically create a mode highlight group, mode label, and separator\n  \" Same arguments as crystalline#Sep()\n  let l:s .= crystalline#ModeSection(0, 'A', 'B')\n\n  let l:s .= ' %f%h%w%m%r '\n\n  let l:s .= crystalline#Sep(0, 'B', 'Fill')\n\n  return l:s\nendfunction\n\nset laststatus=2\n```\n\n### Using Color Variants\n\nUsing color variants manually:\n\n```vim\nfunction! g:GroupSuffix()\n  if mode() ==# 'i' \u0026\u0026 \u0026paste\n    \" Add the suffix '2' to all groups\n    return '2'\n  endif\n  if \u0026modified\n    \" Add the suffix '1' to all groups\n    return '1'\n  endif\n  \" Don't add any suffix\n  return ''\nendfunction\n\nfunction! g:CrystallineStatuslineFn(winnr)\n  let l:s = ''\n\n  \" Add the variant onto the end of the highlight item\n  let l:s .= crystalline#HiItem('Fill' . g:GroupSuffix())\n\n  let l:s .= ' %f%h%w%m%r '\n\n  return l:s\nendfunction\n\nfunction! g:CrystallineTablineFn()\n  \" Add the variant onto the end of all tabline groups\n  return crystalline#DefaultTabline({ 'group_suffix': g:GroupSuffix() })\nendfunction\n\nset laststatus=2\nset showtabline=2\nset guioptions-=e\nlet g:crystalline_auto_prefix_groups = 1\n```\n\nUsing color variants automatically:\n\n```vim\nfunction! g:GroupSuffix()\n  if mode() ==# 'i' \u0026\u0026 \u0026paste\n    return '2'\n  endif\n  if \u0026modified\n    return '1'\n  endif\n  return ''\nendfunction\n\nfunction! g:CrystallineStatuslineFn(winnr)\n  let l:s = ''\n\n  \" Automatically add the suffix onto the end of all groups\n  \" Works with all functions\n  let g:crystalline_group_suffix = g:GroupSuffix()\n\n  let l:s .= crystalline#HiItem('Fill')\n\n  let l:s .= ' %f%h%w%m%r '\n\n  return l:s\nendfunction\n\nfunction! g:CrystallineTablineFn()\n  let g:crystalline_group_suffix = g:GroupSuffix()\n  return crystalline#DefaultTabline()\nendfunction\n\nset laststatus=2\nset showtabline=2\nset guioptions-=e\nlet g:crystalline_auto_prefix_groups = 1\n```\n\nThere are 2 variants to use in built-in themes.\n\n### Showing More Statusline Information\n\n```vim\nfunction! g:CrystallineStatuslineFn(winnr)\n  let l:s = ''\n\n  let l:s .= ' %f%h%w%m%r '\n\n  \" Add the current branch from vim-fugitive\n  \" Plugins often provide functions for the statusline\n  let l:s .= '%{fugitive#Head()} '\n\n  let l:s .= '%='\n\n  \" Show settings in the statusline\n  let l:s .= '%{\u0026paste ? \"PASTE \" : \" \"}'\n\n  return l:s\nendfunction\n\nset laststatus=2\n```\n\n### Showing More Tabline Information\n\n```vim\nfunction! g:CrystallineTablineFn()\n  let l:max_width = \u0026columns\n  \" Start the right side of the tabline\n  let l:right = '%='\n\n  \" Add a separator\n  \" Reuse the TabType group for the right section\n  let l:right .= crystalline#Sep(1, 'TabFill', 'TabType')\n  \" Subtract the width of the separator\n  let l:max_width -= 1\n\n  \" Add a label indicating if vim or neovim is being used\n  let l:vimlabel = has('nvim') ?  ' NVIM ' : ' VIM '\n  let l:right .= l:vimlabel\n  \" Use strchars() to get the real visible width\n  let l:max_width -= strchars(l:vimlabel)\n\n  \" Reduce the number of max tabs to fit new tabline items\n  let l:max_tabs = 23\n\n  return crystalline#DefaultTabline({ 'max_tabs': l:max_tabs, 'max_width': l:max_width }) . l:right\nendfunction\n\nset showtabline=2\nset guioptions-=e\n```\n\n### Full Example\n\n```vim\nfunction! g:GroupSuffix()\n  if mode() ==# 'i' \u0026\u0026 \u0026paste\n    return '2'\n  endif\n  if \u0026modified\n    return '1'\n  endif\n  return ''\nendfunction\n\nfunction! g:CrystallineStatuslineFn(winnr)\n  let g:crystalline_group_suffix = g:GroupSuffix()\n  let l:curr = a:winnr == winnr()\n  let l:s = ''\n\n  if l:curr\n    let l:s .= crystalline#ModeSection(0, 'A', 'B')\n  else\n    let l:s .= crystalline#HiItem('Fill')\n  endif\n  let l:s .= ' %f%h%w%m%r '\n  if l:curr\n    let l:s .= crystalline#Sep(0, 'B', 'Fill') . ' %{fugitive#Head()}'\n  endif\n\n  let l:s .= '%='\n  if l:curr\n    let l:s .= crystalline#Sep(1, 'Fill', 'B') . '%{\u0026paste ? \" PASTE \" : \" \"}'\n    let l:s .= crystalline#Sep(1, 'B', 'A')\n  endif\n  if winwidth(a:winnr) \u003e 80\n    let l:s .= ' %{\u0026ft} %l/%L %2v '\n  else\n    let l:s .= ' '\n  endif\n\n  return l:s\nendfunction\n\nfunction! g:CrystallineTablineFn()\n  let l:max_width = \u0026columns\n  let l:right = '%='\n\n  let l:right .= crystalline#Sep(1, 'TabFill', 'TabType')\n  let l:max_width -= 1\n\n  let l:vimlabel = has('nvim') ?  ' NVIM ' : ' VIM '\n  let l:right .= l:vimlabel\n  let l:max_width -= strchars(l:vimlabel)\n\n  let l:max_tabs = 23\n\n  return crystalline#DefaultTabline({\n        \\ 'enable_sep': 1,\n        \\ 'max_tabs': l:max_tabs,\n        \\ 'max_width': l:max_width\n        \\ }) . l:right\nendfunction\n\nset showtabline=2\nset guioptions-=e\nset laststatus=2\nlet g:crystalline_auto_prefix_groups = 1\n```\n\n## More Info\n\nSee [`:help crystalline`](https://raw.githubusercontent.com/rbong/vim-crystalline/master/doc/crystalline.txt) for more information.\n\nDon't hesitate to [start a discussion](https://github.com/rbong/vim-crystalline/discussions/new/choose) if you have any questions or suggestions\nor [post an issue](https://github.com/rbong/vim-crystalline/issues/new) if you encounter any bugs.\n\nFeel free to [make a pull request](https://github.com/rbong/vim-crystalline/pulls) if you'd like to to contribute.\nIt's much appreciated.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbong%2Fvim-crystalline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbong%2Fvim-crystalline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbong%2Fvim-crystalline/lists"}