aboutsummaryrefslogtreecommitdiff
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
parentb167bad0a5a59e74ac89a03ef712e63c51b4eb99 (diff)
downloaddotfiles-95b27d9da95f8e40143db032547c9e58c20a888e.tar.gz
dotfiles-95b27d9da95f8e40143db032547c9e58c20a888e.zip
Add plugin file for setting 'wildignore'
-rw-r--r--vim/plugin/wildignore.vim170
-rw-r--r--vim/vimrc1
2 files changed, 171 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()
diff --git a/vim/vimrc b/vim/vimrc
index 93b437d7..a3bc5f0d 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -154,6 +154,7 @@ if has('wildmenu')
if exists('+wildignorecase')
set wildignorecase " Case insensitive, if supported
endif
+ " 'wildignore' is built in plugin/wildignore.vim
endif
" New windows go below or to the right of a split