-2

While doing a fun vim exercise I ran into an odd redraw problem.

nmap goo :execute ':call GoogleIt("' . input("What would you like to google?: ") . '")'<cr>

function GoogleIt(content)
        silent execute "!ggl " . a:content 
        redraw
endfunction

Silent works, but the redraw function only redraws the first line of the file that I was working in. Any suggestions or answers?

3

Very simple fix, simply add an !. Change:

silent execute "!ggl " . a:content 
        redraw
endfunction

to:

silent execute "!ggl " . a:content 
        redraw!
endfunction

From :help redraw

When ! is included it is cleared first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.