diff --git a/VimSetup.rc b/VimSetup.rc index 9392d41..02b8688 100644 --- a/VimSetup.rc +++ b/VimSetup.rc @@ -333,7 +333,7 @@ " Done below for specific file-types if !exists("autocmd_loaded") let autocmd_loaded = 1 - autocmd BufNewFile,BufRead *.cpp,*.c,*.h,*.md,*.txt,*.qdoc,*.doc setlocal spell spelllang=en + autocmd BufNewFile,BufRead *.cpp,*.hpp,*.c,*.h,*.md,*.txt,*.qdoc,*.doc setlocal spell spelllang=en autocmd BufNewFile,BufRead *.doc,*.qdoc,*.book,*.leaf set filetype=doc " autocmd BufNewFile,BufRead *.pro,*.pri set filetype=pro autocmd BufNewFile,BufRead *akefile*,*.pro,*.inc,*.mak set noexpandtab @@ -548,8 +548,6 @@ " My syntax highlighting magic function! CppSyntaxHighlighting() - set tags+=./.tags - " This is to avoid cpp.vim error when it is a .c buf syn keyword cppStructure class @@ -578,11 +576,14 @@ " N names imported via using scope::symbol [off] " U using namespace statements [off] - " Read the ctags .tags file and find all the types and add to the cppType syntax for coloring - let tags = taglist('^', '.tags') - let typeTags = filter(tags, "!empty(matchstr(v:val['kind'], '[csgunt]'))") - call map(typeTags, "v:val['name']") - exec 'syn keyword cppType ' . join(typeTags, " ") + if filereadable(".tags") + " Read the ctags .tags file and find all the types and add to the cppType syntax for coloring + set tags+=./.tags + let tags = taglist('^', '.tags') + let typeTags = filter(tags, "!empty(matchstr(v:val['kind'], '[csgunt]'))") + call map(typeTags, "v:val['name']") + exec 'syn keyword cppType ' . join(typeTags, " ") + endif " Add the system tags set tags+=~/.vim/tags/system_tags @@ -594,28 +595,30 @@ " Map obsidian color scheme runtime colors/obsidian.vim - normal :SideView 1GVGd:r!make project 1Gdd:set nowrap :set cursorline + if filereadable("Makefile") + normal :SideView 1GVGd:r!make project 1Gdd:set nowrap :set cursorline - " Colorize the project list side-view - syn keyword ProjectHeading Target Sources Includes Docs Project - let projectFiles = system('make dependancies') - let list = split(projectFiles, ' ') - for file in list - exec 'syn match ProjectFile ' . file - endfor - hi CursorLine cterm=NONE ctermbg=1 - hi StatusLine cterm=bold ctermbg=Green ctermfg=15 + " Colorize the project list side-view + syn keyword ProjectHeading Target Sources Includes Docs Project + let projectFiles = system('make dependancies') + let list = split(projectFiles, ' ') + for file in list + exec 'syn match ProjectFile ' . file + endfor + hi CursorLine cterm=NONE ctermbg=1 + hi StatusLine cterm=bold ctermbg=Green ctermfg=15 - hi ProjectHeading ctermfg=5 - hi ProjectFile ctermfg=3 - - " Switch to the editor window - execute 'wincmd l' + hi ProjectHeading ctermfg=5 + hi ProjectFile ctermfg=3 + + " Switch to the editor window + execute 'wincmd l' + endif endfunction " If starting up with a project file, how the project side-view -autocmd VimEnter *.cpp,*.c,*.h,*.pro call ShowProjectView() +autocmd VimEnter *.cpp,*.hpp,*.c,*.h,*.pro call ShowProjectView() " Key short-cuts for switching between views @@ -631,7 +634,7 @@ autocmd BufNewFile,BufRead *vim/*doc/*.txt hi clear SpellBad " Use my custom syntax highlighting for code -autocmd BufNewFile,BufRead *.cpp,*.c,*.h call CppSyntaxHighlighting() +autocmd BufNewFile,BufRead *.cpp,*.hpp,*.c,*.h call CppSyntaxHighlighting() syntax enable @@ -639,7 +642,7 @@ augroup DimWindows autocmd BufEnter SideView hi CursorLine term=reverse cterm=NONE ctermfg=White ctermbg=Green - autocmd BufEnter *.cpp,*.c,*.h,*.pro hi CursorLine ctermbg=1 + autocmd BufEnter *.cpp,*.hpp,*.c,*.h,*.pro hi CursorLine ctermbg=1 augroup end hi StatusLine cterm=bold ctermbg=Green ctermfg=15