All Projects → sunaku → vim-modusline

sunaku / vim-modusline

Licence: other
🌈 Mode-specific statusline colors

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to vim-modusline

Vim Devicons
Adds file type icons to Vim plugins such as: NERDTree, vim-airline, CtrlP, unite, Denite, lightline, vim-startify and many more
Stars: ✭ 4,473 (+11369.23%)
Mutual labels:  vim-plugins, statusline
Vim Arpeggio
Vim plugin: Mappings for simultaneously pressed keys
Stars: ✭ 216 (+453.85%)
Mutual labels:  vim-plugins
Stackanswers.vim
Vim plugin to fetch and display answers from Stack Overflow
Stars: ✭ 165 (+323.08%)
Mutual labels:  vim-plugins
Bullets.vim
🔫 Bullets.vim is a Vim/NeoVim plugin for automated bullet lists.
Stars: ✭ 199 (+410.26%)
Mutual labels:  vim-plugins
Exit Vim
Vim plugin that exits Vim on startup
Stars: ✭ 176 (+351.28%)
Mutual labels:  vim-plugins
Vim Vspec
Vim plugin: Testing framework for Vim script
Stars: ✭ 207 (+430.77%)
Mutual labels:  vim-plugins
Vim Operator User
Vim plugin: Define your own operator easily
Stars: ✭ 161 (+312.82%)
Mutual labels:  vim-plugins
vim-stylus
A better vim plugin for stylus, including proper and up-to-date syntax highligting, indentation and autocomplete
Stars: ✭ 49 (+25.64%)
Mutual labels:  vim-plugins
Is.vim
incremental search improved - successor of incsearch.vim
Stars: ✭ 209 (+435.9%)
Mutual labels:  vim-plugins
Vifm.vim
Vim plugin that allows use of vifm as a file picker
Stars: ✭ 197 (+405.13%)
Mutual labels:  vim-plugins
Vim Packager
Vim plugin manager that utilizes "jobs" and "pack" features.
Stars: ✭ 197 (+405.13%)
Mutual labels:  vim-plugins
Startuptime.vim
Breakdown Vim's --startuptime output
Stars: ✭ 180 (+361.54%)
Mutual labels:  vim-plugins
Vim Anyfold
Language agnostic vim plugin for folding and motion based on indentation.
Stars: ✭ 208 (+433.33%)
Mutual labels:  vim-plugins
Vim Shortcut
💇 Discoverable & searchable shortcuts for (Neo)Vim
Stars: ✭ 170 (+335.9%)
Mutual labels:  vim-plugins
Nerdtree
A tree explorer plugin for vim.
Stars: ✭ 16,380 (+41900%)
Mutual labels:  vim-plugins
Vim Dadbod Completion
Database autocompletion powered by https://github.com/tpope/vim-dadbod
Stars: ✭ 163 (+317.95%)
Mutual labels:  vim-plugins
Visual Split.vim
Vim plugin to control splits with visual selections or text objects
Stars: ✭ 190 (+387.18%)
Mutual labels:  vim-plugins
Vim Go
Go development plugin for Vim
Stars: ✭ 14,085 (+36015.38%)
Mutual labels:  vim-plugins
lsp spinner.nvim
neovim plugin to retrieve the name of the running LSP client(s) and display a spinner when there are wip job
Stars: ✭ 23 (-41.03%)
Mutual labels:  statusline
vim-searchant
searchant.vim is obsoleted by vim-searchhi
Stars: ✭ 55 (+41.03%)
Mutual labels:  vim-plugins

Modusline: Mode-specific statusline colors

This plugin adds mode-specific coloring to your existing statusline so you can visually distinguish (screenshots below) which mode Vim is currently in.

Setup

Install this plugin using your favorite Vim plugin manager and restart Vim. Now change Vim modes and observe the statusline changing colors accordingly. That's all! For customization, read about Variables and Functions below.

Preview

 'n'      Normal mode                'no'     Operator-pending mode      'v'      Visual mode, by character  'V'      Visual mode, by line       <C-V>    Visual mode, blockwise     's'      Select mode, by character  'S'      Select mode, by line       <C-S>    Select mode, blockwise     'i'      Insert mode                'ic'     Insert mode completion     'R'      Replace mode               'Rc'     Replace mode completion    'Rv'     Replace mode virtual       'c'      Command mode               't'      Terminal mode

Variables

You can redefine any of these variables per your customization needs.

&statusline

