aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/wildignore.vim
blob: fb190bce388e1e8b5329bc4a53aafc56940accb6 (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
" 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 v:version < 700 || !has('wildignore')
  finish
endif
if exists('g:loaded_wildmenu')
  finish
endif
let g:loaded_wildmenu = 1

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

  " New empty array
  let l:ignores = []

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  " For any that had lowercase letters, add their uppercase analogues
  for l:ignore in l:ignores
    if l:ignore =~# '\l'
      call add(l:ignores, toupper(l:ignore))
    endif
  endfor

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

endfunction

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