I'm trying to improve the command from neovim help that show diff between buffer and original file.
problem is the new buffer opens without syntax highlighting because it has no file type. so I tried to save the filetype into variables and registers but I'm unable to use it in the setf command later (even manually)
Here's my latest attempt:
command! DiffOrig call setreg('f', &filetype) | vert new | set buftype=nofile | read ++edit # | 0d_
\ | diffthis | setf @f | wincmd p | diffthis
In this attempt I manage to save the original filetype to register, but I don't manage to use it as argument for setf.
How can I make it work?