aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/filetype.vim
blob: 9204987ad4205cd279ff293d59c25a38abf241d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
" Vim support file to detect file types

if exists("did_load_filetypes")
  finish
endif

" Markdown
augroup markdown
  " File extensions
  autocmd!
  autocmd BufRead,BufNewFile *.md   setfiletype markdown
  autocmd BufRead,BufNewFile *.mkd  setfiletype markdown
  autocmd BufRead,BufNewFile *.md   setfiletype markdown
  autocmd BufRead,BufNewFile *.mdwn setfiletype ikiwiki

  " Markdown configuration
  "
  " Include folding setup:
  " https://github.com/masukomi/vim-markdown-folding
  "
  " Alternative folding method:
  " https://codereview.stackexchange.com/questions/202620/vim-plugin-for-folding-markdown-lists
  autocmd FileType markdown set foldexpr=NestedMarkdownFolds()
  autocmd FileType markdown set autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab formatoptions=tcroqn2 comments=n:>
augroup END

" Python
augroup python
  autocmd!
  autocmd BufRead *.py    setfiletype python
  autocmd FileType python set autoindent smartindent tabstop=4 softtabstop=4 shiftwidth=4 expandtab
augroup END

" Puppet
augroup puppet
  autocmd!
  autocmd BufRead,BufNewFile *.pp setfiletype puppet
augroup END

" PHP
augroup php
  autocmd!
  autocmd BufRead,BufNewFile *.php setfiletype php
  autocmd FileType             php let php_sql_query=1
augroup END

" Drupal *.module and *.install files.
if has("autocmd")
  augroup module
    autocmd!
    autocmd BufRead,BufNewFile *.profile setfiletype php
    autocmd BufRead,BufNewFile *.module  setfiletype php
    autocmd BufRead,BufNewFile *.install setfiletype php
    autocmd BufRead,BufNewFile *.test    setfiletype php
  augroup END
endif

" Mail
"
" Workaround for mail editing. There must be a plugin enabling autoindent in
" mail composition, which is annoying.
augroup mail
  autocmd!
  autocmd FileType mail set noautoindent
augroup END

" Other filetypes
augroup filetypedetect
  autocmd!
  autocmd BufRead,BufNewFile kvmxfile    setfiletype sh
  autocmd BufRead,BufNewFile Vagrantfile setfiletype ruby
  autocmd BufRead,BufNewFile *.vue       setfiletype html
  autocmd BufRead,BufNewFile *.thtml     setfiletype php
  autocmd BufRead,BufNewFile *.rem       setfiletype remind
  autocmd BufRead,BufNewFile *.trac      setfiletype tracwiki
  autocmd BufRead,BufNewFile *.tracwiki  setfiletype tracwiki
augroup END