Code Monkey home page Code Monkey logo

vim-indent-guides's Introduction

Indent Guides

Vint

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

vim-indent-guides's People

Contributors

acx0 avatar alerque avatar dersaidin avatar dsummersl avatar gou4shi1 avatar graywh avatar jhogendorn avatar ksr-yasuda avatar leonardehrenfried avatar liskin avatar marabesi avatar mhaehnel avatar nathanaelkane avatar noscript avatar ryansouza avatar somini avatar suy avatar t99 avatar timoxley avatar wilywampa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-indent-guides's Issues

Indent-guides highlighting overrides CursorLine highlighting

If the option set cursorline is set in the vimrc, the current line is highlighted in vim. The highlight color of this can also be modified by issuing a hi CursorLine ctermbg=<desired color> in your vimrc. The issue is that on lines with indentation highlighted by indent-guides, the highlighting of the current line is overwritten by indent-guides highlighting at the beginning of the line where the indentation is.

This is not an issue for set cursorcolumn, as the highlighted column displays fine across all lines, including the portions highlighted by indent-guides.

I'm not sure, but this may be related to another reported issue ( #66 ). Not sure if it's possible to reduce the priority of highlighting of indent-guides to resolve issues like this or not.

If nothing else it would be cool if it could detect which line is currently selected, and change the tint of the indents on that line.

No effect for desert colorscheme

After I run :IndentGuidesEnable, there is no effect. But for the default colorscheme, everything works fine.

I had sent you an email when Indent-guides was just born. At that time, you give me the following 3 lines. I added them to vimrc, then everything would work, but for the current version it won't work.

let g:indent_guides_auto_colors = 0
hi IndentGuidesOdd  guibg=#212121
hi IndentGuidesEven guibg=#404040

I am using gvim on Linux. I'm using vim 7.3.

Thanks!

Error on autostart

Hi,

I have set this in my vimrc:

let g:indent_guides_start_level = 0
let g:indent_guides_guide_size = 1
let g:indent_guides_enable_on_vim_startup = 1

But, when I open a file or enter in a buffer, I have this error:

Error detected while processing function <SNR>37_IndentGuidesEnable..indent_guides#enable:
line   17:
E71: Invalid character after \%
Press ENTER or type command to continue
Error detected while processing function <SNR>37_IndentGuidesEnable..indent_guides#enable:
line   17:
E475: Invalid argument: ^\s*\%-3v\zs\s*\%-2v\ze
Press ENTER or type command to continue
Error detected while processing function <SNR>37_IndentGuidesEnable..indent_guides#enable:
line   19:
E71: Invalid character after \%
Press ENTER or type command to continue
Error detected while processing function <SNR>37_IndentGuidesEnable..indent_guides#enable:
line   19:
E475: Invalid argument: ^\t*\%-3v\zs\t*\%1v\ze
Press ENTER or type command to continue

I use Vim 7.3.682 on Fedora 17.

Is their a way to fix it?

Thanks by advance.

highlight group not found: Normal

This error appears when I enable indent-guides by <leader>ig

Error detected while processing function <SNR>22_IndentGuidesToggle..indent_guides#toggle..indent_guides#enable..indent_guides
#init_script_vars..indent_guides#capture_highlight:
line    2:
E411: highlight group not found: Normal
Press ENTER or type command to continue

The file content on which I'm enabling indent-guide

#!/usr/bin/env python

def helloworld():
    print "Hello World!"
    pass

helloworld  
$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jan  6 2012 15:24:46)
Included patches: 1-393
Modified by Gentoo-7.3.393
Compiled by root@localhost
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent 
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs 
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path 
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv 
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent 
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape 
+mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse 
+mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg 
+path_extra -perl +persistent_undo +postscript +printer +profile -python 
-python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent 
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup +X11 +xfontset -xim 
+xsmp_interact +xterm_clipboard -xterm_save 
   system vimrc file: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: x86_64-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -pipe -march=native -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: x86_64-pc-linux-gnu-gcc   -Wl,-O1 -Wl,--as-needed -L/usr/local/lib -Wl,--as-needed -o vim    -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -lnsl  -lcurses -lacl -lattr -ldl 

