biati-digital / nova-text-tools Goto Github PK
View Code? Open in Web Editor NEWSwiss Army knife for text manipulation and selection Sort, Transform, Filter, Delete Duplicates, Encode, Decode and much more...
Swiss Army knife for text manipulation and selection Sort, Transform, Filter, Delete Duplicates, Encode, Decode and much more...
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) :
One big blocker for me to use Nova full-time is the lack of an extension that does what this one does for Code: https://marketplace.visualstudio.com/items?itemName=nhoizey.gremlins
It would be awesome if you could add this feature.
Is there a way to "minify" ( remove all extra spaces and line-breaks ) from a selection using Text Tools?
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!
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.
When right-clicking to bring up the context menu, the word "occurence" is misspelled; it only has one 'c'.
Note this misspelling is present on the extension web page: https://extensions.panic.com/extensions/biati/biati.texttools/
("Example" is also misspelled.)
Not a big deal; small mistake not trying to be a pain.
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!
V
to enter visual mode.J
or K
to select lines downward or upward.Nova: 355205.
Text Tools: 3.0.6.
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.
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();
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.
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.
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.
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.
Text Tools/Delete Lines Matching and Filter Lines Matching provide identical result, Delete Lines Matching is broken.
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 :
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:
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.
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.
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 |
---|---|
![]() |
![]() |
When multiple selections are active before running the tool, it would select everything from each selection:
Initial selections | Selections after running tool with abc |
---|---|
![]() |
![]() |
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.
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.
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);
});
});
});
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.