aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/wildignore.vim
blob: 36a8f4923970c830ac07db3dae6ed8717223a09d (plain) (blame)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
" Don't complete certain files that I'm not likely to want to manipulate from
" within Vim; this is kind of expensive to reload, so I've made it a plugin
" with a load guard
if &compatible || v:version < 700 || !has('wildignore')
  finish
endif
if exists('loaded_wildmenu')
  finish
endif
let loaded_wildmenu = 1

" Helper function for local scope
function! s:Wildignore() abort

  " New empty array
  let ignores = []

  " Archives
  let ignores += [
        \ '*.7z'
        \,'*.bz2'
        \,'*.gz'
        \,'*.jar'
        \,'*.rar'
        \,'*.tar'
        \,'*.xz'
        \,'*.zip'
        \ ]

  " Bytecode
  let ignores += [
        \ '*.class'
        \,'*.pyc'
        \ ]

  " Databases
  let ignores += [
        \ '*.db'
        \,'*.dbm'
        \,'*.sdbm'
        \,'*.sqlite'
        \ ]

  " Disk
  let ignores += [
        \ '*.adf'
        \,'*.bin'
        \,'*.hdf'
        \,'*.iso'
        \ ]

  " Documents
  let ignores += [
        \ '*.docx'
        \,'*.djvu'
        \,'*.odp'
        \,'*.ods'
        \,'*.odt'
        \,'*.pdf'
        \,'*.ppt'
        \,'*.xls'
        \,'*.xlsx'
        \ ]

  " Encrypted
  let ignores += [
        \ '*.asc'
        \,'*.gpg'
        \ ]

  " Executables
  let ignores += [
        \ '*.exe'
        \ ]

  " Fonts
  let ignores += [
        \ '*.ttf'
        \ ]

  " Images
  let ignores += [
        \ '*.bmp'
        \,'*.gd2'
        \,'*.gif'
        \,'*.ico'
        \,'*.jpeg'
        \,'*.jpg'
        \,'*.pbm'
        \,'*.png'
        \,'*.psd'
        \,'*.tga'
        \,'*.xbm'
        \,'*.xcf'
        \,'*.xpm'
        \ ]

  " Incomplete
  let ignores += [
        \ '*.filepart'
        \ ]

  " Objects
  let ignores += [
        \ '*.a'
        \,'*.o'
        \ ]

  " Sound
  let ignores += [
        \ '*.au'
        \,'*.aup'
        \,'*.flac'
        \,'*.mid'
        \,'*.m4a'
        \,'*.mp3'
        \,'*.ogg'
        \,'*.opus'
        \,'*.s3m'
        \,'*.wav'
        \ ]

  " System-specific
  let ignores += [
        \ '.DS_Store'
        \ ]

  " Translation
  let ignores += [
        \ '*.gmo'
        \ ]

  " Version control
  let ignores += [
        \ '.git'
        \,'.hg'
        \,'.svn'
        \ ]

  " Video
  let ignores += [
        \ '*.avi'
        \,'*.gifv'
        \,'*.mp4'
        \,'*.ogv'
        \,'*.rm'
        \,'*.swf'
        \,'*.webm'
        \ ]

  " Vim
  let ignores += [
        \ '*~'
        \,'*.swp'
        \ ]

  " If on a system where case matters for filenames, for any that had
  " lowercase letters, add their uppercase analogues
  if has('fname_case')
    for ignore in ignores
      if ignore =~# '\l'
        call add(ignores, toupper(ignore))
      endif
    endfor
  endif

  " Return the completed setting
  return join(ignores, ',')

endfunction

" Run helper function just defined
let &wildignore = s:Wildignore()