CudaText VS other editors

From Lazarus wiki
Jump to navigationJump to search

CudaText advantages over Sublime Text 3

  • Open source, more operating systems are supported
  • The Python API is easier to use
  • The Python API allows management of dialogs and UI-controls, including the CudaText editor control
  • Code-Tree for most of lexers (ST has only plugin for very limited set of languages)
  • Powerful EControl lexer format, and it's easier to create/edit lexers (GUI in external program)
  • Floating (separate window) mode of side panel and bottom panel
  • Floating (separate window) groups of UI-tabs (in addition to normal 6 groups)
  • Toolbar, configurable via plugin
  • Configurable statusbar
  • Horizontal ruler above text
  • Micromap
  • Markers in editor
  • Sessions system
  • Caret position after end-of-line
  • Better support for encodings, including UTF-32
  • Better support national keyboards on Linux
  • Correctly saves binary files
  • API for inter-line gaps, helping to several plugins (Differ, Insert Pics, Embedded Editor)
  • Viewer for files of unlimited size
  • Hex display of special chars
  • UI-tabs features: colored tabs, icons (Tab Icons plugin), tabs on the left/right
  • Plugin "Options Editor" to configure CudaText via simple GUI
  • Character Map dialog
  • UI can be scaled by option (up to 500%)
  • Single-instance mode is supported on all OS'es
  • Scrolling after middle-button click (called "Autoscrolling" in Firefox)
  • Show pictures in the text
  • Colorize the text
  • Activating internet links
  • Automatic folding of comments
  • HTML auto-completion suggests file/folder names
  • File URI file:/// auto-completion
  • HTML color codes underlining
  • Macros plugin also records actions performed in the Find/Replace dialog, and mouse clicks
  • CudaText and its plugins support i18n (text strings can be translated)
  • Function "Find in files" is implemented in plugin, with much more features
  • Tab switcher dialog
  • Can split single UI-tab, for single file or 2 different files (helps to work with Differ plugin)
  • Color themes do not have per-lexer settings
  • Picture file viewer supports zooming of a picture
  • Dialog "Go to" gives more features
  • Option "tab_smart" for smart-tabs, known from several other text editors
  • Option "caret_proximity_vert" to set minimal distance of caret to top/bottom edge
  • Option for "zebra" mode
  • Windows version can use different Python engine (packages in add-ons)
  • Add-ons do not disappear due to GitHub repository deletions

CudaText advantages over Visual Studio Code

  • VSCode has the option "maximal count of ui-tabs", because its ui-tabs are memory hungry. CudaText allows to open 1000+ ui-tabs without problems.
  • VSCode is slow for file sizes 10M...100M, while CudaText allows this without problems. For size 2M+ CudaText disables lexers, but "lite lexers" (Log, XML, JSON) work always.
  • VSCode doesn't have customizable toolbar.
  • VSCode doesn't allow to show side-panels in floating (detached) window.
  • VSCode has internal "find in files" but CudaText has FindInFiles-4 plugin with much more features.
  • VSCode cannot show inter-line gaps with pictures. CudaText plugin "Insert Pics" is based on this feature.
  • VSCode doesn't have the analog of CudaText "Color Text" plugin (not 100% sure here).
  • VSCode doesn't have the analog of CudaText "Draw Lines" plugin.
  • VSCode cannot place text caret beyond end-of-line (not 100% sure here).
  • VSCode has the add-on "Macros", with it you need to create/configure command sequences by hands. Not simple task. CudaText has the plugin "Macros" and it records usual keypresses. Much eaiser to do.
  • CudaText gives viewer for files of unlimited size.
  • CudaText plugins API is simpler.
  • CudaText supports UTF-32 LE/BE encoding.

CudaText disadvantages compared to Sublime Text / VSCode

  • CudaText doesn't use 3D acceleration on rendering, so it may lag (and/or consume lot of CPU) if you scroll text, with big window size (not on Windows, Windows API works fast enough).
  • CudaText doesn't provide "Go to anything" command, instead it gives several separate commands:
    • Go to line number,
    • Go to project file,
    • Go to bookmark,
    • Go to code-tree symbol, ...
  • CudaText lexers are "simple": they don't parse text as deeply as ST/VSCode; so you need the LSP plugin if you need IntelliSense features.
  • CudaText key bindings are simpler: commands don't have "arguments" and cannot be set per-project (but can be set per-lexer).
  • CudaText plugins API doesn't support async events.
  • CudaText doesn't support some encodings (e.g. Shift-JIS).

