From 75e4d9583832c158a9c0927cdb087e4555434993 Mon Sep 17 00:00:00 2001 From: Damien Radtke Date: Tue, 4 Nov 2014 14:08:57 -0600 Subject: [PATCH] Added check for absolute file path, removed hard tab, and added documentation for new option. --- src/etc/vim/compiler/cargo.vim | 10 +++++++--- src/etc/vim/doc/rust.txt | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/etc/vim/compiler/cargo.vim b/src/etc/vim/compiler/cargo.vim index 8b646595c6a2..ed487a308e19 100644 --- a/src/etc/vim/compiler/cargo.vim +++ b/src/etc/vim/compiler/cargo.vim @@ -23,9 +23,13 @@ endif " support variations like 'cargo.toml'. let s:cargo_manifest_name = get(g:, 'cargo_manifest_name', 'Cargo.toml') +function! s:is_absolute(path) + return a:path[0] == '/' || a:path =~ '[A-Z]\+:' +endfunction + let s:local_manifest = findfile(s:cargo_manifest_name, '.;') if s:local_manifest != '' - let s:local_manifest = fnamemodify(s:local_manifest, ':p:h').'/' + let s:local_manifest = fnamemodify(s:local_manifest, ':p:h').'/' augroup cargo au! au QuickfixCmdPost make call s:FixPaths() @@ -43,14 +47,14 @@ if s:local_manifest != '' let manifest = m[1].'/' " Manually strip another slash if needed; usually just an " issue on Windows. - if manifest =~ '^/[A-Z]:/' + if manifest =~ '^/[A-Z]\+:/' let manifest = manifest[1:] endif endif continue endif let filename = bufname(qf.bufnr) - if filereadable(filename) + if s:is_absolute(filename) continue endif let qf.filename = simplify(manifest.filename) diff --git a/src/etc/vim/doc/rust.txt b/src/etc/vim/doc/rust.txt index 80f8c3ca5e1e..1693714f2154 100644 --- a/src/etc/vim/doc/rust.txt +++ b/src/etc/vim/doc/rust.txt @@ -79,6 +79,13 @@ g:ftplugin_rust_source_path~ let g:ftplugin_rust_source_path = $HOME.'/dev/rust' < + *g:cargo_manifest_name* +g:cargo_manifest_name~ + Set this option to the name of the manifest file for your projects. If + not specified it defaults to 'Cargo.toml' : > + let g:cargo_manifest_name = 'Cargo.toml' +< + ============================================================================== COMMANDS *rust-commands*