Skip to content

Instantly share code, notes, and snippets.

@jarvist
Last active June 7, 2018 09:51
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarvist/2818256 to your computer and use it in GitHub Desktop.
Save jarvist/2818256 to your computer and use it in GitHub Desktop.
Vim syntax highlighting file for the NWCHEM electronic structure package input deck (.nw extension), and an even cruder one for Gaussian (.com). Put this in ~/.vim/syntax, and add a suitable loader to ~/.vim/filetype.vim . Used with the Zenburn colour sch
" Vim syntax file
" Language: Gaussian (Electronic Structure Package) Input Files
" Maintainer: Jarvist Moore Frost
" Latest Revision: 27 May 2012
if exists("b:current_syntax")
finish
endif
"Oh Fortran, always ignoring case...
syn case ignore
" Keywords
syn keyword ComBlockCmd dft tddft geometry end basis
syn keyword ComTask "#.*$"
syn keyword ComStartup "\%.*$"
syn region ComDoubleQuote start=+"+ skip=+\\"+ end=+"+
syn match ComAtom " \a "
syn match ComNumber "-\=\<\d\+\>#\="
syn match ComNumber "\<\d\>" display
syn match ComFloat "\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" display
syn match ComFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
syn match ComFloat "\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=" display
" Comments: {{{1
"==========
syn cluster shCommentGroup contains=shTodo,@Spell
syn keyword shTodo contained COMBAK FIXME TODO XXX NOTE
syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup
syn match shComment "\s\zs#.*$" contains=@shCommentGroup
syn match shQuickComment contained "#.*$"
"Let there be colour
let b:current_syntax = "com"
hi def link shTodo Todo
hi def link ComBlockCmd Statement
hi def link ComTask Special
hi def link shDoubleQuote String
hi def link shComment Comment
hi def link shNumber Number
hi def link ComAtom PreProc
hi def link ComStartup Comment
hi def link ComFloat Float
"hi def link NWDefine Define
if exists("did_load_myfiletypes")
finish
endif
let did_load_myfiletypes= 1
augroup filetypedetect
au BufNewFile,BufReadPost *.pdb setf pdb
augroup END
augroup filetypedetect
au BufNewFile,BufReadPost *.nw setf nw
augroup END
augroup filetypedetect
au BufNewFile,BufReadPost *.com setf com
augroup END
" Vim syntax file
" Language: GULP (General Utility Lattice Program) Input Files
" Maintainer: Jarvist Moore Frost
" Latest Revision: 7 Nov 2013
if exists("b:current_syntax")
finish
endif
"Oh Fortran, always ignoring case...
syn case ignore
" Keywords
syn keyword NWBlockCmd cell fractional space species buck end
syn keyword NWTask maxcyc stepmx dump every
syn keyword NWStartup single prop property conp comp phon phonon pot potential
syn keyword GULPType core shel shell
syn region shDoubleQuote start=+"+ skip=+\\"+ end=+"+
syn match shNumber "-\=\<\d\+\>#\="
syn match NWAtom " \u "
syn match NWAtom " \u\a "
syn match NWAtom "^\u\a "
syn match NWAtom "^\u "
syn match NWOperator "[*/+-><^~%^&|=.:;,$?]"
" Comments: {{{1
"==========
syn cluster shCommentGroup contains=shTodo,@Spell
syn keyword shTodo contained COMBAK FIXME TODO XXX NOTE
syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup
syn match shComment "\s\zs#.*$" contains=@shCommentGroup
syn match shQuickComment contained "#.*$"
syn match shComment "^\s*\zs!.*$" contains=@shCommentGroup
syn match shComment "\s\zs!.*$" contains=@shCommentGroup
syn match shQuickComment contained "!.*$"
syn match shComment "^\s*\zs\*.*$" contains=@shCommentGroup
syn match shComment "\s\zs\*.*$" contains=@shCommentGroup
syn match shQuickComment contained "\*.*$"
"Let there be colour
let b:current_syntax = "nw"
hi def link NWTodo Todo
hi def link shTodo Todo
hi def link NWBlockCmd Statement
hi def link NWTask Special
hi def link shDoubleQuote String
hi def link shComment Comment
hi def link shNumber Number
hi def link NWAtom PreProc
hi def link NWStartup Special
hi def link NWOperator Operator
hi def link GULPType PreProc
"hi def link NWDefine Define
" Vim syntax file
" Language: NWCHEM Input Files
" Maintainer: Jarvist Moore Frost
" Latest Revision: 27 May 2012
if exists("b:current_syntax")
finish
endif
"Oh Fortran, always ignoring case...
syn case ignore
" Keywords
syn keyword NWBlockCmd dft tddft geometry end basis
syn keyword NWTask task
syn keyword NWStartup start restart scratch_dir permanent_dir memory echo
syn region shDoubleQuote start=+"+ skip=+\\"+ end=+"+
syn match shNumber "-\=\<\d\+\>#\="
syn match NWAtom " \a "
syn match NWOperator "[*/+-><^!~%^&|=.:;,$?]"
" Comments: {{{1
"==========
syn cluster shCommentGroup contains=shTodo,@Spell
syn keyword shTodo contained COMBAK FIXME TODO XXX NOTE
syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup
syn match shComment "\s\zs#.*$" contains=@shCommentGroup
syn match shQuickComment contained "#.*$"
"Let there be colour
let b:current_syntax = "nw"
hi def link NWTodo Todo
hi def link shTodo Todo
hi def link NWBlockCmd Statement
hi def link NWTask Special
hi def link shDoubleQuote String
hi def link shComment Comment
hi def link shNumber Number
hi def link NWAtom PreProc
hi def link NWStartup Special
hi def link NWOperator Operator
"hi def link NWDefine Define
" pdb.vim
" Author: Charles E. Campbell, Jr.
" Date: Mar 18, 2009
" Version: 1a NOT RELEASED
" Adapted to take away the hard coded colours (which did not work) and change columns by Jarvist Moore Frost, 2012-05-25.
" ---------------------------------------------------------------------
" Initialization {{{1
" Remove any old syntax stuff hanging around
syntax clear
" ---------------------------------------------------------------------
" Syntax {{{1
syn match pdbCol1 /^.*\%5v/ nextgroup=pdbCol2
syn match pdbCol2 /\%6v.*\%11v/ contained nextgroup=pdbCol3
syn match pdbCol3 /\%14v.*\%17v/ contained nextgroup=pdbCol4
syn match pdbCol4 /\%18v.*\%21v/ contained nextgroup=pdbCol5
syn match pdbCol5 /\%24v.*\%35v/ contained nextgroup=pdbCol6
syn match pdbCol6 /\%35v.*\%43v/ contained nextgroup=pdbCol7
syn match pdbCol7 /\%43v.*\%51v/ contained nextgroup=pdbCol8
syn match pdbCol8 /\%51v.*\%58v/ contained nextgroup=pdbCol9
syn match pdbCol9 /\%58v.*\%64v/ contained nextgroup=pdbCol10
syn match pdbCol10 /\%64v.*\%73v/ contained nextgroup=pdbCol11
syn match pdbCol11 /\%73v.*$/ contained
" ---------------------------------------------------------------------
" Highlighting {{{1
if !exists("b:did_pdb_syntax_inits")
let b:did_pdb_syntax_inits = 1
hi def link pdbCol1 Macro
hi def link pdbCol2 Number
hi def link pdbCol3 Constant
hi def link pdbCol4 Function
hi def link pdbCol5 Cyan
hi def link pdbCol6 White
hi def link pdbCol7 Red
hi def link pdbCol8 Yellow
hi def link pdbCol9 Green
hi def link pdbCol10 Magenta
hi def link pdbCol11 Cyan
endif
" ---------------------------------------------------------------------
" vim: ts=4 fdm=marker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment