Git Product home page Git Product logo

nova-text-tools's People

Contributors

biati-digital avatar guillaumealgis avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

nova-text-tools's Issues

Fix "Make Camel Case" on disjointed multiple selection

When applying text transformation on multiple blocks of texts, the result is buggy.

Here's a video of me trying to apply a transformation (snake case to camel case) on multiple chunks all at once (buggy) then one by one (works fine, but tedious process) :

Enregistrement.de.l.ecran.2022-04-29.a.18.49.29.mov

Minify ?

Is there a way to "minify" ( remove all extra spaces and line-breaks ) from a selection using Text Tools?

[Feature Request] Non-breaking space

We would like to have the possibility to insert a non-breaking space  

In Coda2 there was an extension "WrapItUp" that could do this.

Thanks!

Doesn't work on nova 7.5 (build 316195)

This is a very useful extension, thanks a bunch!

However, I don't get it to work on nova 7.5. I've tried to reverse lines, but nothing happens. In fact, none of the commands does anything.

Screen Shot 2021-10-23 at 13 24 48

Also, the extension console doesn't log anything.

Any idea what could be the problem here?

Sort lines preserving separator

How about a line sort feature that preserves line separators?

bat,
cat,
ant

would be sorted to:

ant,
bat,
cat

The algorithm might be something like, "if all the lines except the last contain the same non-whitespace non-alphanumeric character, then after sorting remove that character from end of the last line and add it to the end of any other line that doesn't have it".

This would be super useful for languages that don't support trailing commas in lists.

Planned

  • Generate Fake Data (Names, Emails, Phones, Credit Crads, etc.)
  • Align Selection
  • Expand Selection
  • Filter Unique Lines
  • Generate Dummy File
  • Single Quotes to Double Quotes
  • Double Quotes to Single Quotes

Make Title Case doesn't work on UPPERCASE string

I use case conversion to sanitize text that I work with. Often, text I grab happens to have fully uppercase titles/headings. I rely on tools like this to speed up my workflow.

Replicate issue by:
Select string of uppercase text;
Right click > Text Tools > Make Title Case

Expectation:
Selected text converted to title case;

What happens:
Selected text remains uppercase;

A fix would be to have the Make Title Case script first run a make-lowercase prior to changing to uppercase.

Thanks!

Sorting Mangles Text Selected In Vim Mode

  1. Enable Vim mode.
  2. Open a non-empty editor.
  3. Press V to enter visual mode.
  4. Press J or K to select lines downward or upward.
  5. Sort the lines.

Nova: 355205.
Text Tools: 3.0.6.

Disable/enable commands one by one

Hi, thanks for the great plugin!

One request – I am using another plugin for managing text case conversion, but I really like other commands offered by Text Tools. Would it be possible to add a simple configuration pane where we could disable unused commands? Right now I have commands from both plugins cluttering the Command Palette.

Align Text does not work and play well with double colons ::

I'm really appreciating the tool, especially the Align Text feature. One issue I've noticed is that it explodes double colons (e.g. static method designators in PHP). For example:

$thingOne = something();
$thing2 = Something::else();

becomes

$thingOne = something();
$thing2   = Something:          :else();

Encoding HTML Entities is missing some

I have a similar extension for Code that will sometimes encode a 'curly/smart' single quote as ' or ’. Your extension, I am assuming, is unaware of one of those as it frequently misses single quotes. Unfortunately I do not have a readily available example.

Support for regex common character classes (metacharacters)

It took a while swamping through my own self-doubt, but I realize that Text Tools supports only ^, $, and ! for matching lines. Did I get that right? Are there plans to match the power of mvoidex's SublimeSelectByRegex?

Love what you guys are doing, thanks for the plugin. I don't want to have a lot of plugins for text manipulation; you guys get me.

Categorize functions via submenus or separators

Categories via submenus (Sort…, Case…m Filter… etc.) and/or separators would be great.
Currently, the menu is really unwieldy due to its length, in my case way exceeding the screen height of a 13" MBP.

Consider adding aliases commands for identifier case conventions?

I was searching for the command to transform some text to some-text, after testing a few names I had in mind, I had to pull up my browser and open this repo's README to find out that the command is named "Make param case".

I don't find the name to be super obvious (but that maybe just me). Would you be open to adding commands with alternative names for common naming conventions ?

For example Wikipedia lists the following conventions and names:

Formatting Name(s)
twowords flatcase
TWOWORDS UPPERCASE
twoWords (lower) camelCase, dromedaryCase
TwoWords PascalCase, UpperCamelCase, StudlyCase
two_words snake_case, pothole_case
TWO_WORDS SCREAMING SNAKE CASE, MACRO_CASE, CONSTANT_CASE
two_Words camel_Snake_Case
Two_Words Pascal_Snake_Case, Title_Case
two-words kebab-case, dash-case, lisp-case, spinal-case
TWO-WORDS TRAIN-CASE, COBOL-CASE, SCREAMING-KEBAB-CASE
Two-Words Train-Case, HTTP-Header-Case

