Code Monkey home page Code Monkey logo

sublime-line-endings-unify's People

Contributors

vontio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sublime-line-endings-unify's Issues

Doesn't ignore binary files

Hi @vontio,

This is part issue and part a plea for help :/

I recently ran this script in a sublime instance on my (Windows) development PC. Unfortunately I was under the impression that it would process open files, not every folder open in my project. I happened to have a large number of folders open at the time. As you would expect, this corrupted a very large number of binary files on my development computer (word documents, excel files, images, power points etc). The script also corrupted all my git repos (See #5).

Many of these were under git control - after blowing away the folders I could clone again and everything was fine. Unfortunately there were a handful of binary files that were only local, and not yet committed to version control. Some of these are very important files that I would very much like to recover.

  • Can you offer any advice in this regard? My understanding is that this script searches through the binary stream of each file, looking for instances of "\n" and replacing with "\r\n" (on a windows machine), or "\n\r and replacing with "\n" (on a Linux machine). Is this correct?
  • If my above assumption is correct, am I correct in my understanding that this is a lossy transform? I.e. instances of "\n" would then be co-mingled with instances of "\r\n" in the byte stream, making it non-trivial to reverse the process, recovering the binary file to it's original state?
  • Can you suggest any means for me to recover these files?

Suggestions from an issue point of view:

  • Make the README.md warning about backing up files much, much more prominent - maybe move to the top of the file?
  • Make the install.txt warning about backing up files much, much more prominent - maybe move to the top of the file?
  • Adjust the script to totally ignore binary files
  • Remove this package from Sublime Package Control - it's too dangerous for mere mortals.

Thanks for the assistance,

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3

The plugin crashes and this error is output to the console.

Traceback (most recent call last):
  File "LineEndingsUnify in /Users/alex/Library/Application Support/Sublime Text 3/Installed Packages/Line Endings Unify.sublime-package", line 37, in onInputExtensions
  File "LineEndingsUnify in /Users/alex/Library/Application Support/Sublime Text 3/Installed Packages/Line Endings Unify.sublime-package", line 22, in unifyLineEnding
  File "./encodings/ascii.py", line 26, in decode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 470: ordinal not in range(128)

I'm on a MacBook Air with ST3, stable channel, build 3083.

Additions, Ideas, Awesomeness ?

I came across this plug-in, because its a pain to manually change each file, every single time..
But just because i'm on windows doesnt mean i want windows line endings.

ADD Option to set Default TAB or SPACE, Personally I use the same settings for EVERY file,
if it set it every time on Auto, that would would be great.. Normally if you set the line ending then you ALSO set the tab or space as well, they kinda go hand in hand.

Some ideas to add onto this to make it better..

  • ADD Option to set Default TAB or SPACE
  • Create more options in Default.settings file, so the User.settings can change.
  • Set either 1 type of line ending for ALL file types or set by the type of file
  • ex settings file.
{
    "global": {
        "use_global": true,
        "per_fileType": false
    },
    "global_settings": {
        "charset": "UTF-8",
        "line_ending": "unix",
        "indent": ["tab", "4"]
    },
    "per_file_settings": {
        "php": ["UTF-8", "unix", "tab", "4"],
        "html": ["UTF-8", "unix", "space", "3"]
    }
}

You get the idea, but you can either set a GLOBAL or PER_FILETYPE.. GLOBAL overrides everything

This would be the PERFECT Plug-In, is it possible to make this run ON FILE OPEN ?
every file that is opened, it would Auto Set these properties.

doesn't ignore .git folder

So it crashes when it tries to run.

It should probably ignore hidden folders by default, or at least provide an option to ignore a list of folders (with some sensible defaults)

Can it be an open source project?

Searching through the repository I cannot find any mention to open source licence. By this project being on Github, I am allowed to fork it by the Github TOS (Terms Of Service). However I am not allowed to create derivative works from it (pull requests). Meaning I cannot fork this repository, change its code and perform pull requests without the danger/liability of being prosecuted by violating the All rights reserved copyright granted by berne convention law.

The original prime theme for Sublime Text has the licence following open source licence:

The MIT License (MIT)

Copyright (c) 2014 Karel Vuong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
  1. https://github.com/karelvuong/st-primer/blob/master/LICENSE

Can the project have the same licence?


Related issues:

  1. gamcoh/QuickEdit#2 Can it be an open source project?
  2. SublimeText/LaTeXTools#1175 Can it be an open source project?

Does not change line endings in files without extensions

In the node_modules folder in the @babel library, a LICENSE file without any extension was found in several dozen subfolders. The line endings in these files were not changed by the plugin, which required manual changes. Trying to use a space or two commas in a row in the selection of extensions did not have any effect.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.