Skip to content

Commit

Permalink
use rustup doc --path (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Aug 12, 2018
1 parent e76def0 commit c759d47
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions autoload/rust_doc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ function! rust_doc#find_std_doc_dir() abort
if g:rust_doc#downloaded_rust_doc_dir !=# '' && isdirectory(g:rust_doc#downloaded_rust_doc_dir)
let d = g:rust_doc#downloaded_rust_doc_dir
endif
let rustup = expand('~/.rustup/toolchains/')
if isdirectory(rustup)
let toolchains = s:globpath(rustup, '*')
if executable('rustup')
let rustup_doc_index = substitute(system('rustup doc --path'), '\n$', '', '')
if !v:shell_error
return fnamemodify(rustup_doc_index, ':h')
endif
endif
let toolchains_dir = expand('~/.rustup/toolchains/')
if isdirectory(toolchains_dir)
let toolchains = s:globpath(toolchains_dir, '*')
let dirs = filter(toolchains, 'stridx(v:val, "stable-") >= 0')
if empty(dirs)
" Fallback to nightly
Expand Down

0 comments on commit c759d47

Please sign in to comment.