From 95b27d9da95f8e40143db032547c9e58c20a888e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 15 Jul 2018 01:44:41 +1200 Subject: Add plugin file for setting 'wildignore' --- vim/plugin/wildignore.vim | 170 ++++++++++++++++++++++++++++++++++++++++++++++ vim/vimrc | 1 + 2 files changed, 171 insertions(+) create mode 100644 vim/plugin/wildignore.vim (limited to 'vim') 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 -- cgit v1.2.3