Permalink
Browse files

Filter &suffixes in s:entries().

Instead of hardcoded file extensions (".swp" and "~") use the &suffixes
setting to filter out any uninteresting entries.
  • Loading branch information...
1 parent f44666c commit 241785fcb8331c482355cee6c817a491dcca47d1 @blueyed blueyed committed with Mar 28, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 plugin/unimpaired.vim
@@ -35,7 +35,11 @@ function! s:entries(path)
let files += split(glob(path."/*"),"\n")
call map(files,'substitute(v:val,"[\\/]$","","")')
call filter(files,'v:val !~# "[\\\\/]\\.\\.\\=$"')
- call filter(files,'v:val[-4:-1] !=# ".swp" && v:val[-1:-1] !=# "~"')
+
+ " filter out &suffixes
+ let filter_suffixes = substitute(escape(&suffixes, '~.*$^'), ',', '$\\|', 'g') .'$'
+ call filter(files, 'v:val !~# filter_suffixes')
+
return files
endfunction

0 comments on commit 241785f

Please sign in to comment.