Mike Williams wrote:
> I noticed a problem with the fileformats option not being applied to the
> initial buffer when VIM is started without any initial buffer content.
> I mainly work on Windows and have fileformats=unix,dos so the default
> file format to be unix line-endings. However VIM on Windows starts new
> empty initial buffers with dos line-endings but if I start a new buffer
> with :new or :e with the name of file that did not exist then the
> fileformat is set to unix line-endings.
>
> The following patch applies fileformats to the initial buffer created by
> VIM. I have been using it for the last 9 months without any obvious
> issues. I have tested a couple of ways of feeding data into the initial
> buffer (such as C:> dir | vim -) and it does what I would expect. So
> can anyone see any issues with this patch?
>
> diff --git a/src/option.c b/src/option.c
> --- a/src/option.c
> +++ b/src/option.c
> @@ -3845,6 +3845,7 @@ term_bg_default(void)
> void
> set_init_3(void)
> {
> + int idx_ffs;
> #if defined(UNIX) || defined(WIN3264)
> /*
> * Set 'shellpipe' and 'shellredir', depending on the 'shell' option.
> @@ -4017,6 +4018,12 @@ set_init_3(void)
> }
> #endif
>
> + idx_ffs = findoption((char_u *)"ffs");
> + if (idx_ffs >= 0 && (options[idx_ffs].flags & P_WAS_SET))
> + {
> + set_fileformat(default_fileformat(), OPT_LOCAL);
> + }
> +
> #ifdef FEAT_TITLE
> set_title_defaults();
> #endif
I had that in the todo list, it slided down...
I think, to stay on the safe side, we should only do this when the
buffer is empty. I'll add a check for that.
--
>From "know your smileys":
=):-) Uncle Sam
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.