blob: 1b55e2488a1dbe4e5bd46a6d0cb3e56ce7dc2070 [file] [log] [blame]
Bram Moolenaar8d043172014-01-23 14:24:41 +01001" 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.
20function! netrw_gitignore#Hide(...)
Bram Moolenaar5ef1c6a2019-11-10 22:09:11 +010021 return substitute(substitute(system('git ls-files --other --ignored --exclude-standard --directory'), '\n', ',', 'g'), ',$', '', '')
Bram Moolenaar8d043172014-01-23 14:24:41 +010022endfunction