aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/filetype.vim
blob: 9ab8afd16f8525386e3860d3571e1a2e72f0572f (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
78
79
80
81
82
83
84
85
86
" Vim support file to detect file types

if exists("did_load_filetypes")
  finish
endif

" Markdown
augroup markdown
  " Markdown configuration without vim-markdown plugin
  "
  " 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
  "
  " Seem like this things should be set during BufRead or BufNewFile; they're
  " not working when set during the FileType event.
  autocmd!
  autocmd BufRead,BufNewFile *.md   set filetype=markdown foldexpr=NestedMarkdownFolds() autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab formatoptions=tcroqn2 comments=n:>
  autocmd BufRead,BufNewFile *.mdwn set filetype=ikiwiki  foldexpr=NestedMarkdownFolds()

  " Markdown configuration with vim-markdown plugin
  "autocmd!
  "autocmd BufRead,BufNewFile *.md set autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab formatoptions=tcroqn2 comments=n:>
  "let g:vim_markdown_new_list_item_indent = 2
  "let g:vim_markdown_folding_style_pythonic = 1
  "let g:vim_markdown_folding_level = 1
  "let g:vim_markdown_auto_insert_bullets = 0
  "let g:vim_markdown_new_list_item_indent = 0
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
"
" According to ":help BufRead", this augroup is also evaluated also on
" ":filetype detect".
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