You can define your own custom statusline (the default one is shown below) and this plugin will automatically add mode-specific colors & labels to it.

By default, this variable is defined as follows, unless you override it:

set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P

g:modusline_set_ls

You can assign 0 to this variable to prevent this plugin from changing the laststatus setting to always show the statusline for bottom-most windows:

let g:modusline_set_ls = 0

g:modusline_colors

A dictionary that maps mode() values to %#HLname# statusline colors. If there is no entry for a particular mode() value in the dictionary, then this plugin falls back to using jarring %#ErrorMsg# as the color.

For a list of possible HLname values, run the Vim :highlight command.

By default, this variable is defined as follows, unless you override it:

let g:modusline_colors           = {}              " see :help mode()
let g:modusline_colors['n']      = ''              " Normal
let g:modusline_colors['no']     = '%#DiffChange#' " Operator-pending
let g:modusline_colors['v']      = '%#DiffText#'   " Visual by character
let g:modusline_colors['V']      = '%#DiffText#'   " Visual by line
let g:modusline_colors["\<C-V>"] = '%#DiffText#'   " Visual blockwise
let g:modusline_colors['s']      = '%#WildMenu#'   " Select by character
let g:modusline_colors['S']      = '%#WildMenu#'   " Select by line
let g:modusline_colors["\<C-S>"] = '%#WildMenu#'   " Select blockwise
let g:modusline_colors['i']      = '%#DiffAdd#'    " Insert
let g:modusline_colors['R']      = '%#DiffDelete#' " Replace |R|
let g:modusline_colors['Rv']     = '%#DiffDelete#' " Virtual Replace |gR|
let g:modusline_colors['c']      = '%#Search#'     " Command-line
let g:modusline_colors['cv']     = '%#MatchParen#' " Vim Ex mode |gQ|
let g:modusline_colors['ce']     = '%#MatchParen#' " Normal Ex mode |Q|
let g:modusline_colors['r']      = '%#Todo#'       " Hit-enter prompt
let g:modusline_colors['rm']     = '%#Todo#'       " The -- more -- prompt
let g:modusline_colors['r?']     = '%#Todo#'       " A |:confirm| query of some sort
let g:modusline_colors['!']      = '%#IncSearch#'  " Shell or external command is executing
let g:modusline_colors['t']      = '%#DiffAdd#'    " Terminal mode: keys go to the job
let g:modusline_colors['ic']     = '%#DiffChange#' " see :help ins-completion
let g:modusline_colors['Rc']     = '%#DiffChange#' " see :help ins-completion

g:modusline_labels

A dictionary that maps mode() values to user-friendly labels (strings). If there is no entry for a particular mode() value in the dictionary, then this plugin falls back to using that mode() value as the label.

By default, this variable is defined as follows, unless you override it:

let g:modusline_labels = {}

Functions

You can redefine any of these functions per your customization needs.

Modusline(statusline)

Adds mode-specific colors and labels to the given statusline and returns a new statusline expression that you can assign via :set statusline=.

function! Modusline(statusline) abort
  let modus = mode(1)
  let color = ModuslineColor(modus)
  let label = ModuslineLabel(modus)
  return ModuslineMerge(a:statusline, modus, color, label)
endfunction

ModuslineColor(modus)

Returns a %#HLname# statusline color for the given mode() value by referencing the g:modusline_colors dictionary, as described earlier: If there is no entry for a particular mode() value in the dictionary, then this plugin falls back to using jarring %#ErrorMsg# as the color.

function! ModuslineColor(modus) abort
  return get(g:modusline_colors, a:modus, '%#ErrorMsg#')
endfunction

ModuslineLabel(modus)

Returns a user-friendly label (string) for the given mode() value by referencing the g:modusline_labels dictionary, as described earlier: If there is no entry for a particular mode() value in the dictionary, then this plugin falls back to using that mode() value as the label.

function! ModuslineLabel(modus) abort
  return get(g:modusline_labels, a:modus, a:modus)
endfunction

ModuslineMerge(statusline, modus, color, label)

Returns a statusline expression built up from all the pieces passed in.

function! ModuslineMerge(statusline, modus, color, label) abort
  return a:color .''. a:label .''. a:statusline
endfunction

References

License

Like my work? 👍 Please spare a life today as thanks! 🐮🐷🐔🐟🙊✌️💞

Copyright 2018 Suraj N. Kurapati https://github.com/sunaku

Distributed under the same terms as Vim itself.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].