Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficult to create single line file with one newline #500

Open
michaelforney opened this issue Feb 26, 2017 · 1 comment
Open

Difficult to create single line file with one newline #500

michaelforney opened this issue Feb 26, 2017 · 1 comment

Comments

@michaelforney
Copy link
Contributor

Since 181fe9a, I've found it difficult to create a single line file with vis.

If I input ifoo<Esc>:w, I get no newline character. If I try ifoo<Return><Esc>:w, I get two newline characters. To get a single one, I need to ifoo<Return><Backspace><Esc>:w, which seems a bit quirky. Maybe a way to fix this is to have vis insert a newline character when first character is entered in the document? I'm not sure. It seems the distinction between an empty document and a document containing a single empty line is kind of tricky to get right.

@martanne
Copy link
Owner

Yes this is a bit of a mess. Another possibility is to use ifoo<C-v><Enter> which also illustrates some of the issues the commit you referenced attempted to improve.

Making sure the file is always newline terminated before writing it would make ifoo<Esc>:w work. But in principle I don't really like it when editors perform these kind of modifications without being explicitly instructed to do so.

Vim has the binary (which might be useful anyway) and eol options to control these things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants