diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2017-01-16 21:30:47 +0900 |
---|---|---|
committer | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2017-01-16 21:30:47 +0900 |
commit | 5402d024886b0b48d71718852f8b1b6eef5a9ecf (patch) | |
tree | 19f79f05cd2825ef096bb9862ed8d50d1a2c85f8 | |
parent | 41e2e315cf26722be0d3977b000db526fccad20a (diff) | |
download | deoplete.nvim-5402d024886b0b48d71718852f8b1b6eef5a9ecf.zip |
Add context['bufpath']
-rw-r--r-- | autoload/deoplete/init.vim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/autoload/deoplete/init.vim b/autoload/deoplete/init.vim index 133911a..4789567 100644 --- a/autoload/deoplete/init.vim +++ b/autoload/deoplete/init.vim @@ -192,6 +192,12 @@ function! deoplete#init#_context(event, sources) abort let width = winwidth(0) - col('.') + len(matchstr(input, '\w*$')) + let bufname = bufname('%') + let bufpath = fnamemodify(bufname, ':p') + if &l:buftype =~ 'nofile' || !filereadable(bufpath) + let bufpath = '' + endif + return { \ 'changedtick': b:changedtick, \ 'event': event, @@ -213,7 +219,8 @@ function! deoplete#init#_context(event, sources) abort \ 'max_menu_width': (width * 2 / 3), \ 'runtimepath': &runtimepath, \ 'bufnr': bufnr('%'), - \ 'bufname': bufname('%'), + \ 'bufname': bufname, + \ 'bufpath': bufpath, \ 'cwd': getcwd(), \ 'start_complete': "\<Plug>_", \ 'vars': filter(copy(g:), "stridx(v:key, 'deoplete#') == 0"), |