Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

UNIX/Mac or Windows text format option for line endings #2822

Closed

Description

@bently0602

Developing on windows machine for running on linux machines doesnt work without running through a converter. Could there be an option to switch between the different kind of formats? I'm running a Windows build of Atom v.107 and it defaults to Windows line endings when editing.

Activity

  1. jasonhansel commented on Jul 11, 2014

    @jasonhansel

    👍

  2. screendriver commented on Oct 28, 2014

    @screendriver

    +1

  3. stephanfriedrich commented on Nov 17, 2014

    @stephanfriedrich

    👍

  4. diazemiliano-zz commented on Nov 20, 2014

    @diazemiliano-zz

    👍

  5. Trudko commented on Dec 12, 2014

    @Trudko

    👍

  6. hpcsc commented on Dec 15, 2014

    @hpcsc

    👍

  7. tbuckl commented on Jan 20, 2015

    @tbuckl

    👍

  8. ipaq3115 commented on Feb 2, 2015

    @ipaq3115

    👍

  9. esterp commented on Feb 4, 2015

    @esterp

    👍

  10. jessebarocio commented on Feb 9, 2015

    @jessebarocio

    👍

  11. sbrech commented on Feb 11, 2015

    @sbrech

  12. konstantin-popov commented on Feb 13, 2015

    @konstantin-popov

    👍

  13. mocathe1st commented on Mar 2, 2015

    @mocathe1st

    👍

  14. 28 remaining items

  15. supersonicclay commented on Jun 22, 2015

    @supersonicclay

    +1

  16. supersonicclay commented on Jun 23, 2015

    @supersonicclay

    This may be too aggressive for some. But if you want to ensure you always have one type of line ending, you can place this in your init script (~/.atom/init.coffee). Just change preferredLineEnding to whatever you'd like.

    #borrowed from https://atom.io/packages/line-ending-converter
    atom.workspace.observeTextEditors (editor) ->
        editor.getBuffer().onWillSave ->
            preferredLineEnding = '\r\n'
            buffer = editor.getBuffer()
            lastRowIndex = buffer.getLastRow()
            buffer.transact ->
                for rowIndex in [0...lastRowIndex]
                    do (rowIndex) ->
                        currEol = buffer.lineEndingForRow rowIndex
                        if currEol isnt preferredLineEnding
                            lineEndingRange = new Range(
                                new Point(rowIndex, buffer.lineLengthForRow(rowIndex)),
                                new Point(rowIndex + 1, 0)
                            )
                            buffer.setTextInRange lineEndingRange, preferredLineEnding,
                                { normalizeLineEndings: false }
    
  17. jahio commented on Jun 24, 2015

    @jahio

    Clay, thanks for posting this, that's really useful!

  18. photofroggy commented on Jun 26, 2015

    @photofroggy

    👍 seems like a massive oversight.

    I have git on windows set up to commit and checkout as-is rather than converting line-endings.

  19. famousgarkin commented on Jul 3, 2015

    @famousgarkin

    +1

  20. dead-claudia commented on Jul 4, 2015

    @dead-claudia

    +1...this is definitely an oversight. At least the case I need this for has a .gitattributes file, but it's already annoying, and I haven't even started the work yet.

  21. 3ffy commented on Jul 5, 2015

    @3ffy

    I love atom, packages and everything, then i came across this "bug" and decided to still use my old sublime text editor :( ... I don't get how it's possible to publish an editor who can't handle linebreaks it's pretty or less the first thing i would have coded ! I don't want to be rude, i really love the work done so far, that's why i'm so disapointed to have to don't use it :(. Please work on this asap...

    👍

  22. MattiJarvinen commented on Jul 7, 2015

    @MattiJarvinen

    This shows a major disregard of Windows users from project managers' side. I really hope they get this sorted out.

    While reading comments on this issue, issue voting would remove useless +1 comments.

  23. dead-claudia commented on Jul 7, 2015

    @dead-claudia

    To be honest, this seems perfect for an Atom extension, one that may not last long out of core, but would be vital until then.

  24. jqol commented on Jul 31, 2015

    @jqol

    +1

  25. mnquintana commented on Jul 31, 2015

    @mnquintana
    Contributor

    Thanks for the feedback everyone! However, all these +1s and 👍s are just adding noise, so to minimize that I'm going to lock this issue for now – this is currently being worked on as part of the Quality Initiative.

  26. locked and limited conversation to collaborators on Jul 31, 2015
  27. maxbrunsfeld commented on Aug 27, 2015

    @maxbrunsfeld
    Contributor

    Atom 1.0.8 will include the line-ending-selector package, which I hope will address this issue. Sorry for the long wait everybody.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions