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
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.
To save a file in Vim and exit, press Esc > Shift + ZZ. To exit Vim without saving, press Esc > Shift + ZX.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With