a-bentofreire / editortoix

Code Editor Utility Belt
https://www.devtoix.com/en/projects/editortoix
45 stars 9 forks source link
brackets code-editor javascript linux-mint plugin project-idx python typescript xed

Code Editor Utility Belt

EditorToIX are open-source utilities available for multiple code editors in form of extension or plugins.

If you find this project useful, please, read the Support this Project on how to contribute.

Availability

Id Old Name Code Editor
vsx VscToIX Visual Studio Code
Cursor AI
open-vsx.org
xed XedToIX Linux Mint Xed Editor (as plugins)
phoenix BracketsToIX Phoenix Code

Available Languages

Utilities

General Selection Policy Code Editor
Extract Text Document vsx, phoenix
Header To Bookmark Document vsx, phoenix
Mixer Document vsx, phoenix
Regnize Document vsx, phoenix
Replace Recipes Document vsx
Reverse Assignment Document vsx, phoenix
Change Case Selection Policy Code Editor
Add Space before Uppercase Word vsx, phoenix
Camel Case Word vsx, phoenix
Capitalize Word vsx, phoenix
Cycle Case Word vsx, xed, phoenix
Dash Case Word vsx, phoenix
Dash To Underscore Word vsx, phoenix
LowerCase Word phoenix
Underscore To Dash Word vsx, phoenix
UpperCase Word phoenix
Encoders/Decoders Selection Policy Code Editor
Html Decode Line phoenix
Html Encode Line phoenix
Url Decode Line vsx, phoenix
Url Encode Line vsx, phoenix
Change Slash Selection Policy Code Editor
Double To Single Slash Line vsx, phoenix
Single To Double Slash Line vsx, phoenix
Unix To Win Slash Line vsx, phoenix
Win To Unix Slash Line vsx, phoenix
Line Selection Policy Code Editor
Break Line At Document vsx, phoenix
Indent One Space Document vsx, xed, phoenix
Join Lines Document vsx, phoenix
Outdent One Space Document vsx, xed, phoenix
Remove Duplicated Lines Document vsx, xed, phoenix
Remove Empty Lines Document vsx, xed, phoenix
Sort Numerically Ascending Document vsx, xed, phoenix
Sort Numerically Descending Document vsx, xed, phoenix
Split Lines Document vsx, phoenix
Trim Trailing Document xed, phoenix
Insert Selection Policy Code Editor
Insert ISO Date Document vsx, phoenix
Insert ISO TimeDate Document vsx, phoenix
Insert UUID Document vsx, phoenix
Insert Text At End Document vsx, phoenix
Insert Text At Start Document vsx, phoenix
Change Quote Selection Policy Code Editor
Double To Single Quote Line phoenix
Single To Double Quote Line phoenix
Toggle Quote Line phoenix
Spacing Selection Policy Code Editor
Tab To Space Document phoenix
Space To Tab Document phoenix

Project Status

This is a stable project with utilities being available on brackets code editor since 2016, however, since more editors have been supported, there is still work in progress to support the same extensions and policies across all code editors. Linux Mint Xed Editor has the smaller subset of extensions.

Demos - All Editors

Cycle Case

Indent/Outdent

Demos - vsx and phoenix Editors

Extract Text

Insert Text at Start

Insert Text at End

Join Lines

Break Line At

Installation - Linux Mint Xed Editor

If you have previously installed xedtoix, you should uninstall first:

sudo apt uninstall xedtoix
sudo add-apt-repository ppa:a-bentofreire/editortoix
sudo apt-get update
sudo apt install editortoix

If you are updating from Linux Mint Software installer, you might have to activate the plugins on:
Menu Edit -> Preferences -> Plugins

Interface - phoenix Editor

EditorToIX adds a top-menu called IX. To prevent from cluttering the menu with all the commands, only a few commands were added to the menu.
Use Command mapper to add which ones you prefer, and setup the shortcuts.
No default shortcuts were define to prevent collision with other plugins.

Utility Description

Utility Description Example
Add Space before Uppercase Useful to transform functions names into documentation before: doActionBefore
after: do Action Before
Break Line At Break lines at a certain position before:
Too long line
after:
too long
line
Camel Case before: ClassNameFunc
after: classNameFunc
Capitalize before: classNameFunc
after: ClassNameFunc
Cycle Case Loops between differet case types before: _ClassNameFunc
after: _classNameFunc -> _CLASS_NAME_FUNC -> _class_name_func -> _class-name-func -> _class name func ->_ClassNameFunc
Dash Case before: ClassNameFunc
after: class-name-func
Dash To Underscore before: find-deep-first
after: find_deep_first
Double To Single Slash before: find\\\nagain
after: find\nagain
Extract Text Copies to the clipboard the captured group of a regular expression.
Each capture is separated by tabs
(\w+) = (\w+)
Header To Bookmark Converts markdown header text to Html Bookmark before: Is this the header 你好?
after: is-this-the-header-你好
Indent One Space Adds one space to the beginning of each line
Insert ISO Date 2018-02-08
Insert ISO TimeDate 2018-02-08 10:12:15
Insert Text At End before:
red
green

