Skip to content

Commit

Permalink
do not initialize plugin for non readable files
Browse files Browse the repository at this point in the history
for example, fugitive is using temporary files like fugitive:///myfile.c for Gdiff, Gedit operations
  • Loading branch information
jreybert committed Oct 30, 2014
1 parent 095dfeb commit 7150159
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugin/clang.vim
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ au FileType c,cpp call <SID>ClangCompleteInit(0)
"}}}
"{{{ s:IsValidFile
func! s:IsValidFile()
return &filetype == "c" || &filetype == "cpp"
return ( &filetype == "c" || &filetype == "cpp" ) && filereadable(expand("%"))
endf
"}}}
"{{{ s:PDebug
Expand Down

1 comment on commit 7150159

@justmao945
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix will prevent to load plugin when use vim to create a new c/c++ file.

Please sign in to comment.