Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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

hyuki0000 commented Jul 13, 2013

  • 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