Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you exit vimdiff mode in vim, specifically, for Fugitive?

I am using vim with the fugitive extension. It has a :Gdiff command which brings you into vimdiff mode, but what is the right/quick way to close/quit vimdiff mode?

I.e., let's say I am editing the file FooBar.txt under Git repository. I fire up :Gdiff, review my changes in vimdiff, and then I want to get back and continue editing FooBar.txt or any other file :)

UPDATE1: I'm going to give these quick combos a try next working day :)

"vimdiff current vs git head (fugitive extension) nnoremap <Leader>gd :Gdiff<cr>  "switch back to current file and closes fugitive buffer nnoremap <Leader>gD :diffoff!<cr><c-w>h:bd<cr> 

UPDATE2: My current mappings (closes diff window only!)

"vimdiff current vs git head (fugitive extension) nnoremap <Leader>gd :Gdiff<cr>  "switch back to current file and closes fugitive buffer nnoremap <Leader>gD <c-w>h<c-w>c 

Also, please help me decide if the following should be an anwser: https://stackoverflow.com/a/15975201/275980

like image 941
wik Avatar asked Apr 24 '10 07:04

wik


People also ask

How do you escape Vimdiff?

Quiting vimdiff You can save modified files in each window with the :w command and quit an individual buffer window with the :q command. This will take some time for multiple windows. The command :qa quits all file windows if no files have been modified.

How do I exit Vimdiff without saving?

To save a file in Vim and exit, press Esc > Shift + ZZ. To exit Vim without saving, press Esc > Shift + ZX.


1 Answers

You can execute windo set nodiff noscrollbind and then close the second window.

Update: there is a diffoff command. Use windo diffoff, not what I wrote in previous line.

like image 164
ZyX Avatar answered Oct 06 '22 01:10

ZyX