highlight colors not recognized with solarized

I use @altercation's solarized (dark) for my theme, and I can't get the highlights to be dark when background is set before colorscheme.

set background=dark
colorscheme solarized

yields

solarized light

where

colorscheme solarized
set background=dark

yields

solarized dark

I've tried setting

hi IndentGuidesEven ctermbg=black
hi IndentGuidesOdd ctermbg=darkgrey

but that doesn't work at all. You can see the relevant lines to my .vimrc here

Cursorline option

When using indent guides with cursorline enabled (:set cursorline), the indent guides show in front of the cursorline background.

It'd be great to have an option to show the cursorline background color in front of indent guides.

Differentiate between tabs and spaces (This is a request, not sure if possible)

I like the guide-size=1 look with spaces, but unfortunately this does not work when using tabs.

I have list set so my tabs do show up (So I can tell that some whitespace is made of tabs or not), I just would like to have some way of telling the indent-guides plugin to color tab based indentation differently from space-based indentation. For instance since only one character out of 4 will be highlighted with space-indentation the color can stand to be more prominent. However with tabs they are always fully colored so I'd like to configure a less prominent color for when they are tabs.

Indent using syntax highlighting?

When using the vim folding system, there is a setting to use the syntax highlighter to find the best folding areas.

I think if you could do the same for the indent guides, this would be very awesome. Currently the ident guides are implemented in a non intelligent way. They even occour if the indent is not used for grouping code, but for making the code better readable. The indent guides will distract me in that case .

spaces not recognized until 8 characters, then treated as tabs

I got my MacVim tweaked just the way I wanted on the Intel/Snow Leopard desktop. Decided to do the same thing to the PPC/Leopard laptop. So I copy .gvimrc and install my only plugin, indent guides. The end result: spaces are ignored until repeated 8 times, at which point it is color-coded like a tab (though navigation in vim still treats the whole "block" like a space and not a tab). Up until that point, there is no color coding.

Unfortunately, I can't say much about the CLI interface. :IndentGuidesToggle yields:

Error detected while processing function3_IndentGuidesToggle..indent_guides#enable..indent_guides#init_script_vars..indent_guides#capture_highlight:
line    2:
E411: highlight group not found: Normal

Appropriate :lets--

indent_guides_color_name_guibg_pattern  guibg='\?\zs[0-9A-Za-z ]\+\ze'\?
loaded_indent_guides  #1
indent_guides_color_hex_guibg_pattern  guibg=\zs#[0-9A-Fa-f]\{6\}\ze
indent_guides_auto_colors #0
indent_guides_start_level #1
indent_guides_color_hex_pattern  #[0-9A-Fa-f]\{6\}
indent_guides_enable_on_vim_startup #0
indent_guides_color_change_percent #10
indent_guides_indent_levels #30
indent_guides_autocmds_enabled #0
indent_guides_debug   #0
indent_guides_guide_size #0
w:indent_guides_matches []

here's some relevant bits from :highlight including the supposedly missing group:

Normal         xxx guifg=Grey50 guibg=black
IndentGuidesOdd xxx guibg=darkblue
IndentGuidesEven xxx guibg=darkgreen

all of which suggests to me that everything's in order. Harumph?

cann't be "invoked" for the first time

Hi
Thanks for this great plugin.
I use this plugin with default setting, but the wired thing is it takes no effect at all when run IndentGuidesEnable or IndentGuidesToggle.
But when I change the colorscheme(without quiting gvim),the guide lines can be seen.
By the way ,if I use the customized color for this plugin(in .vimrc), it works well. So I think it should be the color-auto-detect issue.

gvimis 7.4 with 027 patch.

shiftwidth=0 does not work

Hello,

