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

Format paragraph does not respect unix line endings #2561

Closed
Loffe opened this issue May 23, 2019 · 3 comments · Fixed by #2562
Closed

Format paragraph does not respect unix line endings #2561

Loffe opened this issue May 23, 2019 · 3 comments · Fixed by #2562
Assignees
Labels
Milestone

Comments

@Loffe
Copy link

Loffe commented May 23, 2019

Using gq to format a block of text inserts windows line endings (CRLF), even though the file is in unix encoding (LF).

Expected behavior is to use the current line ending character.

Related issues: #621 #333

@ricksladkey ricksladkey self-assigned this May 23, 2019
@ricksladkey ricksladkey added this to the 2.7.0 milestone May 23, 2019
@ricksladkey
Copy link
Collaborator

I can reproduce this bug.

@ricksladkey
Copy link
Collaborator

ricksladkey commented May 23, 2019

Other operations that attempt, but may fail, to use the correct line endings:

  • sort
  • filter
  • replace selection with character
  • put text at the end of a buffer without a final newline

@ricksladkey
Copy link
Collaborator

To clarify, this actually works correctly if the line endings are being strictly enforced by an editor config setting.

For example, if there is an applicable EditorConfig configuration file that says:

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

Then the following code will properly set: DefaultOptions.NewLineCharacterOptionId and as a result, VsVim EditorUtil.NewLine will return "\n":

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

Successfully merging a pull request may close this issue.

2 participants