aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-15 01:44:41 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-15 01:59:57 +1200
commit95b27d9da95f8e40143db032547c9e58c20a888e (patch)
treee0e938b4609be354101598584c8cb793af98aa20 /vim/plugin
parentUpdate auto_cache_dirs.vim plugin (diff)
downloaddotfiles-95b27d9da95f8e40143db032547c9e58c20a888e.tar.gz
dotfiles-95b27d9da95f8e40143db032547c9e58c20a888e.zip
Add plugin file for setting 'wildignore'
Diffstat (limited to 'vim/plugin')
-rw-r--r--vim/plugin/wildignore.vim170
1 files changed, 170 insertions, 0 deletions
diff --git a/vim/plugin/wildignore.vim b/vim/plugin/wildignore.vim
new file mode 100644
index 00000000..fb190bce
--- /dev/null
+++ b/vim/plugin/wildignore.vim
@@ -0,0 +1,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()