setting shiftwidth=0 (it's supposed to use the tabstop value then) breaks the plugin. The foreground of the very first column is then in a different color which looks kind of strange and is unreadable (for me) because it is almost the same color as the background.

I've replaced set sw=0 with let &shiftwidth=&tabstop in my .vimrc and now it works again. However, I'm wondering why it won't work the sw=0 option as the help page (for sw) says.

Cannot get plugin to load

I copy the folders to my ~/.vim folder and nothing seems to happen when I restart vim. :help indent-guides also doesn't work even though the correct files are in the docs folder.

Any insight into how I can get this plugin running?

Error detected while processing function indent_guides#process_autocmds

Error detected while processing function indent_guides#process_autocmds..indent_guides#enable..indent_guides#clear_matches:
line 5:
E803: ID not found: 904
E803: ID not found: 905
E803: ID not found: 906
E803: ID not found: 907
E803: ID not found: 908
E803: ID not found: 909
E803: ID not found: 910
E803: ID not found: 911
E803: ID not found: 912
E803: ID not found: 913
E803: ID not found: 914
E803: ID not found: 915
E803: ID not found: 916
E803: ID not found: 917
E803: ID not found: 918
E803: ID not found: 919
E803: ID not found: 920
E803: ID not found: 921
E803: ID not found: 922
E803: ID not found: 923

Cannot Load indent-guides in Vim 7.3.46 (Windows)

What I'm seeing is an exact copy of closed issue #43 ...

This is on Windows. I have Vim 7.3.46, I have the latest copy of indent-guides from github. When I try to manually load it using :IndentGuideToggle, I get an error of :
E492: Not an editor command: IndentGuideToggle

All scripts show up when I run :scriptnames. I did what was suggested in the other issue and copied color_helper to the plugins directory.

All to no-avail... Any ideas what might be wrong?
Thank you!

Disables itself when .vimrc is sourced

Like the title says, I can set it to on, even set the g:indent_guides_enable_on_vim_startup option to on, but whenever I source my .vimrc file (I use 'sv') it disables itself again.

Update:
I've figured out that this only happens visually, if I do ,ig twice it appears again, which leads me to believe that it's always on, just not visible after sourcing the .vimrc file.

Enable/disable this plugin per-buffer (or per-window, or per-filetype)

I'd like to have this plugin automatically enabled for any of my source-code files. However, I don't want it enabled for files that are not indentation-based. Currently, it is impossible.

I've tried adding this to my ~/.vimrc:

au FileType python  IndentGuidesEnable

I open a Python file and this plugin is automatically enabled, as it should! Great! Then I type :help indent_guides, and the help file gets indent-highlighted. No, it's not good. So I've added this:

au FileType *  IndentGuidesDisable

And now opening a help file disables the highlighting, but after going back to the Python source, it gets disabled there as well. Damn, this state is global, while it should be local to each buffer!

Once this issue is fixed, issue #20 will be fixed as well.

Plugin disrupts normal X clipboard usage

I haven't narrowed it down to a small problem file, but "+yy (and any other operation that interacts with the X CLIPBOARD) and Bisectly blaims this plugin for messing with the clipboard.

The behavior I'm seeing is that if I try to paste from the X CLIPBOARD into some other GUI application, the contents of the "+ register is only available the first time. On subsequent pastes, it is empty. Disabling this plugin fixes the issue.

indent_guides_guide_size and tabs

When I set indent_guides_guide_size = 1 on a document that has space indentation it works great, but when I set indent_guides_guide_size = 1 on a document that has tab indentation it doesn't work at all.

Support for gVim themes that don't specify a `hi Normal guibg` color

The problem:
Themes that don't specify a guibg color for hi Normal don't work with the plugin. That is, they don't work when the auto colors option is set, ie. when let g:indent_guides_auto_colors = 1.

For example:
When using colorscheme default, hi Normal is Normal xxx cleared, which doesn't specify a guibg.

Possible solution:
Because we can't get a valid guibg we'll have to base the colors off the background variable. Ie. set background=dark will produce dark grey guides, and set background=light will produce light grey guides.

Unicode chars for drawing the line?

Would it be possible to use the unicode characters for drawing a line (aka skinning guides) instead of a whole character row? It'd be much more pleasing to the eye and the coloring would be easier to deal with...

I'm thinking of Unicode character U+2502 "│"

Ciao!

Indentation inside documentation/commentary

It’d be nice if vim-indent-guides could be configured to still hilight indentation after commentary markers, if there is no non-commentary-marker code between the beginning of the line and the commentary markers themselves.

Missing indent lines on if, while, etc statements

Windows 7 Pro x64.

echo &shiftwidth displays : 8.

This is in my _vimrc :
" Indentation Guides let g:indent_guides_guide_size = 1 let g:indent_guides_indent_levels = 50 nnoremap <silent> <F8> :IndentGuidesToggle<CR> autocmd VimEnter * :IndentGuidesEnable

The issue :

Image and video hosting by TinyPic

My debug :let g:indent_guides_debug = 1 + :IndentGuideToggle output :

Image and video hosting by TinyPic

Is there a way to enable the plugin automatically via .vimrc?

Hello,

I'm in the (slow) process of teaching myself vim, so my apologies if this question is a bit silly. However, is there a way to automatically enable the plugin via my .vimrc? The obvious "<Leader>ig" doesn't work, and a significant amount of googling and reading docs didn't seem to shed any light on it.

Thanks,

Jack

Empty lines don't get highlighted

Is there any way to highlight empty lines so they show the same indent level as their previous line? I realize this might be hard, but I don't want to go around and put spaces all over my files, and I don't want discontinuity throughout my highlights either

Cannot figure out how to set custom indent-hilight colours for Solarized.vim

I, like @jc00ke (see #24) am trying to use @altercation’s Solarized with vim-indent-guides. My approach is slightly different, as I desire to set specific colours for the indent guides (and I intend to tweak some other distasteful Solarized defaults at the same time). I’ve copied the configuration from your README into a function, and setup an auto command to call this function (as I intend to add other Solarized modifications to it than those I’m making for your plugin), as thus:

let g:indent_guides_auto_colors = 0
" . . .
function! s:RebuildSolarization()
   " . . . <setting up Solarized colour values here>
   exe "hi! IndentGuidesOdd" .s:fmt_none   .s:fg_none   .s:bg_base02
   exe "hi! IndentGuidesEven".s:fmt_none   .s:fg_none   .s:bg_base01
   " . . . <other Solarized customization>
endfunction

autocmd! VimEnter,ColorScheme * if g:colors_name == "solarized" | call s:RebuildSolarization() | endif

Unfortunately, it doesn’t work: while the commands are run (I’ve checked them with echoerr at the time of the function being run), by the time anything is rendered, the hilights are set back to bog-standard neon-green and neon-red. (Very disgusting defaults, by the way; couldn’t you at least default to two quiet shades of grey? :x)

I’m not very familiar with VimScript, what am I doing wrong here?

**Postscript_: The full code at the time of this writing is available in the commit linked below._

Setting default colors for Vim Terminal

Hi,

first off, great plugin! I just have one minor annoyance, I found it almost impossible to set custom indent colors when using vim in the console. The autocmd lines worked until I changed buffers, after which the colors were back to default.

So i basically overwrote indent_guides#basic_highlight_colors() in my .vimrc, adding a default color option:

" set two dark grey colors for indent guides
let g:indent_guides_default_ctermbg_colors = [234, 235]

" function that registers / overrides "indent_guides#basic_highlight_colors"
function! OverrideIndentGuidesFunction ()
  function! indent_guides#basic_highlight_colors()
    if exists('g:indent_guides_default_ctermbg_colors')
      let l:cterm_colors = g:indent_guides_default_ctermbg_colors
    else
      let l:cterm_colors = (&g:background == 'dark') ? ['darkgrey', 'black'] : ['lightgrey', 'white']
    endif
    let l:gui_colors   = (&g:background == 'dark') ? ['grey15', 'grey30']  : ['grey70', 'grey85']

    exe 'hi IndentGuidesEven guibg=' . l:gui_colors[0] . ' ctermbg=' . l:cterm_colors[0]
    exe 'hi IndentGuidesOdd  guibg=' . l:gui_colors[1] . ' ctermbg=' . l:cterm_colors[1]
  endfunction
endfunction

" and a hook to overwrite the plugin's function with ours after the plugin has loaded:
autocmd VimEnter * :call OverrideIndentGuidesFunction()

This hack works, but I would appreciate it if some such option would be provided, such that the "fallback" to darkgrey etc. can be overriden by the user.

indent guides overwrite Todo

Hello, I have

match Todo /\s\+$/

in my vimrc, so that whitespace stands out like crazy (because whitespace is evil). When indent guides are turned on, or if

let g:indent_guides_enable_on_vim_startup = 1

I no longer see the whitespace (Todo) match.

If I turn on indent guides then do a

:match Todo /\s\+$/

then I have working indent guides as well as the Todo match. I thought this might be an order of operations issue, so I put the match statement as the last line of my .vimrc, but that doesn't work.

Do you have any suggestions?

Thanks.

-Shawn

Cannot load indent-guides in MacVim 7.3

Hi,
I installed using the zip file. I've confirmed that all the files are installed correctly in their intended sub directories under my ~/.vim folder. When loading MacVim none of the commands work and indentation guides do not appear in my files. I tried setting my ~/.gvimrc file to auto load the plugin on startup but that does not work as well.

Here's my config file (~/.gvimrc):
set nowrap
set number
set completeopt=longest,menu
set ruler
set go-=T
set guifont=Menlo\ Regular:h18
set hlsearch
set tabstop=2 shiftwidth=2 softtabstop=2 expandtab
filetype indent on
filetype plugin on
au BufNewFile,BufRead *.ejs set filetype=html
let g:indent_guides_enable_on_vim_startup = 1

Any advice or suggestions would be greatly appreciated. Admittedly, I'm a VIM newbie and I'd really like to get this plugin to work. Thanks in advance.

Sincerely,
Jeff

Conflicts with diff line highlighting

If vim-indent-guides is enabled, it overrides the beginnings of diff highlight lines. I would rather it not do that and let diff highlighting win. #20 and #26 are possibly related.

Any tips?

Copy guides from line above of an empty line

screen shot 2013-05-15 at 17 47 50

I frequently place empty lines in code to separate blocks. I understand that an empty line doesn't have any indentation. Although, if the guides from the line above could be copied these breaks would be avoided.

how to don't show color in specified place

some wishes :-)

I wish in these case:

  • if a indent has only one line, don't show the guide.
    e.g.

    | if foo then <--- show here
    | ? blah blah blah <---don't show here on '?'
    | end <---show here
  • if a indent has many many indent apart from last line, just show the first indet.
    e.g.

    | a =
    | here
    but not:
    | a =
    | | | | | | here

    thx :-)