CudaText performance

Startup time

CudaText starts quite fast: about 0.3 sec with about 30 plugins (all preinstalled + some popular plugins), on Linux, on CPU x64 Intel Core i3 3GHz.

  • If no additional plugins are installed, or Python engine is disabled (ie not configured on Unix, or Python DLL files are deleted on Windows), then it starts even faster.
  • If configuration/history are clean, it starts faster.
  • If bottom panel is hidden on start, via option "ui_bottom_on_start":2, it starts faster.

Performance of loading huge files

How fast Linux editors open huge files?

Test file has about 300M size, it has 4M ASCII lines, it's created by Python script:

f = open("a.log", "w")
for n in range(4*1000*1000):
    k = 120-n%100
    f.write(str(n+1)+' '+chr(k%26+ord('a'))*k+'\n')

Testing on Ubuntu 20.04, CPU: Intel Core i3 3GHz, RAM: 12G. Each time is average of 2-3 tries in the same session.

  • CudaText 1.211.0: 8 sec
  • Sublime Text 4 4169: 8 sec
  • Geany 1.36: hangs, waited for it 90 sec
  • Kate 23.08.4: 5 sec, then go to end (Ctrl+End hotkey) took additional 30 sec
  • Vim 8.1.1847: 2 sec
  • Emacs GUI 29.2: 2 sec, after showing confirmation for big file
  • gedit 3.36.2: 19 sec, then go to end (Ctrl+End hotkey) hangs: waited for it 100 sec

Performance of editing huge lines

Tested several editors on Ubuntu 20.04 on Intel Core i3 CPU.

XML file: single line of length 4M. XML file contains line like <id name="nnnnnnn"> with the huge "name" value of 4M. Python script to generate XML file:

#!/usr/bin/python3
f = open("a.xml", "w")
f.write('<id name="')
for n in range(1, 4096):
    f.write("n" * 1024)
f.write('">\n')
  • CudaText 1.211.0. Opens file: 1 sec. Caret moves at the end of line: very fast (<0.1 sec). Editing of this line: adding each char is about 0.1-0.2 sec.
  • Sublime Text 4 4169. Opens file: 1 sec. Caret moves at the end of line: very fast (0.1-0.2 sec). Editing of this line: adding each char is about 0.1-0.2 sec.
  • Geany 1.36. Opens file: 7 sec, then to go to end (Ctrl+End hotkey) it took 4 sec. Caret moves at line begin: fast, caret moves at line end: fast (delay about 0.3 sec after each Left/Right key). Moving up/down between 1st huge line and 2nd empty line: 3-4 sec. Editing at the end: adding each char is about 6 sec.
  • Kate 23.08.4. Gives colored panel "The file ... was opened and contained lines longer than ... Those lines were wrapped and the document is set to read-only mode ...". Caret moves at the end of wrapped line: fast. But editing is disabled.
  • Vim 8.1. Opens file: 1 sec. In word-wrapped mode and with partially colored line. Caret moves at the end of line: each Left/Right command (Vim hotkeys) is 2 sec delay. Editing of this line: adding each char is about 3 sec.
  • Emacs 29.2 GUI. Opens file: 3 sec. Caret moves at the end of line: very fast. Editing of this line: adding each char is instant.
  • gedit 3.36.2. Hanged on opening file (from command line and from GUI), waited it for 20 sec.
  • Bluefish 2.2.11. On opening file, gives the warning about too long lines, on choosing "don't split lines" it hanged, waited for 30 sec.

Performance of mass replace in huge lines

Compared a few editors in the task of replacing 25K single-char matches by two-chars-string in a 1.5MB file with a line with 800K chars. Running on Linux x64, CPU: Ryzen 5 1600, RAM: 32GB. Results:

  • SciTE 5.4.1: after 6 min I could see the replaced text, but editor was still unresponsive (frozen). Awaited 6 more minutes and nothing changed, so I had to kill the window/process.
  • Kate 23.08.4: complained about line length, took a long time to open the file, very poor performance while it was open... I couldn't even try replacing, it was unusable.
  • Sublime Text 4 4169: crashed after 4 min processing the replace.
  • Sublime Text 3.2.2: it took 2 min 30 sec to replace, the best one after CudaText.
  • Notepad++ 8.6.4 with Wine: froze while replacing. I waited for 6 minutes but was still unable to do anything after that, so I had to quit.
  • CudaText 1.211.0: did the task in 1 second.

