Created
May 22, 2016 03:16
-
-
Save h14i/ed1382481a14ee54e9613fa49e1ca2ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" find_rust_std.vim | |
scriptencoding utf-8 | |
function! FindRustStd(fname) | |
let fname = '*' . substitute(tolower(a:fname), '::', '/', 'g') . '.rs' | |
" echo fname | |
let found = globpath(s:path, fname) | |
if found != '' | |
return found | |
endif | |
let fname = substitute(fname, '/[^/]\{-}\.rs$', '/mod.rs', '') | |
" echo fname | |
let found = globpath(s:path, fname) | |
if found != '' | |
return found | |
endif | |
let fname = substitute(fname, '/[^/]\{-}\.rs$', '*', '') | |
" echo fname | |
let found = globpath(s:path, fname) | |
if found != '' | |
return found | |
endif | |
return '' | |
endfunction | |
let s:path = expand('$RUST_SRC_PATH') | |
let s:duration = 'std::time::Duration' | |
echo FindRustStd(s:duration) | |
echo "" | |
let s:instant = 'std::time::Instant' | |
echo FindRustStd(s:instant) | |
echo "" | |
let s:mutex = 'std::sync::mutex::Arc' | |
echo RustIncludeExpr(s:mutex) | |
echo "" | |
let s:chars = 'std::io::Chars' | |
echo RustIncludeExpr(s:chars) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment