Skip to content

Commit 75e4d95

Browse files
author
Damien Radtke
committed
Added check for absolute file path, removed hard tab, and added documentation for new option.
1 parent 0207e25 commit 75e4d95

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/etc/vim/compiler/cargo.vim

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ endif
2323
" support variations like 'cargo.toml'.
2424
let s:cargo_manifest_name = get(g:, 'cargo_manifest_name', 'Cargo.toml')
2525

26+
function! s:is_absolute(path)
27+
return a:path[0] == '/' || a:path =~ '[A-Z]\+:'
28+
endfunction
29+
2630
let s:local_manifest = findfile(s:cargo_manifest_name, '.;')
2731
if s:local_manifest != ''
28-
let s:local_manifest = fnamemodify(s:local_manifest, ':p:h').'/'
32+
let s:local_manifest = fnamemodify(s:local_manifest, ':p:h').'/'
2933
augroup cargo
3034
au!
3135
au QuickfixCmdPost make call s:FixPaths()
@@ -43,14 +47,14 @@ if s:local_manifest != ''
4347
let manifest = m[1].'/'
4448
" Manually strip another slash if needed; usually just an
4549
" issue on Windows.
46-
if manifest =~ '^/[A-Z]:/'
50+
if manifest =~ '^/[A-Z]\+:/'
4751
let manifest = manifest[1:]
4852
endif
4953
endif
5054
continue
5155
endif
5256
let filename = bufname(qf.bufnr)
53-
if filereadable(filename)
57+
if s:is_absolute(filename)
5458
continue
5559
endif
5660
let qf.filename = simplify(manifest.filename)

src/etc/vim/doc/rust.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ g:ftplugin_rust_source_path~
7979
let g:ftplugin_rust_source_path = $HOME.'/dev/rust'
8080
<
8181

82+
*g:cargo_manifest_name*
83+
g:cargo_manifest_name~
84+
Set this option to the name of the manifest file for your projects. If
85+
not specified it defaults to 'Cargo.toml' : >
86+
let g:cargo_manifest_name = 'Cargo.toml'
87+
<
88+
8289
==============================================================================
8390
COMMANDS *rust-commands*
8491

0 commit comments

Comments
 (0)