Skip to content

Instantly share code, notes, and snippets.

Created July 13, 2013 00:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hyuki0000/5988910 to your computer and use it in GitHub Desktop.
A simple example for syntax coloring of ".txt" files. *Sample Sample Sample => PreProc ;Sample Sample Sample => Comment
augroup filetypedetect
au BufNewFile,BufRead *.txt setf txt
augroup END
" Vim syntax file
if exists("b:current_syntax")
syn match txtSection "^\*.*$"
syn match txtComment "^;.*$"
hi link txtSection PreProc
hi link txtComment Comment
let b:current_syntax = "txt"
Copy link

  • filetype.vim は ~/.vim/filetype.vim に置く。
  • txt.vim は ~/.vim/syntax/txt.vim に置く。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment