Top Related Projects
A Vim plugin for visually displaying indent levels in code
A vim plugin to display the indention levels with thin vertical lines
Indent guides for Neovim
Quick Overview
Vim-indent-guides is a Vim plugin that visually displays indent levels in code. It adds alternating color patterns to the indentation of your code, making it easier to distinguish different levels of indentation and improving code readability.
Pros
- Enhances code readability by visually distinguishing indent levels
- Customizable colors and indent sizes
- Works with both spaces and tabs for indentation
- Lightweight and easy to install
Cons
- May not be necessary for all coding styles or languages
- Can potentially clash with other color schemes or plugins
- Requires manual configuration for optimal appearance in some cases
- May slightly impact Vim's performance in very large files
Code Examples
" Enable indent guides
:IndentGuidesEnable
" Disable indent guides
:IndentGuidesDisable
" Toggle indent guides
:IndentGuidesToggle
" Set custom colors for indent guides
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
" Configure indent guide size and start level
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
Getting Started
- Install the plugin using your preferred Vim plugin manager. For example, with vim-plug:
Plug 'preservim/vim-indent-guides'
- Add the following to your
.vimrc
:
" Enable indent guides by default
let g:indent_guides_enable_on_vim_startup = 1
" Customize colors (optional)
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#3c3836 ctermbg=236
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#504945 ctermbg=239
" Set guide size (optional)
let g:indent_guides_guide_size = 1
- Restart Vim or source your
.vimrc
file.
Competitor Comparisons
A Vim plugin for visually displaying indent levels in code
Pros of vim-indent-guides
- Highly customizable appearance with various color schemes
- Supports both space and tab indentation
- Provides options for different indent sizes and start levels
Cons of vim-indent-guides
- May have performance issues with large files
- Can be visually distracting for some users
- Requires manual configuration for optimal appearance
Code Comparison
vim-indent-guides:
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
let g:indent_guides_color_change_percent = 3
vim-indent-guides:
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
let g:indent_guides_color_change_percent = 3
As the repositories being compared are the same, there is no difference in the code examples. Both plugins use identical configuration options and syntax.
Summary
Since the comparison is between the same repository (preservim/vim-indent-guides), there are no actual differences to highlight. The pros and cons listed apply to the vim-indent-guides plugin in general, rather than comparing two distinct repositories. The plugin offers customizable indent guides for Vim, with the benefits of flexibility and visual aid, but may have some drawbacks in terms of performance and potential visual clutter.
A vim plugin to display the indention levels with thin vertical lines
Pros of indentLine
- Lightweight and faster performance
- Supports both vertical lines and custom characters for indentation
- Works well with both light and dark color schemes
Cons of indentLine
- Less customizable in terms of appearance
- May not work as well with certain file types or complex indentation structures
Code Comparison
vim-indent-guides:
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
indentLine:
let g:indentLine_char = '┊'
let g:indentLine_color_term = 239
let g:indentLine_color_gui = '#A4E57E'
Summary
indentLine offers a simpler, more lightweight solution for visualizing indentation in Vim. It provides vertical lines or custom characters to represent indentation levels, which can be easier to read for some users. The plugin works well with various color schemes and has good performance.
However, vim-indent-guides offers more customization options, allowing users to set different colors for odd and even indent levels. It may also handle complex indentation structures better in certain file types.
Both plugins serve the purpose of improving code readability by visualizing indentation, but they differ in their approach and level of customization. The choice between them depends on personal preference and specific needs.
Indent guides for Neovim
Pros of indent-blankline.nvim
- Written in Lua, offering better performance and integration with Neovim
- Supports treesitter for more accurate indentation
- Provides more customization options, including different styles for each indent level
Cons of indent-blankline.nvim
- Requires Neovim 0.5+, not compatible with Vim or older Neovim versions
- May have a steeper learning curve due to more configuration options
Code Comparison
vim-indent-guides:
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
indent-blankline.nvim:
require("indent_blankline").setup {
show_current_context = true,
show_current_context_start = true,
char = "▏",
}
Both plugins aim to improve code readability by visualizing indentation levels. vim-indent-guides is a more established plugin with broader compatibility, while indent-blankline.nvim offers enhanced features and performance for Neovim users. The choice between them depends on your specific needs and environment.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Indent Guides
Indent Guides is a plugin for visually displaying indent levels in Vim.

Features:
- Can detect both tab and space indent styles.
- Automatically inspects your colorscheme and picks appropriate colors (gVim only).
- Will highlight indent levels with alternating colors.
- Full support for gVim and basic support for Terminal Vim.
- Seems to work on Windows gVim 7.3 (haven't done any extensive tests though).
- Customizable size for indent guides, eg. skinny guides (soft-tabs only).
- Customizable start indent level.
- Highlight support for files with a mixture of tab and space indent styles.
Requirements
- Vim 7.2+
Installation
To install the plugin copy autoload
, plugin
, doc
directories into your .vim
directory.
Pathogen
If you have Pathogen installed, clone this repo into a subdirectory of your .vim/bundle
directory like so:
cd ~/.vim/bundle
git clone git://github.com/preservim/vim-indent-guides.git
Vundle
If you have Vundle installed, add the following line to your ~/.vimrc
in the appropriate spot (see the Vundle.vim README for help):
Plugin 'nathanaelkane/vim-indent-guides'
and then run the following command from inside Vim:
:PluginInstall
Usage
The default mapping to toggle the plugin is <Leader>ig
.
You can also use the following commands inside Vim:
:IndentGuidesEnable
:IndentGuidesDisable
:IndentGuidesToggle
If you would like to have indent guides enabled by default, you can add the following to your ~/.vimrc
:
let g:indent_guides_enable_on_vim_startup = 1
gVim
This plugin should work with gVim out of the box, no configuration needed. It will automatically inspect your colorscheme and pick appropriate colors.
Setting custom indent colors
Here's an example of how to define custom colors instead of using the ones the plugin automatically generates for you. Add this to your .vimrc
file:
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
Alternatively you can add the following lines to your colorscheme file.
hi IndentGuidesOdd guibg=red ctermbg=3
hi IndentGuidesEven guibg=green ctermbg=4
Terminal Vim
At the moment Terminal Vim only has basic support. This means is that colors won't be automatically calculated based on your colorscheme. Instead, some preset colors are used depending on whether background
is set to dark
or light
.
When set background=dark
is used, the following highlight colors will be defined:
hi IndentGuidesOdd ctermbg=black
hi IndentGuidesEven ctermbg=darkgrey
Alternatively, when set background=light
is used, the following highlight colors will be defined:
hi IndentGuidesOdd ctermbg=white
hi IndentGuidesEven ctermbg=lightgrey
If for some reason it's incorrectly defining light highlight colors instead of dark ones or vice versa, the first thing you should check is that the background
value is being set correctly for your colorscheme. Sometimes it's best to manually set the background
value in your .vimrc
, for example:
colorscheme desert256
set background=dark
Alternatively you can manually setup the highlight colors yourself, see :help indent_guides_auto_colors
for an example.
Help
:help indent-guides
Screenshots



Top Related Projects
A Vim plugin for visually displaying indent levels in code
A vim plugin to display the indention levels with thin vertical lines
Indent guides for Neovim
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot