.config/nvim/autoload/vimrc.vim

changeset 1157
a237720efee9
parent 1155
fcec334dfe7a
equal deleted inserted replaced
1156:0a7162df160d 1157:a237720efee9
17 endif 17 endif
18 finally 18 finally
19 call delete(errors) 19 call delete(errors)
20 endtry 20 endtry
21 endfunc 21 endfunc
22
23 if has('ruby')
24 func! s:PruneFiles(path, days) abort
25 ruby <<END_RUBY
26 require 'pathname'
27
28 (path, days) = VIM.evaluate('[a:path, a:days]')
29 sunset = Time.now - (days * 86400)
30
31 Pathname(path).realpath.each_child do |file|
32 file.delete if file.mtime < sunset
33 end
34 END_RUBY
35 endfunc
36 else
37 func! s:PruneFiles(path, days) abort
38 endfunc
39 endif
40
41 func! vimrc#PruneFiles(path, days) abort
42 call s:PruneFiles(a:path, a:days)
43 endfunc
44

mercurial