after:
expr: = \c{1}
red = 1
green = 2
Insert Text At Start before:
red
green

after:
expr: const \e{upper} =
const RED = red
const GREEN = green
Insert UUID 7fff60f8-91e8-40ba-9053-56b0f3a487f0
Join Lines Joins lines adding the computed expression at the end of every line before:
red
green

after:
expr:(x\c{X0A}),
red(x0A),green(x0B)
LowerCase before:classNameFunc
after:classnamefunc
Mixer Mixes lines of different sections. before:
// section
abc
cde
// end-section
// section
123
345
// section
after:
abc
123
cde
345
Outdent One Space Removes one space to the beginning of each line
Regnize Adds slash to regular expression metachars before: (\w+)[A-Z]a*b+text
after: \(\\w\+\)\[A-Z\]a\*b\+text
Remove Duplicated Lines Removes consecutive duplicated lines before:
first
second
second

after:

first
second
Remove Empty Lines Removes empty lines before:
first

second

after:

first
second
Replace Recipes Replaces text from a list of pre-defined recipes
Reverse Assignment Reverses the terms of assignments or equal/different comparisons before: x == y[x] + 5
after: y[x] + 5 == x
Single To Double Slash before: find\nagain
after: find\\\nagain
Sort Numerically Ascending For each line uses the first number as sort key before:
10. red
2. green

after:

2. green
10. red
Sort Numerically Descending For each line uses the first number as sort key before:
10. red
`2.
Space To Tab Space to Tab only works with leading spaces
Split Lines Split lines by an expression. Dynamic values aren't supported before:
red,green

after:
expr: = \c{1}
red = 1
green = 2
Tab To Space Space to Tab only works with leading spaces
Trim Trailing Removes trailing spaces of each line
Underscore To Dash before: find_deep_first
after: find-deep-first
Unix To Win Slash Converts slashes to backslashes before: chocolate/candy
after: chocolate\candy
UpperCase before:classNameFunc
after:CLASSNAMEFUNC
Url Decode before: https%3A%2F%2Fgithub.com
after: https://github.com
Url Encode before: https://github.com
after: https%3A%2F%2Fgithub.com
Win To Unix Slash Converts backslashes to slashes before: chocolate\candy
after: chocolate/candy
Double To Single Quote before:find"again
after:find'again
Html Decode before:<h1>Title</h1&gt
after:<h1>Title</h1>
Html Encode before:<h1>Title</h1>
after:&lt;h1&gt;Title&lt;/h1&gt
Single To Double Quote before:find'again
after:find"again
Toggle Quote before:find"again'
after:find'again"

Selection Policies

vsx Editors

Every utility supports multiple cursors and multiple line selections.
However, It differs in the way each utility category handles the selections.
For every cursor, each line is process individually and the counter is increased per line.

Phoenix Code

Most of the commands operate on selected text. If no text is selected, a command will use: word - The nearest word (before and after the cursor) sentence - The nearest text until a whitespace or newline line - The text line where the cursor is located. document - All the editor text function - A function determines the text to use. Ex: Quote functions will use all the text between quotes that surrounds the cursor.

Linux Mint Xed Editor

Expressions - vsx

Some of the utilities support expressions
An expression is a text supporting the following metachars:

Replace Recipes - vsx

Replace Recipes must be added manually to the settings.json.
This tool is still in beta phase.

Field Type Description
name string Recipe name
pattern string Find Expression (RegExp or String)
replaceWith string Replace Text
isRegExp boolean if false then pattern is a static string
isExpression boolean if false then result doesn't exec the expression engine
ignoreCase boolean if true and isRegExp uses ignore case option

ex:

"vsctoix.replaceRecipes": [
    {
      "name": "repl with let",
      "pattern": "\\b(var|const)\\b",
      "replaceWith": "let"
    },
    {
      "name": "Remove starting dash",
      "pattern": "^\\s*-",
      "replaceWith": ""
    },
  ],

Support this Project

If you find this project useful, consider supporting it:

License

MIT License - vsx and phoenix Editors

GPLv2 License - Linux Mint Xed Editor

Copyrights

© 2014-2024 Alexandre Bento Freire