From a1f9704f769dac63dacd048cdc7a22b93a72e7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20B=C3=A9rtolo?= Date: Sat, 1 Oct 2016 15:46:46 -0300 Subject: [PATCH 1/2] Fixed a bug caused by paths with spaces in Windows. --- autoload/clang_format.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/clang_format.vim b/autoload/clang_format.vim index e73df57..2187897 100644 --- a/autoload/clang_format.vim +++ b/autoload/clang_format.vim @@ -109,7 +109,11 @@ endfunction function! clang_format#is_invalid() if !exists('s:command_available') - if ! executable(g:clang_format#command) + " if running on windows and the path has spaces it needs to be quoted, + " but executable() get confused by the quotes, so we remove them + if has("win32") && !executable(split(g:clang_format#command, '"')[0]) + return 1 + elseif !has("win32") && !executable(g:clang_format#command) return 1 endif let s:command_available = 1 From 01e6dd5e64514192433a18d7290244fdb9f5957a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20B=C3=A9rtolo?= Date: Sun, 2 Oct 2016 13:46:37 -0300 Subject: [PATCH 2/2] Reformatted code following suggestions. --- autoload/clang_format.vim | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/autoload/clang_format.vim b/autoload/clang_format.vim index 2187897..bd3574c 100644 --- a/autoload/clang_format.vim +++ b/autoload/clang_format.vim @@ -110,13 +110,15 @@ endfunction function! clang_format#is_invalid() if !exists('s:command_available') " if running on windows and the path has spaces it needs to be quoted, - " but executable() get confused by the quotes, so we remove them - if has("win32") && !executable(split(g:clang_format#command, '"')[0]) - return 1 - elseif !has("win32") && !executable(g:clang_format#command) - return 1 - endif - let s:command_available = 1 + " but executable() get confused by the quotes, so we remove them + if has("win32") || has("win64") + if !executable(split(g:clang_format#command, '"')[0]) + return 1 + endif + else !executable(g:clang_format#command) + return 1 + endif + let s:command_available = 1 endif if !exists('s:version')