3 ms·
I don’t think you even need to write, I have this shortcut[0]: nmap <leader>d :w !diff -u % -<CR> It writes the buffer’s content to diff’s stdin, and diff
by lloeki 6y ago
I don’t think you even need to write, I have this shortcut[0]:
nmap <leader>d :w !diff -u % -<CR>
It writes the buffer’s content to diff’s stdin, and diff gets passed the filename (hence the current on disk content) to compare vs stdin (hence the current buffer content).
Only I wish it were run automatically by vim in aforementioned cases before whining (case a: recover, run the above, if no diff stop complaining; case b: rewind til last save, run the above, if no diff then replay and save without complaining)
[0]: https://github.com/lloeki/vimfiles/blob/9c50f3be60e536518beb5d80637691c2207bf1ab/vimrc#L124 https://github.com/lloeki/vimfiles/blob/9c50f3be60e536518beb...