Question

I use fugitive vim plugin. with a map and BufferIsEmpty function, I close the diff buffer if this don't have changes.

I use this map

nn <silent><leader>g0 :w <bar> Gsplit! diff -U0 <bar>                                
    \ exec BufferIsEmpty() ? "q <bar> echomsg 'git: No changes'" : ''<CR>

but, I don't see the message No changes

Was it helpful?

Solution

I solved with redraw

nn <silent><leader>g0 :w <bar> Gsplit! diff -U0 <bar>                                
    \ exec BufferIsEmpty() ? "q <bar> redraw <bar> echomsg 'git: No changes'" : ''<CR> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top