I'm not advocating to add all names, but maybe a few (popular) options would be a win?

I'm aware that it could also cause confusion if too many commands have the same effect, but I think it's worth considering.

"Filter Unique Lines" removes the duplicated lines without one remaining

From my understanding the command "Filter Unique Lines" should remove duplicated occurence of a same line, while keeping a unique occurence in the file (like the unix uniq program does).

However, the command completely removes all occurrences of a line :

Enregistrement.de.l.ecran.2022-06-17.a.19.47.55.mov

[Feature Request] "Select Parent" Command

Coming into Nova from other editors, I miss some of the scope-based selection options I used to have. For example, when editing an HTML file, Nova only has:

  • Editor -> Brackets -> Select Inside Brackets: allows us to select the text inside the current HTML tag.

But what about if I want to include the current tags in the selection, too? Often, what we really want is to select the entire parent element, in order to move it, copy it or delete it. I think we need a command like:

-** Editor -> Brackets -> Select parent**: allows us to select the 'parent' of the currently selected text (or where the cursor is). For an HTML file, for example, if we have our cursor inside the text content of an element, it would allow us to select the text as well as the wrapping HTML tags for that element.

Using this command multiple times should allow us to 'grow' the selection to select the next parent up, too. So if I select a <li> element when I first use it, and then use it again, I should have now selected the entire <ul> or <ol> parent.

This, of course, could also be applied to other languages - it all depends on how Nova parses and renders the document 'tree' internally. In processor languages like LESS, Sass or Stylus - that support nested hierarchies - this would be very useful indeed. But even for CSS itself, it would be handy to be able to 'Select Parent' on a style definition, to move it around.

The 'parent' should vary depending on the cursor position

In the case of an HTML file, if I have my cursor inside the text content of an element, I'd expect the entire element to be selected - including both opening and closing tags.

But if my cursor were inside an attribute - eg., inside the src attribute of an <img> tag - I'd expect the attribute to be selected as the 'parent'. Then, if I selected 'Select Parent' again, I'd probably expect the entire element to be selected.

Add tool to select all occurrences from current selections

Is there a way that a tool could be added to allow selecting all occurrences from the current selections? Basically the same as "Select All Occurrences", but from the current selections instead.

So, for example, with the following text:

abc abc abc abc
    ^         ^
    |selection|

Running a select all occurrences from current selections with abc would result in the following selections:

abc abc abc abc
    ^ ^ ' ' * *  <-- selection range pairs

Too illustrate with screenshots:

Initial selection Selections after running tool with abc
image image

When multiple selections are active before running the tool, it would select everything from each selection:

Initial selections Selections after running tool with abc
image image

This would be extremely useful when changing occurrences of something in a very narrow section of the file instead of selecting everything in the file.

Prevents creating HTML code for images dragged into the editor

Contacted Panic about the same issue with Emmet, but the plugin blocks Nova's functionality to create an img tag for image files dragged into the editor. It reverts it to the file path. Usually the tag is created immediately, but with the plugin active, there is a slight pause before the path is inserted.

Suggestion: Kill Lines

I made a tiny plugin to handle this for myself, but it would be something that would fit inside this project and probably be implemented better:

I use ⌘E to kill the current line. Wherever my cursor is, the entire line is deleted. If I have a selection that spans multiple lines, they're all deleted.

Most importantly, this command does not need you to highlight exactly the whole line or entire text you want to be deleted, just wherever your cursor is, whatever you have highlighted, or wherever your multiple cursors are, each line involved is deleted

This is what I did, there is probably a better way to do it:

nova.commands.register("example.delete-lines", (editor) => {
  editor.selectLinesContainingCursors();
  editor.edit((actionQueue) => {
    // When multiple cursors are involved, ranges must be deleted bottom-up
    // so it can be performed as one atomic commit
    editor.selectedRanges.reverse().forEach((range) => {
      actionQueue.delete(range);
    });
  });
});

Selection Expand does not work with unsaved files

Open Nova, Create a new File, Invoke Selection Expand shows the following in Extension Console

Text Tools[8:26:12.636000] Extension encountered an uncaught exception:
/Users/jp/Library/Application Support/Nova/Extensions/biati.texttools/Scripts/main.dist.js (Line 1.295, Column 38)
Error: Path argument must be a string
    @[native code]
    getExtension@file:///Users/jp/Library/Application%20Support/Nova/Extensions/biati.texttools/Scripts/main.dist.js:1295:38
    expand@file:///Users/jp/Library/Application%20Support/Nova/Extensions/biati.texttools/Scripts/main.dist.js:1309:38
    @file:///Users/jp/Library/Application%20Support/Nova/Extensions/biati.texttools/Scripts/main.dist.js:3891:20

Error comes from this

class SelectionExpander {
  getExtension(editor) {
    let filePath = editor.document.path;
    let extension = nova.path.extname(filePath).substring(1); ## Line 1.295 BOOM

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.