All Projects → thiagoalessio → Rainbow_levels.vim

thiagoalessio / Rainbow_levels.vim

Licence: mit
A different approach to code highlighting.

Projects that are alternatives of or similar to Rainbow levels.vim

Vim Systemd Syntax
Syntax highlighting for systemd service files in Vim.
Stars: ✭ 57 (-86.27%)
Mutual labels:  vim-plugin, syntax-highlighting
Splitjoin.vim
Switch between single-line and multiline forms of code
Stars: ✭ 1,383 (+233.25%)
Mutual labels:  refactoring, vim-plugin
Vim Js
💯The most accurate syntax highlighting plugin for JavaScript and Flow.js
Stars: ✭ 99 (-76.14%)
Mutual labels:  vim-plugin, syntax-highlighting
Dhall Vim
Syntax highlighting for Dhall
Stars: ✭ 51 (-87.71%)
Mutual labels:  vim-plugin, syntax-highlighting
vim-smt2
A VIM plugin that adds support for the SMT-LIB2 format (including Z3's extensions)
Stars: ✭ 35 (-91.57%)
Mutual labels:  syntax-highlighting, vim-plugin
Vim Gdscript3
Syntax highlighting and completion for GDScript 3
Stars: ✭ 121 (-70.84%)
Mutual labels:  vim-plugin, syntax-highlighting
Kuroi.vim
A dark Vim colorscheme
Stars: ✭ 174 (-58.07%)
Mutual labels:  vim-plugin, syntax-highlighting
Tagalong.vim
Change an HTML(ish) opening tag and take the closing one along as well
Stars: ✭ 184 (-55.66%)
Mutual labels:  refactoring, vim-plugin
clojure.vim
Clojure syntax highlighting for Vim and Neovim.
Stars: ✭ 23 (-94.46%)
Mutual labels:  syntax-highlighting, vim-plugin
vim-log-highlighting
Syntax highlighting for generic log files in VIM
Stars: ✭ 164 (-60.48%)
Mutual labels:  syntax-highlighting, vim-plugin
Sideways.vim
A Vim plugin to move function arguments (and other delimited-by-something items) left and right.
Stars: ✭ 370 (-10.84%)
Mutual labels:  refactoring, vim-plugin
stan-vim
A Vim plugin for the Stan probabilistic programming language.
Stars: ✭ 41 (-90.12%)
Mutual labels:  syntax-highlighting, vim-plugin
Vim Crystal
Vim filetype and tools support for Crystal language.
Stars: ✭ 326 (-21.45%)
Mutual labels:  vim-plugin, syntax-highlighting
Highlight
Rich featured syntax highlighter for Keynote slides.
Stars: ✭ 367 (-11.57%)
Mutual labels:  syntax-highlighting
Godoctor
Go Doctor - The Golang Refactoring Engine
Stars: ✭ 387 (-6.75%)
Mutual labels:  refactoring
Spacevim
Spacemacs for vim
Stars: ✭ 366 (-11.81%)
Mutual labels:  vim-plugin
Clang Tools Extra
Mirror kept for legacy. Moved to https://github.com/llvm/llvm-project
Stars: ✭ 358 (-13.73%)
Mutual labels:  refactoring
Vim Windowswap
Swap your windows without ruining your layout
Stars: ✭ 405 (-2.41%)
Mutual labels:  vim-plugin
Lens.vim
A Vim Automatic Window Resizing Plugin
Stars: ✭ 381 (-8.19%)
Mutual labels:  vim-plugin
Sharpen
Visual Studio extension that intelligently introduces new C# features into your existing codebase
Stars: ✭ 351 (-15.42%)
Mutual labels:  refactoring
rainbow_levels.vim

Rainbow Levels

A different approach to code highlighting.

CI Code Coverage Version Docs Join the chat

This plugin highlights code by indentation level instead of language syntax.
It is specially useful when dealing with deeply nested code or callback hells.

Screenshot

Rainbow Levels Screenshot

Usage

This plugin exposes three self-explanatory commands:

  • :RainbowLevelsOn
  • :RainbowLevelsOff
  • :RainbowLevelsToggle

And you can use them in a variety of ways, for example:

" Creating a mapping to turn it on and off:
map <leader>l :RainbowLevelsToggle<cr>

" Or automatically turning it on for certain file types:
autocmd Filetype * if index(['javascript', 'python', 'php', 'xml', 'yaml'], &ft) | call rainbow_levels#on() | else | call rainbow_levels#off() | endif

Customization

To customize the levels you just need to define highlight groups whith the name RainbowLevelsN, where N is the number of the level.

By default this plugin defines 7 highlight groups, simply linking to common existing highlight groups, in order to respect your colorscheme.

But you are free to define as many levels you wish. Check the examples below and also the User-Contributed Themes page for inspiration.

Examples

Jellybeans Rainbow

Using groups defined by Jellybeans colorscheme in a "rainbow" sequence.

hi! link RainbowLevel0 Constant
hi! link RainbowLevel1 Type
hi! link RainbowLevel2 Function
hi! link RainbowLevel3 String
hi! link RainbowLevel4 PreProc
hi! link RainbowLevel5 Statement
hi! link RainbowLevel6 Identifier
hi! link RainbowLevel7 Normal
hi! link RainbowLevel8 Comment

Background Only

Want to keep syntax highlight? No problem! You can change only the background colors instead.

hi! RainbowLevel0 ctermbg=240 guibg=#585858
hi! RainbowLevel1 ctermbg=239 guibg=#4e4e4e
hi! RainbowLevel2 ctermbg=238 guibg=#444444
hi! RainbowLevel3 ctermbg=237 guibg=#3a3a3a
hi! RainbowLevel4 ctermbg=236 guibg=#303030
hi! RainbowLevel5 ctermbg=235 guibg=#262626
hi! RainbowLevel6 ctermbg=234 guibg=#1c1c1c
hi! RainbowLevel7 ctermbg=233 guibg=#121212
hi! RainbowLevel8 ctermbg=232 guibg=#080808

Cycle colors

Using a loop to automate the tedious work of defining all highlight groups.

for level in range(0, 10, 2)
  exe 'hi! RainbowLevel'.level.' guifg=magenta'
  exe 'hi! RainbowLevel'.(level+1).' guifg=cyan'
endfor





Level Alert

Nothing shows up until a certain threshold, warning you that the code is going too deep.

hi! RainbowLevel0 guibg=none guifg=none
hi! RainbowLevel2 guibg=none guifg=none
hi! RainbowLevel3 guibg=none guifg=none
hi! RainbowLevel4 guibg=none guifg=none
hi! link RainbowLevel5 WarningMsg
for level in range(6, 10)
  exe 'hi! link RainbowLevel'.level.' ErrorMsg'
endfor

Special Thanks

Where to get help

Join the chat at https://gitter.im/thiagoalessio/rainbow_levels.vim

Bugs

Please report any bugs you may find on the GitHub issue tracker: http://github.com/thiagoalessio/rainbow_levels.vim/issues

License

rainbow_levels.vim is released under the MIT License.

Made with love in Berlin

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].