stardiviner
11/7/2012 - 3:14 AM

vim-rsense get buffer function compatiable with neocomplcache

vim-rsense get buffer function compatiable with neocomplcache

function! s:rsenseCurrentBufferFile()
    if exists('*neocomplcache#get_context_filetype_range')
      let start = neocomplcache#get_context_filetype_range()[0][0]
      let end = neocomplcache#get_context_filetype_range()[1][0]
    else
      let start = 1
      let end = '$'
    endif
    let buf = getline(start, end)
    let file = tempname()
    call writefile(buf, file)
    return file
endfunction