allenhwkim
allenhwkim

Reputation: 27738

Vim, why do I have some parts highlighted?

When I edit html, I have highlights like this picture

Imgur

I don't want it highlighted. FYI this is my .vimrc

set nocompatible               " be iMproved, required

filetype off                   " required
set rtp+=~/.vim/bundle/vundle/ " set the runtime path to include Vundle and initialize
call vundle#rc()
" Bundle 'gmarik/vundle'         " let Vundle manage Vundle, required
Bundle "wookiehangover/jshint.vim" 
Bundle "mru.vim"
Bundle 'godlygeek/tabular'
Bundle 'plasticboy/vim-markdown'
filetype plugin indent on      " required

syntax on                      " Enable syntax highlighting

set wildmenu                   " Better command-line completion
set showcmd                    " Show partial commands in the last line of the screen
set hlsearch

set autoindent
set shiftwidth=2
set softtabstop=2
set expandtab                  " Allow backspacing over autoindent, line breaks and start of insert action

set ignorecase                 " for case insensitive search
set smartcase                  " except when using capital letters

set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp

set splitright                " when vertically split, open new window on the right(default, left)
set splitbelow                " when horizontally split, open new window on the bottom(default, top)

" Keyboard Mapping
nnoremap <Leader>b :MRU<CR>  " \b to see the most recent used files
" = to run tidy on html
au FileType html setlocal equalprg=tidy\ -q\ -i\ --show-errors\ 0\ --tab-size\ 4\ --wrap\ 200\ --indent-spaces\ 4

" for markdown plugin
let g:vim_markdown_folding_disabled=1

let g:vim_markdown_no_default_key_mappings=1

EDIT ----

I love this SO community. I followed all comments and answers, and found out the following soultion;

  1. changed <i/> to <i></i>
  2. syntax off
  3. syntax on

Upvotes: 0

Views: 541

Answers (1)

Aidan Brumsickle
Aidan Brumsickle

Reputation: 659

It might be because of the <i/> tag... your syntax highlighting might not recognize that you self-closed it.

Otherwise you might have the 'list' option set (it's not in your vimrc, but a plugin might have added it)... If some of your code is indented with tabs and other parts spaces, then if 'list' is set then it will highlight just the tabs, for example.

Try doing :set nolist and see if the highlighted areas go away. You can remove stray tabs or spaces (depending on your expandtab setting) by doing :retab.

The visual result of :set list depends on your colorscheme and your setting for listchars. For example, I have set listchars=tab:▸\ ,eol:¬ in my .vimrc at home. See :help 'listchars' for more information.

If you want to still have some visual distinction between leading tabs and spaces, you can modify your colorscheme. This is a bit more involved. From the Vim help:

The "NonText" highlighting will be used for "eol", "extends" and
"precedes".  "SpecialKey" for "nbsp", "tab" and "trail".

To change the visual appearance of these syntax groups, add your own :highlight commands in your .vimrc or edit a colorscheme file.

Upvotes: 2

Related Questions