jab
jab

Reputation: 5823

Vim Syntax Highlighting Goes Away after second file load

Alright, I'm brand new to vim, and I'm seeming to have a very annoying problem regarding syntax highlighting after successive file loads. Once I load the first file in vim the syntax highlighting is there however, if I load another file (either from GUI, NERDtree or edit) then the syntax highlighting goes away and I cannot bring it back with the command :syn on.

My vimrc file is below, any help is appreciated.

call pathogen#infect()
syntax on
filetype plugin indent on
let NERDTreeShowHidden=1
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
map <F3> :TlistToggle
map <F4> :NERDTree
set number
colors koehler

Actually, its funny. When I just loaded my vimrc file, the syntax highlighting was there. I have no idea whats going on.

Upvotes: 0

Views: 854

Answers (1)

codelahoma
codelahoma

Reputation: 904

It sounds like the second file you're opening doesn't have a filetype that vim detects for syntax highlighting, especially since you did have highlighting when you looked at your vimrc file.

When you're in an un-highlighted file, try this command:

:set filetype

If the value is blank, that's why there's no syntax highlighting.

It would be helpful if you could expand your question to include the filenames and types of both the files that work and those that don't.

Upvotes: 1

Related Questions