Color modes

Some possible color modes:

  • single (only draws every second guide)
  • alternating (alternates between 2 colors)
  • gradient

Alternatively you could have an option to control how many colors the guides should alternate between, with the default being 2.

Support turning on and off indent guides per buffer...

This seems like a useful plugin to have when editing Python code, but I can't get myself to use it much because I have to constantly turn it on and off since it acts globally. It'd be nice to be able to say "turn it on for this buffer". IOW, some sort of buffer-local variable to enable/disable it for that buffer.

Indents dont cover lines with no text in them?

All my indent guides are 'broken lines' because i use a lot of lines with nothing on them (just a carriage return). The vim indent line stops and stars on the next line under the carriage return... can i have it ALWAYS be there whether the line has anything on it or not?

Error: highlight group not found: Normal

When I activate the plugin for a yaml file (syntax highlighting is enabled) I receive the following error message:

Error detected while processing function <SNR>19_IndentGuidesEnable..indent_guides#enable..indent_guides#init_script_vars..indent_guides#
capture_highlight:
line    2:
E411: highlight group not found: Normal

Fedora 17
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 15 2012 09:58:06)
Included patches: 1-415, 417-682

str2float isn't available in older versions of Vim

This line causes an error in Vim 7.1:
let s:change_percent = g:indent_guides_color_change_percent / str2float("100.0")

