preservim / vim-indent-guides

A Vim plugin for visually displaying indent levels in code
MIT License
2.62k stars 162 forks source link

Error while processing function <SNR>13 #108

Closed rianby64 closed 7 years ago

rianby64 commented 8 years ago

This is the message that I got after press ig

Error detected while processing function <SNR>13_IndentGuidesToggle..indent_guides#toggle..indent_guides#enable..indent_guide
s#init_script_vars..indent_guides#capture_highlight:
line    2:
E411: highlight group not found: Normal

The .vimrc file that I've is:

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'jelera/vim-javascript-syntax'
Plugin 'nathanaelkane/vim-indent-guides'

call vundle#end()            " required
filetype plugin indent on    " required

set smarttab
set expandtab
set number
set tabstop=2
set shiftwidth=2
set softtabstop=2

set pastetoggle=<F2>

set incsearch
set hlsearch

set title
set visualbell

set background=dark

highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()

And the file that I'm processing is

'use strict';
// A comment
feature('Manipulating Dimension', function() {

  scenario('Setup information to render', function() {

    given('a <dimension> directive', function() { });

    when('I put name attribute as "a name"', function() { });

    then('I\'ve an HTML definition that contains "a name"', function() { });
  });

});

Can't understand what's going wrong. Thanks a million in advance

MintPaw commented 8 years ago

I'm having the same problem with a slightly different error message. Error detected while processing function <SNR>24_IndentGuidesEnable[1]..indent_guides#enable[8]..indent_guides#init_script_vars[7]..indent...

It only happens when I open some files, I have no idea why either.

hexchain commented 8 years ago

Same issue, using https://github.com/nathanaelkane/vim-indent-guides/issues/31#issuecomment-4583981 as solution now.

nathanaelkane commented 7 years ago

Sounds like you're not using a colorscheme, or your colorscheme isn't defining colours for the Normal highlight group.

Try using a different colorscheme, or manually defining the indent guide colours:

let g:indent_guides_auto_colors = 0
hi IndentGuidesOdd  guibg=red   ctermbg=3
hi IndentGuidesEven guibg=green ctermbg=4

Please re-open if this is not the case.

rianby64 commented 7 years ago

Thanks a lot! Works to me! :+1:

k0aaa commented 6 years ago

can I modify the autoload scripts to make it load another highlight group other than Normal?

nathanaelkane commented 6 years ago

@Whainte there's currently no config option to change it from Normal.

k0aaa commented 6 years ago

Cant I edit the vim script to make it read another highlighting group like Conceal or? and btw it mysteriously worked after manually load colorscheme default

nathanaelkane commented 6 years ago

It should work if you edit the local autoload file.

k0aaa commented 6 years ago

Yeah, iirc it generated a Normal when i added an explicit "colorscheme default" to the global vimrc. However i ended up changing another colorscheme which also worked pretty well

yzsatgithub commented 6 years ago

these lines didn't work for me:

let g:indent_guides_auto_colors = 0
hi IndentGuidesOdd  guibg=red   ctermbg=3
hi IndentGuidesEven guibg=green ctermbg=4

the same error occurred. Why is that? @nathanaelkane thank you

nathanaelkane commented 6 years ago

@yzsatgithub have you tried defining a colorscheme? e.g. colorscheme default

yzsatgithub commented 5 years ago

@yzsatgithub have you tried defining a colorscheme? e.g. colorscheme default

@nathanaelkane No I didn't. But I do have a setting line color vc for syntax highlighting. Is this the same as what you asked?

nathanaelkane commented 5 years ago

@yzsatgithub yep, it's all the same :colo[rscheme] command.

If you're still getting the highlight group not found: Normal error, it means the Normal highlight group hasn't been defined before the Indent Guides plugin initialises. It could be that your plugin doesn't define Normal. Maybe try defining it manually, i.e. hi Normal guibg=black