I followed the advice here to make only one buffer hidden so that it remembers settings like fileformat=dos
:
set bufhidden=hide " This should be the solution
e ++ff=dos " All the ^M symbols disappear (yay)
e " All the ^M symbols reappear (boo)
setl ff " Shows as unix (boo)
set ff " Shows as unix (boo)
- The
set bufhidden=hide
is supposed to be the solution. - The
e ++ff=dos
makes the^M
symbols disappear from the ends of the lines (they were only present on some lines). - The
e
brings the^M
symbols back! - The
setl ff
andset ff
commands confirm that thefileformat
reverted back tounix
instead of stayingdos
.
What am I doing wrong? Is there a solution that will persist?
I thought that my problem might be having set nomodifiable
and readonly
, but reversing both of these doesn't solve the problem.
I'm not sure if it matters, but the the buffer of interest is opening a Spyder command history file. Spyder frequently updates the file and I want to use Vim to yank content into (say) tmp.txt
for manipulation.
'fileformats'
(alias'ffs'
)?:edit
or:edit %
intentionally reloads current file (:h reload
) and so it also forcesff
re-detection. Just don't do this.set autoread
and no worries.:e +ff=dos
. Bind it to a mapping, for example.'ffs'
right before loading that particular file (filetype?) then restore it afterwards. Generally, you want to have autodetect on so if you can figure out how to disable it temporarily/situationally that's ideal. BTW, does it work if you (temporarily):set ffs=dos,unix
and don't pre-setff
? I'm wondering if autodetect will choose the opposite of what you're getting when you reverse order of the params as they are order dependent. (No big deal...just curious.)