netrw_gitignore.vim (1234B)
1 " netrw_gitignore#Hide: gitignore-based hiding 2 " Function returns a string of comma separated patterns convenient for 3 " assignment to `g:netrw_list_hide` option. 4 " Function can take additional filenames as arguments, example: 5 " netrw_gitignore#Hide('custom_gitignore1', 'custom_gitignore2') 6 " 7 " Usage examples: 8 " let g:netrw_list_hide = netrw_gitignore#Hide() 9 " let g:netrw_list_hide = netrw_gitignore#Hide() . 'more,hide,patterns' 10 " 11 " Copyright: Copyright (C) 2013 Bruno Sutic {{{1 12 " Permission is hereby granted to use and distribute this code, 13 " with or without modifications, provided that this copyright 14 " notice is copied with it. Like anything else that's free, 15 " netrw_gitignore.vim is provided *as is* and comes with no 16 " warranty of any kind, either expressed or implied. By using 17 " this plugin, you agree that in no event will the copyright 18 " holder be liable for any damages resulting from the use 19 " of this software. 20 function! netrw_gitignore#Hide(...) 21 return substitute(substitute(system('git ls-files --other --ignored --exclude-standard --directory'), '\n', ',', 'g'), ',$', '', '') 22 endfunction