{"id":17383819,"url":"https://github.com/sunaku/vim-modusline","last_synced_at":"2025-04-14T07:40:48.376Z","repository":{"id":53929862,"uuid":"152702233","full_name":"sunaku/vim-modusline","owner":"sunaku","description":":rainbow: Mode-specific statusline colors","archived":false,"fork":false,"pushed_at":"2018-10-16T04:39:12.000Z","size":107,"stargazers_count":39,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T21:15:05.668Z","etag":null,"topics":["colorization","statusline","vim-plugins"],"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/sunaku.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}},"created_at":"2018-10-12T06:10:32.000Z","updated_at":"2022-08-06T12:53:28.000Z","dependencies_parsed_at":"2022-08-13T04:40:40.453Z","dependency_job_id":null,"html_url":"https://github.com/sunaku/vim-modusline","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunaku%2Fvim-modusline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunaku%2Fvim-modusline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunaku%2Fvim-modusline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunaku%2Fvim-modusline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunaku","download_url":"https://codeload.github.com/sunaku/vim-modusline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248841571,"owners_count":21170210,"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":["colorization","statusline","vim-plugins"],"created_at":"2024-10-16T07:43:54.392Z","updated_at":"2025-04-14T07:40:48.346Z","avatar_url":"https://github.com/sunaku.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Modusline: Mode-specific statusline colors\n\nThis plugin adds mode-specific coloring to *your existing* statusline so you\ncan visually distinguish (screenshots below) which mode Vim is currently in.\n\n## Setup\n\nInstall this plugin using your favorite Vim plugin manager and restart Vim.\nNow change Vim modes and observe the statusline changing colors accordingly.\nThat's all! For customization, read about *Variables* and *Functions* below.\n\n### Preview\n\n![ 'n'      Normal mode               ](https://github.com/sunaku/vim-modusline/raw/gh-pages/n.png)\n![ 'no'     Operator-pending mode     ](https://github.com/sunaku/vim-modusline/raw/gh-pages/no.png)\n![ 'v'      Visual mode, by character ](https://github.com/sunaku/vim-modusline/raw/gh-pages/v.png)\n![ 'V'      Visual mode, by line      ](https://github.com/sunaku/vim-modusline/raw/gh-pages/V.png)\n![ \u003cC-V\u003e    Visual mode, blockwise    ](https://github.com/sunaku/vim-modusline/raw/gh-pages/C-V.png)\n![ 's'      Select mode, by character ](https://github.com/sunaku/vim-modusline/raw/gh-pages/s.png)\n![ 'S'      Select mode, by line      ](https://github.com/sunaku/vim-modusline/raw/gh-pages/S.png)\n![ \u003cC-S\u003e    Select mode, blockwise    ](https://github.com/sunaku/vim-modusline/raw/gh-pages/C-S.png)\n![ 'i'      Insert mode               ](https://github.com/sunaku/vim-modusline/raw/gh-pages/i.png)\n![ 'ic'     Insert mode completion    ](https://github.com/sunaku/vim-modusline/raw/gh-pages/ic.png)\n![ 'R'      Replace mode              ](https://github.com/sunaku/vim-modusline/raw/gh-pages/R.png)\n![ 'Rc'     Replace mode completion   ](https://github.com/sunaku/vim-modusline/raw/gh-pages/Rc.png)\n![ 'Rv'     Replace mode virtual      ](https://github.com/sunaku/vim-modusline/raw/gh-pages/Rv.png)\n![ 'c'      Command mode              ](https://github.com/sunaku/vim-modusline/raw/gh-pages/c.png)\n![ 't'      Terminal mode             ](https://github.com/sunaku/vim-modusline/raw/gh-pages/t.png)\n\n## Variables\n\nYou can redefine any of these variables per your customization needs.\n\n### `\u0026statusline`\n\nYou can define your own custom statusline (the default one is shown below)\nand this plugin will automatically add mode-specific colors \u0026 labels to it.\n\nBy default, this variable is defined as follows, unless you override it:\n\n```vim\nset statusline=%\u003c%f\\ %h%m%r%=%-14.(%l,%c%V%)\\ %P\n```\n\n### `g:modusline_set_ls`\n\nYou can assign 0 to this variable to prevent this plugin from changing the\n`laststatus` setting to always show the statusline for bottom-most windows:\n\n```vim\nlet g:modusline_set_ls = 0\n```\n\n### `g:modusline_colors`\n\nA dictionary that maps `mode()` values to `%#HLname#` statusline colors.\nIf there is no entry for a particular `mode()` value in the dictionary,\nthen this plugin falls back to using jarring `%#ErrorMsg#` as the color.\n\nFor a list of possible _HLname_ values, run the Vim `:highlight` command.\n\nBy default, this variable is defined as follows, unless you override it:\n\n```vim\nlet g:modusline_colors           = {}              \" see :help mode()\nlet g:modusline_colors['n']      = ''              \" Normal\nlet g:modusline_colors['no']     = '%#DiffChange#' \" Operator-pending\nlet g:modusline_colors['v']      = '%#DiffText#'   \" Visual by character\nlet g:modusline_colors['V']      = '%#DiffText#'   \" Visual by line\nlet g:modusline_colors[\"\\\u003cC-V\u003e\"] = '%#DiffText#'   \" Visual blockwise\nlet g:modusline_colors['s']      = '%#WildMenu#'   \" Select by character\nlet g:modusline_colors['S']      = '%#WildMenu#'   \" Select by line\nlet g:modusline_colors[\"\\\u003cC-S\u003e\"] = '%#WildMenu#'   \" Select blockwise\nlet g:modusline_colors['i']      = '%#DiffAdd#'    \" Insert\nlet g:modusline_colors['R']      = '%#DiffDelete#' \" Replace |R|\nlet g:modusline_colors['Rv']     = '%#DiffDelete#' \" Virtual Replace |gR|\nlet g:modusline_colors['c']      = '%#Search#'     \" Command-line\nlet g:modusline_colors['cv']     = '%#MatchParen#' \" Vim Ex mode |gQ|\nlet g:modusline_colors['ce']     = '%#MatchParen#' \" Normal Ex mode |Q|\nlet g:modusline_colors['r']      = '%#Todo#'       \" Hit-enter prompt\nlet g:modusline_colors['rm']     = '%#Todo#'       \" The -- more -- prompt\nlet g:modusline_colors['r?']     = '%#Todo#'       \" A |:confirm| query of some sort\nlet g:modusline_colors['!']      = '%#IncSearch#'  \" Shell or external command is executing\nlet g:modusline_colors['t']      = '%#DiffAdd#'    \" Terminal mode: keys go to the job\nlet g:modusline_colors['ic']     = '%#DiffChange#' \" see :help ins-completion\nlet g:modusline_colors['Rc']     = '%#DiffChange#' \" see :help ins-completion\n```\n\n### `g:modusline_labels`\n\nA dictionary that maps `mode()` values to user-friendly labels (strings).\nIf there is no entry for a particular `mode()` value in the dictionary,\nthen this plugin falls back to using that `mode()` value as the label.\n\nBy default, this variable is defined as follows, unless you override it:\n\n```vim\nlet g:modusline_labels = {}\n```\n\n## Functions\n\nYou can redefine any of these functions per your customization needs.\n\n### `Modusline(statusline)`\n\nAdds mode-specific colors and labels to the given statusline and returns\na new statusline expression that you can assign via `:set statusline=`.\n\n```vim\nfunction! Modusline(statusline) abort\n  let modus = mode(1)\n  let color = ModuslineColor(modus)\n  let label = ModuslineLabel(modus)\n  return ModuslineMerge(a:statusline, modus, color, label)\nendfunction\n```\n\n### `ModuslineColor(modus)`\n\nReturns a `%#HLname#` statusline color for the given `mode()` value by\nreferencing the `g:modusline_colors` dictionary, as described earlier:\nIf there is no entry for a particular `mode()` value in the dictionary,\nthen this plugin falls back to using jarring `%#ErrorMsg#` as the color.\n\n```vim\nfunction! ModuslineColor(modus) abort\n  return get(g:modusline_colors, a:modus, '%#ErrorMsg#')\nendfunction\n```\n\n### `ModuslineLabel(modus)`\n\nReturns a user-friendly label (string) for the given `mode()` value by\nreferencing the `g:modusline_labels` dictionary, as described earlier:\nIf there is no entry for a particular `mode()` value in the dictionary,\nthen this plugin falls back to using that `mode()` value as the label.\n\n```vim\nfunction! ModuslineLabel(modus) abort\n  return get(g:modusline_labels, a:modus, a:modus)\nendfunction\n```\n\n### `ModuslineMerge(statusline, modus, color, label)`\n\nReturns a statusline expression built up from all the pieces passed in.\n\n```vim\nfunction! ModuslineMerge(statusline, modus, color, label) abort\n  return a:color .'‹'. a:label .'› '. a:statusline\nendfunction\n```\n\n## References\n\n* https://hackernoon.com/the-last-statusline-for-vim-a613048959b2\n* https://www.reddit.com/r/vim/comments/6b7b08/my_custom_statusline\n\n## License\n\n[Spare A Life]: https://sunaku.github.io/vegan-for-life.html\n\u003e Like my work? :+1:  Please [spare a life] today as thanks!\n:cow::pig::chicken::fish::speak_no_evil::v::revolving_hearts:\n\nCopyright 2018 Suraj N. Kurapati \u003chttps://github.com/sunaku\u003e\n\nDistributed under the same terms as Vim itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunaku%2Fvim-modusline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunaku%2Fvim-modusline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunaku%2Fvim-modusline/lists"}