Changing it to this doesn't seem to be a problem:
let s:change_percent = g:indent_guides_color_change_percent / 100.0

too hard to get custom colors working

I've added

let g:indent_guides_auto_colors = 0
let g:indent_guides_enable_on_vim_startup = 1

to my .vimrc and

hi IndentGuidesOdd                      guibg=#121212
hi IndentGuidesEven                     guibg=#262626

to my colorscheme, but the highlight rules are cleared.

By the way, nice plugin. I wrote something similar myself (github.com/graywh/vim-colorindent) that's unpolished b/c I didn't like the existing alternatives that used syntax rules instead of matches.

Doesn't work for me at all

With debugging enabled I get this, but nothing changes visually.

s:indent_size = 4
s:guide_size = 4
s:hi_normal = Normal xxx ctermfg=223 ctermbg=235 guifg=#ebdbb2 guibg=#282828
s:indent_levels = 30
s:auto_colors = 0
s:change_percent = 0.1
s:color_hex_pat = #[0-9A-Fa-f]{6}
s:color_hex_bg_pat = guibg=\zs#[0-9A-Fa-f]{6}\ze
s:color_name_bg_pat = guibg='?\zs[0-9A-Za-z ]+\ze'?
s:start_level = 1

I've tried this with various color schemes but still no luck :(

