Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
Created July 13, 2013 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki0000/5988910 to your computer and use it in GitHub Desktop.
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")
finish
endif
syn match txtSection "^\*.*$"
syn match txtComment "^;.*$"
hi link txtSection PreProc
hi link txtComment Comment
let b:current_syntax = "txt"
@hyuki0000
Copy link
Author

  • 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