Top Related Projects
A Vim plugin for visually displaying indent levels in code
Indent guides for Neovim
An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc. on the fly for both vim and neovim.
fzf :heart: vim
A tree explorer plugin for vim.
Quick Overview
Yggdroot/indentLine is a Vim plugin that displays vertical lines to visually represent indentation in code. It helps developers easily identify and maintain proper indentation levels, improving code readability and structure. The plugin supports various file types and offers customization options for appearance and behavior.
Pros
- Enhances code readability by clearly visualizing indentation levels
- Supports multiple file types and can be customized for specific languages
- Offers various configuration options for line appearance and behavior
- Lightweight and easy to install
Cons
- May slightly impact Vim performance, especially on larger files
- Can be visually distracting for some users, particularly with certain color schemes
- Occasional conflicts with other plugins or syntax highlighting
- Limited functionality compared to more comprehensive code formatting tools
Getting Started
To install indentLine using Vim-Plug, add the following line to your .vimrc
file:
Plug 'Yggdroot/indentLine'
Then run :PlugInstall
in Vim.
To enable the plugin, add this line to your .vimrc
:
let g:indentLine_enabled = 1
Customize the appearance with options like:
let g:indentLine_char = '┊'
let g:indentLine_color_term = 239
Restart Vim or source your .vimrc
to apply changes.
Competitor Comparisons
A Vim plugin for visually displaying indent levels in code
Pros of vim-indent-guides
- Offers more customization options for indent visualization
- Supports both color and pattern-based indent guides
- Allows toggling indent guides on/off with a keyboard shortcut
Cons of vim-indent-guides
- May have a slight performance impact on larger files
- Requires more configuration to achieve desired appearance
- Less frequently updated compared to indentLine
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
indentLine:
let g:indentLine_char = '┊'
let g:indentLine_setColors = 0
let g:indentLine_color_term = 239
let g:indentLine_enabled = 1
Both plugins aim to improve code readability by visualizing indentation levels. indentLine is generally simpler to set up and use out of the box, while vim-indent-guides offers more customization options for users who want fine-grained control over the appearance of indent guides. indentLine tends to have a lower performance impact, especially on larger files, making it a good choice for users prioritizing speed. vim-indent-guides, on the other hand, provides more visual options and the ability to toggle guides on and off easily, which can be beneficial for users who frequently switch between different indentation styles or languages.
Indent guides for Neovim
Pros of indent-blankline.nvim
- Supports Neovim-specific features and optimizations
- Offers more customization options, including custom indent characters
- Provides better performance, especially for large files
Cons of indent-blankline.nvim
- Requires Neovim, limiting compatibility with older Vim versions
- May have a steeper learning curve due to more configuration options
Code Comparison
indentLine:
let g:indentLine_char = '┊'
let g:indentLine_setColors = 0
let g:indentLine_color_term = 239
indent-blankline.nvim:
require("indent_blankline").setup {
char = "┊",
show_trailing_blankline_indent = false,
show_first_indent_level = true,
use_treesitter = true,
show_current_context = true
}
The code comparison shows that indent-blankline.nvim uses Lua for configuration, offering more granular control over its behavior. It also integrates with Neovim's Treesitter for improved accuracy and performance. indentLine, on the other hand, uses Vim script for configuration, which is simpler but less flexible.
Both plugins achieve similar results, but indent-blankline.nvim provides more advanced features and customization options at the cost of Neovim-only compatibility and potentially more complex setup.
An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc. on the fly for both vim and neovim.
Pros of LeaderF
- Powerful and fast fuzzy finder for files, buffers, and more
- Extensible plugin architecture for custom sources
- Asynchronous search for improved performance
Cons of LeaderF
- Steeper learning curve due to more complex functionality
- Requires more configuration to fully utilize its features
- Larger codebase and potentially higher resource usage
Code Comparison
indentLine:
let g:indentLine_char = '┊'
let g:indentLine_color_term = 239
let g:indentLine_enabled = 1
LeaderF:
let g:Lf_ShortcutF = '<C-P>'
let g:Lf_WindowPosition = 'popup'
let g:Lf_PreviewInPopup = 1
let g:Lf_StlSeparator = { 'left': "\ue0b0", 'right': "\ue0b2" }
Summary
indentLine is a simple, lightweight plugin focused on displaying indent lines in code. It's easy to set up and use, with minimal configuration required. LeaderF, on the other hand, is a more comprehensive fuzzy finder plugin with advanced features for file and buffer navigation. While LeaderF offers more functionality, it also requires more setup and has a steeper learning curve. The choice between the two depends on whether you need a simple indent visualization tool or a powerful fuzzy finder for your workflow.
fzf :heart: vim
Pros of fzf.vim
- Powerful fuzzy finding capabilities for files, buffers, and more
- Highly customizable with extensive configuration options
- Integrates well with other Vim plugins and workflows
Cons of fzf.vim
- Steeper learning curve due to its many features and options
- Requires external dependencies (fzf binary)
- May impact performance on larger codebases or slower systems
Code Comparison
indentLine:
let g:indentLine_char = '┊'
let g:indentLine_color_term = 239
let g:indentLine_enabled = 1
fzf.vim:
nnoremap <C-p> :Files<CR>
nnoremap <Leader>b :Buffers<CR>
let g:fzf_layout = { 'down': '~40%' }
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
Summary
indentLine is a simple plugin focused on displaying indent guides, while fzf.vim is a comprehensive fuzzy finder with extensive functionality. indentLine is easier to set up and use, but fzf.vim offers more powerful features for navigating and searching within projects. The choice between them depends on whether you prioritize visual indent guides or advanced file and buffer navigation capabilities.
A tree explorer plugin for vim.
Pros of NERDTree
- Provides a full-featured file system explorer within Vim
- Allows for easy navigation and manipulation of directory structures
- Supports bookmarks and custom mappings for enhanced workflow
Cons of NERDTree
- Can be resource-intensive, especially for large projects
- May clutter the Vim interface, taking up screen space
- Has a steeper learning curve compared to simpler plugins
Code Comparison
NERDTree (file explorer functionality):
:NERDTree
:NERDTreeToggle
:NERDTreeFind
indentLine (indentation visualization):
let g:indentLine_char = '┊'
let g:indentLine_enabled = 1
let g:indentLine_color_term = 239
While NERDTree focuses on file system exploration and management, indentLine is specifically designed to visualize indentation levels in code. NERDTree offers a more comprehensive set of features for file navigation, while indentLine provides a simpler, focused solution for improving code readability through indentation guides.
NERDTree is better suited for users who frequently work with complex project structures and need advanced file management capabilities within Vim. indentLine, on the other hand, is ideal for developers who prioritize clean code visualization and want a lightweight solution for displaying indentation levels.
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
indentLine
This plugin is used for displaying thin vertical lines at each indentation level for code indented with spaces. For code indented with tabs I think there is no need to support it, because you can use :set list lcs=tab:\|\ (here is a space)
.
Requirements
This plugin takes advantage of the newly provided conceal
feature in Vim 7.3, so this plugin will not work with lower versions of Vim.
MacOS users: The copy of Vim provided in MacOS may not have the conceal feature enabled (check with echo has('conceal')
), which will prevent the plugin from loading. To fix this, we recommend using the homebrew version of Vim.
Installation
If you are using VIM version 8 or higher you can use its built-in package management; see :help packages
for more information. Just run these commands in your terminal:
git clone https://github.com/Yggdroot/indentLine.git ~/.vim/pack/vendor/start/indentLine
vim -u NONE -c "helptags ~/.vim/pack/vendor/start/indentLine/doc" -c "q"
Otherwise, these are some of the other options:
-
To install the plugin just put the plugin files in your
~/.vim
(Linux) or~/vimfiles
(Windows). -
If you use a plugin manager you can put the whole directory into your
~/.vim/bundle/
directory (Pathogen) or add the linePlugin 'Yggdroot/indentLine'
to your.vimrc
(Vundle).
Customization
To apply customization, apply the variable definitions to your .vimrc
file.
Change Character Color
indentLine will overwrite 'conceal' color with grey by default. If you want to highlight conceal color with your colorscheme, disable by:
let g:indentLine_setColors = 0
Or you can use the same colors as another highlight group. To use the same colors that are used for tab indents, use the 'SpecialKey' group:
let g:indentLine_defaultGroup = 'SpecialKey'
Or you can customize conceal color by:
" Vim
let g:indentLine_color_term = 239
" GVim
let g:indentLine_color_gui = '#A4E57E'
" none X terminal
let g:indentLine_color_tty_light = 7 " (default: 4)
let g:indentLine_color_dark = 1 " (default: 2)
" Background (Vim, GVim)
let g:indentLine_bgcolor_term = 202
let g:indentLine_bgcolor_gui = '#FF5F00'
Change Indent Char
Vim and GVim
let g:indentLine_char = 'c'
where 'c'
can be any ASCII character. You can also use one of ¦
, â
, â
, â¸
, or â
to display more beautiful lines. However, these characters will only work with files whose encoding is UTF-8.
or
let g:indentLine_char_list = ['|', '¦', 'â', 'â']
each indent level has a distinct character.
Change Conceal Behaviour
This plugin enables the Vim conceal
feature which automatically hides stretches of text based on syntax highlighting. This setting will apply to all syntax items.
For example, users utilizing the built in json.vim syntax file will no longer see quotation marks in their JSON files (see below how to disable conceal for JSON without disabling indentLine).
indentLine will overwrite your "concealcursor" and "conceallevel" with default value:
let g:indentLine_concealcursor = 'inc'
let g:indentLine_conceallevel = 2
You can customize these settings, but the plugin will not function if conceallevel
is not set to 1 or 2.
If you want to keep your conceal setting, put this line to your vim dotfile:
let g:indentLine_setConceal = 0
See the VIM Reference Manual for more information on the conceal
feature.
Disabling conceal for JSON and Markdown without disabling indentLine plugin
Even though this plugin requires conceal to be enabled for it to work, it is possible to disable conceal for JSON and Markdown files and still get the indentLine plugin to show indent lines for those files.
Builtin json.vim and markdown.vim syntax allow disabling conceal by setting the following vars:
- JSON
let g:vim_json_conceal=0
- Markdown
let g:markdown_syntax_conceal=0
If you use other syntax plugins for those file types, you will need to check their docs, as they may use different vars or have different ways to configure this.
Disable by default
let g:indentLine_enabled = 0
Commands
:IndentLinesToggle
toggles lines on and off.
Font patching
If you find all the standard unicode and ASCII characters too obtrusive, you might consider patching your font with the indentLine-dotted-guide.eps glyph provided. FontForge makes the process amazingly simple:
- Download and install FontForge.
- Locate and open your terminal/gVim font.
- Open the font in FontForge, choose Goto from the View menu and select Private Use Area from the drop down box.
- In the private use area, locate a blank spot for the glyph. Make a note of the code, e.g.
U+E0A3
. - Double-click the selected code point to open the font drawing tool.
- From the File menu, select Import... and locate the indentLine-dotted-guide.eps file.
- Once imported, choose File -> Generate Fonts and choose a location and file type for the new font.
Once completed, your new font will contain the more subtle dotted guide and all you have to do is set that glyph to g:indentLine_char
in your .vimrc
file.
Self promotion
If you think this script is helpful, follow the GitHub repository, and don't forget to vote for it on Vim.org! (vimscript #4354).
Screenshots
Vertical bars
Patched font
Leading Spaces
License
- MIT
Top Related Projects
A Vim plugin for visually displaying indent levels in code
Indent guides for Neovim
An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc. on the fly for both vim and neovim.
fzf :heart: vim
A tree explorer plugin for vim.
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