Skip to content
Snippets Groups Projects
Commit b6bbb17e authored by Tim Pope's avatar Tim Pope
Browse files

Expose IO functions as object

This is a new interface to a slightly older API for performing standard
VimL IO functions against URLs (or any other URLs, the interface is
generic).  Example wrapper function:

       function! IO(fn, ...) abort
         let file = a:fn ==# 'writefile' ? a:2 : a:1
         let obj = get(g:, 'io_' . matchstr(file, '^\a\a\+'), {})
         return call(get(obj, a:fn, a:fn), a:000)
       endfunction
       echo IO('filereadable', @%)
parent 9dcf1d7d
No related branches found
No related tags found
No related merge requests found
......@@ -336,3 +336,20 @@ augroup fugitive
autocmd User ProjectionistDetect call s:ProjectionistDetect()
augroup END
let g:io_fugitive = {
\ 'simplify': function('fugitive#simplify'),
\ 'resolve': function('fugitive#resolve'),
\ 'getftime': function('fugitive#getftime'),
\ 'getfsize': function('fugitive#getfsize'),
\ 'getftype': function('fugitive#getftype'),
\ 'filereadable': function('fugitive#filereadable'),
\ 'filewritable': function('fugitive#filewritable'),
\ 'isdirectory': function('fugitive#isdirectory'),
\ 'getfperm': function('fugitive#getfperm'),
\ 'setfperm': function('fugitive#setfperm'),
\ 'readfile': function('fugitive#readfile'),
\ 'writefile': function('fugitive#writefile'),
\ 'glob': function('fugitive#glob'),
\ 'delete': function('fugitive#delete'),
\ 'Real': function('FugitiveReal')}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment