Switch between diffchar and the default diff method without restarting vimdiff
This is exactly my question, but the answer is outdated: https://stackoverflow.com/questions/28407691/vim-disable-plugin-by-default-diffchar
In vim8, I put this plugin in the ~/.vim/.../opt/ folder. Then, how do I enable the plugin when I'm looking at the two files in vimdiff?
How about using packadd command to load the plugin? Or you could locate the plugin in .../start/ folder. g:DiffExpr is not used now.
I put the plugin in the opt folder, start vimdiff on two files, type packadd. I now still see the normal (non-diffchar) diff result.
What what command do I issue now to see the diffchar diffs?
If you locate the plugin in opt folder, it is not loaded at vim startup. You can use -c 'packadd diffchar' option or add 'packadd diffchar' in your vimrc. If possible, it might be better to locate them in start folder so that it is automatically loaded at sartup
Starting vimdiff with -c 'packadd diffchar.vim' on the command line works. Thank you!
Out of curiosity: would you know a way to load and activate the plugin after vimdiff has started? I mean, without quitting vimdiff and starting vimdiff again using the CLI option above? It would be a very useful feature to be able to toggle!
You can use diffthis and diffoff commands on any windows, Check to see :help diff.
The feature I'm interested in is maybe better described as: "switch between diffchar and the default diff method without restarting vimdiff".
I updated the title to hopefully be more descriptive
I see you want to toggle diff mode windows between with and without diffchar plugin. This is a kind of a private option, but if you set 1 to g:NoDiffChar variable, the plugin does nothing. Try to set 0 or 1 to the variable after or before diffthis and diffoff.
cool! I'll use a function to do this:
let g:NoDiffChar=1
function! DiffToggle()
let g:NoDiffChar = g:NoDiffChar? 0: 1
diffoff | diffthis
endfunction
Hi, is it possible close this issue?