Performance of built-in sorting

Test on ~100M text file with short ASCII lines. Test on Ubuntu 19.10 on Intel i3 CPU.

CudaText 1.97:

  • sort time of Command Palette command "(without undo) sort asc.": 18 sec
  • sort time of Command Palette command "(without undo) sort asc., ignore case": 19 sec
  • memory used after file loading: ~1.0 G
  • peak memory used on sorting: the same (because sorting is inplace, in the same list)

Sublime Text 3.2:

  • sort time: 14 sec
  • sort time with ignoring case: 16 sec
  • memory used after file loading: ~1.3 G
  • peak memory used on sorting: ~3.3 G

CudaText vs Sublime Text, different answers to questions

How to call external programs/compilers?

ST3: Use feature of editor called "build systems".

CudaText: Use plugin "External Tools", which adds "Tools" item to the top menu. Or: use plugin "Runner". Both plugins are described here: CudaText_plugins.

Alternative answer for CudaText: Use plugin "Runner" which handles build-systems almost compatible with Sublime's build-systems.

How to change settings for one OS only?

ST3: You need to use platform-specific config files. E.g. for macOS, platform-specific config is "Preferences (OSX).sublime-settings".

CudaText: You need to use the config user.json, but write there options with OS specific suffixes. E.g. Windows option is "font_name", and macOS option is "font_name__mac". Possible suffixes are listed in default.json: __linux, __mac, __freebsd etc. Only limited count of options support OS suffixes, this is marked in the default config (default.json).

How to change settings for one syntax only?

ST3: To edit syntax-specific config, call "Preferences / Settings - Syntax Specific".

CudaText: To edit lexer-specific config, see CudaText#Configs.

How to add commands to top/context menu?

ST3: You need to create *.sublime-menu files: https://www.sublimetext.com/docs/3/menus.html#available_menus

CudaText: You need to install plugin "Configure Menu". In its dialog, create "menu.json" file which has default items of top menu and context menu. Then edit that file.

How to find/replace text in many files?

ST3: Use built-in command "Find in files".

CudaText: Use plugin FindInFiles. It has 2 major versions: v3 is frozen, and new v4 is evolving.

How to find file in a project?

ST3: Use "Goto Anything" (Ctrl+P on Windows/Linux, Command+P on macOS).

CudaText:

  • To find file by name, use command "Plugins / Project Manager / Go to file...". After file is focused in project, press Enter to open it.
  • To find file by contents, use plugin FindInFiles (v3) which allows to search in project files. Quote from its help:
Set special value "<Project Folders>" (in short <p>) for field "In folder" to search in project files.

How to show vertical lines on some columns?

ST3: Use option

"rulers": [40, 80, 120],

CudaText: Use option

"margin_string": "40 80 120",

How to highlight pair brackets?

ST3: Brackets highlight is built-in feature, turned on by default.

CudaText: Brackets highlight is built-in, but it's off by default. Use several "bracket_" options, see comments in the "Options Editor" plugin.

How to highlight pair HTML tags?

ST3: Use plugin, e.g. https://packagecontrol.io/packages/BracketHighlighter

CudaText: Use options for "dynamic highlighting", "lexer_dynamic_" in "Options Editor" plugin.

How to add custom syntax support?

ST3: You need to create syntax file, https://www.sublimetext.com/docs/3/syntax.html

CudaText: You need to create lexer, see CudaText#Lexers.

How to customize hotkeys?

ST3: You need to edit keybinding files like "Default (Windows).sublime-keymap".

CudaText: In the Command Palette dialog, focus needed command item, press F9 - additional dialog will appear to set the hotkey. Method 2: install plugin "Configure Hotkeys" which gives alternative dialog.

How to use Emmet?

ST3: Install plugin "Emmet". Emmet here is written in JavaScript.

CudaText: Use pre-installed plugin "Emmet". Emmet here is written in Pascal with minor differences (e.g. "lorem" works differently).

