From 418b222e80369c3e6ac2bd593f4dfdbb49e6d999 Mon Sep 17 00:00:00 2001 From: Daniel Moch Date: Sat, 3 Dec 2016 14:17:51 -0500 Subject: [PATCH] Handle whitespace in arguments --- plugin/makejob.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/makejob.vim b/plugin/makejob.vim index 4efe756..eeefbde 100644 --- a/plugin/makejob.vim +++ b/plugin/makejob.vim @@ -1,7 +1,7 @@ " " TITLE: VIM-MAKEJOB " AUTHOR: Daniel Moch -" VERSION: 1.1 +" VERSION: 1.1.1-dev " if exists('g:loaded_makejob') || version < 800 || !has('job') || \ !has('channel') || !has('quickfix') @@ -96,7 +96,8 @@ function! s:MakeJob(grep, lmake, grepadd, bang, ...) echohl None return endif - if a:0 + " Need to check for whitespace inputs as well as no input + if a:0 && (a:1 != '') if a:grep if internal_grep let make = 'vimgrep '.a:1 @@ -106,7 +107,8 @@ function! s:MakeJob(grep, lmake, grepadd, bang, ...) let make = [&shell, &shellcmdflag, make.' '.a:1] endif else - let make = make.' '.expand(a:1) + let trimmed_arg = substitute(a:1, '^\s\+\|\s\+$', '', 'g') + let make = make.' '.expand(trimmed_arg) end endif