2

I have posted about making fileformat=dos persistent in past years, here and here. So far, the best advice is :set fileformats=dos,unix hidden. It does cause fileformat=dos to persist, but only for a little while

If I use Netrw to view a folder, then press o on a file1 to split it open on a subwindow, I can issue :e ++ff=dos to get rid of the ^M marks at the end of (almost) every line. I can then close the subwindow, go to the next file file2 and do the same thing.

If I close file2 and press p on file1 to open it in a preview window, it seems fine. If I do the same for file2, however, then return to file1, I get the ^M again.

This loss of fileformat=dos is sporadic. That is, sometimes, it seems to OK, but at some point in switching between file1 and file2, it comes back. It seems to rear its head the most when I have two subwindows side-by-side, with Netrw on the left subwindow and the text file being inspected in the right subwindow (either in a preview window or a normal window).

Is there a more robust way to get fileformat=dos to stick to a buffer/file/subwindow?

1
  • I'm not sure if how persistent this solution is, but I :set fileformats= to nothing. According to the help, when this global option is empty, Vim looks at the buffer-local option fileformat. So with bufhidden=hide, the dos format seems to stick. For now. Jan 3 at 18:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.