How to show 2/3/4 files at once?

ST3: Use "View / Layout" menu.

CudaText: Use "=" item in the top menu.

How to split window for single file?

ST3:

  • menu "File / New View into File"
  • menu "View / Layout / Columns: 2 (or Rows: 2)"
  • drag the tab into another group

CudaText: menu "View / Split tab / Toggle split".

How to detect syntax by first line of file?

ST3: It's configured in syntax file: https://superuser.com/questions/752025/sublime-text-3-detect-syntax-based-on-file-header

CudaText: Use config described in CudaText#Detection_by_first_file_line.

How to assign syntax to undetected file extension?

ST3: Open your file, click statusbar item for syntax, use item "Open all with current extension as...".

CudaText: Use "file types config", see CudaText#File_types_config.

How to select several occurrences of a word?

ST3: Use command "Selection / Expand selection to word".

CudaText: Use command "Selection / Add next occurrence of selected word".

There is a difference in CudaText implementation: CudaText command first checks, is first selection 'whole word' or not. If it's whole word, command adds selections which must be also whole words. In ST, command does not check 'whole word' state of next selections. You may switch to ST behaviour. How? CudaText "Command Palette" gives two commands:

  • A: add next occurrence of selected word
  • B: add next occurrence of selected text (not whole-word)

You can reassign hotkey from the command A to the command B, so hotkey will give the behaviour of Sublime Text.

How to select all occurrences of a word?

ST3: In the Find dialog, enter a word, check "whole words", press "Find All".

CudaText:

  • In the Find dialog, enter a word, check "whole words", press "Select all".
  • Plugin "Highlights Occurrences" gives command "Select all occurrences".

How to record macros?

ST3: Use menu items in the "Tools" menu.

CudaText: Install plugin "Macros", which adds item "Macros" to the top menu.

How to use "Go to symbol"?

ST3: Use menu item "Go to symbol".

CudaText: It doesn't have "Go to anything" but it has "Go to symbol" for a lexer, if lexer finds such symbols for Code-Tree. Install plugin "CudaExt", which gives menu "Plugins / Cuda-Ext / Code-Tree" with several menu items. One item is "Symbols list" which shows Code-Tree items in the menu dialog.

How to switch between C++ header/implementation files?

ST3: Use command "Switch header/implementation".

CudaText: Use plugin "Switch Header" (it's not only for C++, it's configurable for all lexers).

How to jump to next/previous modified lines?

ST3: Use commands "Next modification", "Previous modification".

CudaText: Use plugin "CudaExt" which gives commands:

  • "Jump: to next/previous changed lines",
  • "Jump: to next/previous working lines",
  • "Jump: to next/previous saved lines".

See CudaText#Line_states.

How to detect indentation characters in a file?

ST3: Menu item "View / Indentation / Guess settings from buffer".

CudaText: Plugin "Detect Indent" which does the same.

How to change indentation characters in a file?

ST3: Click statusbar cell "Tab size..."/"Spaces...", it has menu items "Convert indentation to spaces", "Convert indentation to tabs".

CudaText: The same as for ST3.

How to install plugins without package manager?

ST3: Open terminal, go to Packages folder, run "git clone" in that folder, or copy plugin there.

CudaText: Open terminal, go to "py" subfolder, run "git clone" in that folder, or copy "cuda_" plugin folder there.

How to make vertical/column selection?

ST3: See the official documentation page "Column Selection".

CudaText:

  • Mouse shortcuts: CudaText#Mouse shortcuts.
  • Keyboard commands: "column select: up / down / left / right / ....".
  • Click the statusbar cell "-", it will toggle to "||", and usual mouse selection will perform column selection.

How to swap line up/down

ST3: Commands "Edit / Line / Swap Line Up/Down".

CudaText: Commands "Edit / Line operations / Move line(s) up/down".

How to show menu of tabs, project files, symbols

ST3: "Goto anything" (Ctrl+P) for all stuff.

CudaText:

  • List of opened tabs: command "ui: switch tab, dialog".
  • List of files in the current project: "plugin: Project Manager: Go to file".
  • List of "symbols" in the current document: "plugin: Cuda-Ext: Code-Tree: Symbols list" (shows the same symbols as code-tree can show).

How to use 'atomic saving'

