On Thu, Jul 09, 2015 at 03:09:58AM +0200, Olaf Dabrunz wrote:
> However, I believe the final EOL in a file should be made visible and
> editable.
> 
> Consider this:
> 
>         file A                      file B
> 
>     ,-------------------.       ,-------------------.
>     |...                |       |...                |
>     |Last line          |       |Last line          |
>     |~                  |       |                   |   <-- lookie here
>     |~                  |       |~                  |
>     `-------------------´       `-------------------´
> 
>       ends on 'Last line'         ends on an empty line
> 
> 
> If vim had a mode where it *never* adds a newline on the last line when
> writing a file, then vim would write file A without a final EOL, and
> file B with a final EOL, and no other differences.

This is just propagating the misconception that the EOL is a new line,
instead of an indicator of the end of the current line.  Why should I
add a blank line, that isn't really a line, to get an EOL on the just
previous non-blank line?

> And when vim is in that mode, when reading a file, vim would make it
> show up like file A when the file has no newline at the end, and like
> file B when it has a newline at the end.
> 
> This way, it becomes clearly visible in the editor what the file
> contains, and the user can change it too.

While making it easier to accomodate the myriad applications that don't
understand EOL is useful, misrepresenting the contents of the file
doesn't seem like the right way to do it.

The exact behavior you're describing is one of the things that annoys me
about Emacs, because I still haven't internalized the fact that it
allows me to place the cursor past the last line in the buffer.  This
leads to the fun behavior of me deleting the last “line”, saving the
buffer, and the last “line” reappearing because it properly re-adds the
EOL.

I haven't followed the discussion about 'respecteol' closely, but this
is the behavior I'd expect based on the name:

1. 'norespecteol' (default) means that an EOL is always added unless
   'eol' + 'bin' are set, i.e. Vim's existing behavior.
2. Opening an existing file when 'respecteol' is set honors the current
   state of the EOL on the last line, and should set 'eol' accordingly.
3. If a user wishes a new, unsaved buffer to not have an EOL on the last
   line, she can set 'respecteol' and 'noeol'.

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <james...@jamessan.com>

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui