sponsor Vim development Vim logo Vim Book Ad

Indent Guides : A plugin for visually displaying indent levels in Vim.

 script karma  Rating 293/126, Downloaded by 11027  Comments, bugs, improvements  Vim wiki

created by
Nate Kane
script type
Indent Guides is a plugin for visually displaying indent levels in Vim.

- 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.
- NEW: Highlight support for files with a mixture of tab and space indent styles.

The default mapping to toggle the plugin is `<Leader>ig`

This plugin should work with gVim out of the box, no configuration needed. It will automatically inspect your colorscheme and pick appropriate 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

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 IndentGuidesEven ctermbg=darkgrey
  hi IndentGuidesOdd  ctermbg=black

Alternatively, when `set background=light` is used, the following highlight colors will be defined:
  hi IndentGuidesEven ctermbg=lightgrey
  hi IndentGuidesOdd  ctermbg=white

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.


install details
To install the plugin just copy `autoload`, `plugin`, `doc` directories into your `.vim` directory.

Alternatively if you have Pathogen installed, just clone this repo into a subdirectory of your `.vim/bundle` directory like so:
cd ~/.vim/bundle
git clone git://github.com/nathanaelkane/vim-indent-guides.git

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
indent-guides-1.7.tar.gz 1.7 2013-03-07 7.0 Nate Kane - Added way to override the default mapping (thanks xuhdev).
- Added option g:indent_guides_exclude_filetypes to specify a list of filetypes to disable the plugin for.
- Disable the plugin when in a diff.
- Various bug fixes.
indent-guides-1.6.tar.gz 1.6 2012-01-01 7.0 Nate Kane - Added option `g:indent_guides_space_guides` to control whether spaces are considered as indention (thanks scoz).
- Fixed E803 ID not found spam (thanks mutewinter).
- Fixed str2float issue with Vim 7.1 (thanks acx0).
indent-guides-1.5.tar.gz 1.5 2011-03-13 7.0 Nate Kane - Added highlight support for files with a mixture of tab and space indent styles (thanks graywh).
- Added -bar to all the :commands so they can chain with other :commands (thanks to graywh).
- No longer overriding pre-defined custom highlight colors (thanks graywh).
- Using str2float to work around a float bug in some versions of Vim 7.2 (thanks voidus).
indent-guides-1.4.tar.gz 1.4 2011-02-06 7.0 Nate Kane - Added the new plugin option `g:indent_guides_enable_on_vim_startup`.
- Improved Windows support.
indent-guides-1.3.tar.gz 1.3 2011-01-17 7.0 Nate Kane - Changed the default value of g:indent_guides_color_change_percent to 10.
- Added support for gVim themes that don't specify a `hi Normal guibg` color.
indent-guides-1.2.tar.gz 1.2 2011-01-10 7.0 Nate Kane - Customizable size for indent guides, eg. skinny guides (soft-tabs only).
- Customizable start indent level.
- Refactored some internal logic.
indent-guides-1.1.tar.gz 1.1 2010-12-29 7.0 Nate Kane - Added basic support for terminal vim. See `:help indent-guides-terminal-vim` for more information.
- Cut down on rgb to hex color conversions by adding a big dictionary of color names and hex codes.
- Various bug fixes.
indent-guides-1.0.tar.gz 1.0 2010-12-12 7.2 Nate Kane Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.