'Atomic' file saving is saving to a temporary file, then renaming that file to the destination. 'Atomic' saving is not implemented in CudaText, because users of Sublime Text 3 consider it as harmful feature.

  • It drops extended file attributes (on NTFS on Windows; Unix-like have similar problem too?)
  • It drops NTFS file streams, on Windows
  • Problems with files located on Network drives, on Windows
  • Problems with symlinks
  • It needs additional options like "on which drives to use atomic saving"

CudaText vs Notepad++

(From user dinkumoil, quote from the Notepad++ forum.)

But since this thread has the potential to be a useful information and I’m a user of CudaText as well, I respond to it (I also contributed to the CudaText source code, wrote a plugin similar to my AutoCodepage and AutoEolFormat plugins for Notepad++, helped to improve the SQL and VBScript lexers and currently maintain the German translation file).

Indeed, CudaText is a powerful text editor and its author is an experienced dev in writing text editors and software components needed for that as he is also the author of the discontinued SynWrite editor. Since the above feature list is only a usual catalog for text editors, I want to go a little bit into the details.

Advantages

  • Quick evolving project.
  • Quick responding and very active developer.
  • Constant, nearly daily work at the project (have a look at the commit tracker).
  • No political activities.
  • Extensive and always up-to-date wiki and API documentation .
  • The UI follows Windows settings for font size in menus and dialog boxes, important when using high-DPI monitors.
  • The whole UI is themeable, not just the edit window.
  • Up to 6 edit windows, each with an unlimited number of tabs. Even a single tab can be splitted in two areas.
  • A plugin allows to fully customize the whole main menu.
  • Very well working Code Tree (in Notepad++ called Function List) that supports automatically all languages which are supported by lexers.
  • Monitoring of opened files for changes from other programs seems to work more reliable than in Notepad++.
  • Separate lexer creation tool with sophisticated abilities. It supports using regular expressions.
  • Plugins can be written in Python (but this has to be paid with lower execution speed for sophisticated tasks).
  • Only for the records, no advantage over Notepad++: Lots of useful plugins available, one of them is a plugin manager. It allows installing, updating and removing of plugins.

Disadvantages

  • In some details slightly slower working speed than Notepad++.
  • Configuring the toolbar is a little bit tricky. It requires a plugin and needs intensive work.
  • Translations for the UI into other languages are available but a lot of them are outdated.
  • The Search & Replace feature uses a rather old regular expression engine which lacks some sophisticated features (IMO the biggest drawback). Edited by Alexey: RegEx engine was much improved since the time of this complain.
  • There is no built-in preferences dialog. Instead you have to edit a JSON file (but that’s far better than writing CSS code like in Atom). There is a plugin available that tries to work like a preferences dialog but it’s only a tableized, textual view of all settings and a primitive UI to change them.
  • Under Windows, a plugin installs an Explorer context menu. But since its only backed by a shell\CudaText\command registry entry and not with a real shell handler like Notepad++'s context menu entry, it is not possible to open more than 15 files at once using the CudaText Explorer context menu entry. That’s a common limitation for all non-shell-handler context menu entries (tested under Windows 7 x64). Edited by Alexey: this is not actual anymore, since we have dedicated Explorer shell extension DLL.
  • Releases of CudaText are published only as ZIP files without an installer. So, updating means all plugins, custom icons, additional lexers, autocompletion files, language files, theme and lexer customizations and so forth have to be migrated to the directory of the new version. You need a file and directory based diff tool for that.
  • Only a small community, the forum mostly is a lonely place. Like the developer a lot of the people commenting in the GitHub issue tracker are russian, thus they tend to write in cyrillic. But this is clearly an advantage for people from Russia which have to take the burden to write and read in English, written in latin letters here in the Notepad++ forum and in the GitHub repo.
  • Somewhat chaotic project structure. Source code on GitHub, binary releases on SourceForge, forum on a SourceForge-hosted home page, lots of relations to the discontinued SynWrite editor (e.g. lexers are hosted in a separate SourceForge project called SynWrite add-ons, the lexer creation tool is an excerpt of that particular part of SynWrite).

Conclusion

All in all I would say CudaText is an excellent addition to Notepad++, but I personally will continue to use both editors since both of them have their strengths and weaknesses. And since I think the CudaText project deserves more support, I hereby appeal to participate in this project as well, if possible.