Indent guides look ugly on 256-color terminal

While the automatic coloring of indent guides looks great in gvim, it looks really ugly running vim on a 256-color terminal. Compare and contrast, for example, these two screenshots:

Gvim
Vim 256 colors

The color scheme in both screenshots is zenburn, and the code snippet is from indent_guides.vim. The rest of the colors match quite well, which makes the indent guides stand out like a sore thumb.

When I check :hi IndentGuidesOdd and :hi IndentGuidesEven in gvim, I see that they've been calculated as grey85 and grey70 respectively. After a little playing around (the Xterm 256 color chart was a big help), I found that `:hi IndentGuidesOdd ctermbg=236and:hi IndentGuidesEven ctermbg=240`` were decent matches for the guibg colors -- and indeed, when I set those values, my terminal VIm looks much better.

It would be nice if vim-indent-guides could detect a 256-color (or 88-color) terminal and calculate its grey values accordingly. The Python script at http://excess.org/article/2007/10/xterm-256-colour-chart-20/ might help: it shows that the greys in the Xterm 256 color chart are spread between 0xe8 (ctermbg=232) and 0xff (ctermbg=255), which means each increasing ctermbg number adds about 4% brightness overall. That should make the math reasonably simple for a 256-color terminal. (Afraid I can't help with the 88-color terminal math, as I don't have one of those handy to test with.)

Guides are cutoff when indented block has newline

When having indented code, but include blank lines between statements, which contains no spaces at all, the guide is cutoff.
I understand this could be assumed as logical as the indentation is pretty much removed, but generally you do not want to include lines containing only white space.

E806: using Float as a String in gvim (vim-bug, workaround suggested)

Hi,

I using your plugin with vim 7.3.102 (Gentoo version, but that is not really relevant)

In some version of vim-7.2, there was a bug with floating points (see http://vim.1045645.n5.nabble.com/patch-fixed-bug-floating-point-numbers-cannot-be-used-as-arguments-in-GVIM-lang-td1203961.html) which seems to have surfaced again in my version.

As a workaround, you could use ' / str2float("100.0")' instead of ' / 100.0'.
This works for me, and I suppose it works for the 7.2 versions that have this bug, too.

Does it highlight the guide of the current code block?

Make it highlight the indentation guide when the cursor is on a bracket, so that the guide can easily be followed visually to the next bracket, similar to how Notepad++ does it.

Add also the ability to just highlight the indent guides based on which code block the current resides in, similar to Sublime's functionality.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.