GithubHelp home page GithubHelp logo

doi9t / sortby Goto Github PK

View Code? Open in Web Editor NEW
35.0 2.0 11.0 120 KB

A Sublime Text plugin that allows you to sort lines with methods that are not present by default.

License: Apache License 2.0

Python 100.00%
sublime-text sort sorting sublime-text-plugin sublime-text-package

sortby's Introduction

Hello ! ๐Ÿ‘‹

You can also find me on Gitlab (Main account)

sortby's People

Contributors

doi9t avatar

Stargazers

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

Watchers

 avatar  avatar

sortby's Issues

Key bindings?

Is there a way to use this tool with key bindings?

Sort by floats

The same as sort by integer, except for numbers which may contain a decimal point. Note that if implemented in such a way that decimal point is not required, this sort becomes a superset of integer sort.

Option to sort by frequency

Proposal:
Add option to sort each line by how often it occurred

Implementation:

  1. Do a pass over document to count line frequencies
  2. Order all the lines using the the line frequency as the sort key

I may implement this later and submit a pull request.

Request: Randomize lines

It would be a nice feature to have a "Sort by random" or something, to quickly shuffle all the lines into a random order.

Thanks!

Add case sensitivity option

There may be boolean value in a SortBy.sublime-settings file. Default false is good I think.

{
    "case_sensitive": false
}

Sort by the last letter

I have a tables list that I want to sort by the last letter. Because those tables are classified by suffix.

Unicode problem

Hello.

I have a text
"
ั‚ะตัั‚
ั‚ัั‚
"
Tools -> Doi9t -> SortBy -> Length of lines
error:
Traceback (most recent call last):
File "./sublime_plugin.py", line 356, in run_
File "./sortby.py", line 58, in run
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

Sort by length of line + alphabetically

Sometimes I need to sort lines by length, but keeping alphabetical order between the lines with identical length. It can be achieved by sorting alphabetically first and then by the length.

How about creating separate sort mode for this, so we could use just one step instead of two? This way of sorting is very useful if we want to keep the code tidy, for example I like to have PHP's use statements ordered this way.

Apply to file if no selection

When there is not any selection, the plugin can apply the selected sort type to the whole file. This is the default behaviour of the native sorting feature.

Natural Order - Should a Postfix Character Affect Numerical Sort Order?

If I run natural order sort on this set {1,1-1,1-2}, I get the expected sorted order of:

1
1-1
1-2

However, if I do it on the set {1a, 1-1a, 1-2a}, then the sorted order becomes:
1-1a
1-2a
1a

To me at least, I think the natural human sort order for these two sets should be the same, with 1/1a first. Am I alone in this?

Sort with multiple selections

Sublime Text provides a functionality via Edit > Permute Selections > Sort menu. This works like this:

When you select random words from the text and click the sort menu above, it sorts these words in place. Only words switches each other's place. No other text is edited. This functionality can be added to SortBy. However, I agree that this is not an easy thing to implement.

An example: (Bold words represent multiple selection)

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo

After the sort: (bolds are sorted and they are still in a selection)

Lorem ipsum dolor sit amet, aliquip adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud consectetur ullamco laboris nisi ut exercitation ex ea commodo

On Linux, shortcut `ctrl+shift+alt+u` is used to enter a Unicode character

I have recently installed your extension, but since then I could not use Ctrl+Shift+Alt+u shortcut to enter Unicode letters in Sublime Text. That shortcut (alongside with Ctrl+Shift+u, which does not work in ST, at least in ST3+) is used to enter Unicode characters on Linux.

Now I am able to disable a shortcut using (for example) a noop command, but I am not able to restore the original behaviour (i.e. prior to asigning your command to that shortcut) without editing Default.sublime-keymap (L68-78) in your repo.

Could your fix this issues please? ๐Ÿ˜‰

How to short below values?

"error_code_21": "Update mode.",
"error_code_211": "Server UnRechable",
"error_code_24": "OPERATION FAILED",
"error_code_349": "Memory failed",
"error_code_4": "Error setting sal session",
"error_code_413": "SIZE EXCEED",
"error_code_414": "UPLOAD FAILED",
"error_code_50": "Error",
"error_code_500": "Error",

I need like below

"error_code_4": "Error setting sal session",
"error_code_21": "Update mode.",
"error_code_24": "OPERATION FAILED",
"error_code_50": "Error",
"error_code_211": "Server UnRechable",
"error_code_349": "Memory failed",
"error_code_413": "SIZE EXCEED",
"error_code_414": "UPLOAD FAILED",
"error_code_500": "Error",

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.