Speare
Version 1.2.56

Speare is an ultra lightweight code editor and small IDE. It was originally developed to providing a native scripting language debugging environment that seamlessly integrated with C and C++, and with an efficient code navigation and call routines tracing ability. Speare has very simple interface that allows end user to add a new programming language code runner, parser, syntax highlighting, code formatter and debugger to it. You can use the free version to debug C and C++ project. Speare Pro is the advanced version that supports debugging with more programming languages including Ruby, Lua, Python, PHP, Perl and Tcl. Most of the debuggers supports extending themselves in source code level and directly switch between any version of self-compiled scripting language interpreters.

The offline document: Speare_quick_reference.pdf

It's free!




If you can't open the link above, please launch App Store and found Speare by searching.

Code editor and IDE on macOS

Terminal based on text editors such as GNU Emacs and Vim, although they are very cool, but their limitations are also obvious, the elephant in the room. TextMate is my favourite code editor long years ago and until today, but it still lack some features. As a programmer, so many IDE and text editors I've used in the past years, such as the bulky cargos, Visual Studio Code, Atom, Android Studio, Eclipse, ActiveState Komodo, Xcode, and some light cargos, e.g. Textadept, CotEditor and TextMate. I never like the bulky cargos, e.g. desktop applications that built with NodeJS, React and Electron, Eclipse and Java or .NET and C# based big stuffs. Speare code editor is a small, free and friendly code editor which implements the most important missing features in common code editors, e.g. bookmark and fast locate code lines between multiple files, code block live parsing etc.

No. Code Editor Size No. IDE Size
1Speare 1.2.54 6.3MB 5 Visual Studio Code (bare system) 1.36.1 211MB
2TextMate 1.5.7 23.3MB 6 ActiveState Komodo 11.1 334MB
3Textadept 10.4 35MB 7Atom 1.38.2 558MB
4CotEditor 3.3 47MB 8 Android Studio 3.1 1.37GB
9 Eclipse IDE 4.12 400MB~5GB
10 Xcode 10.0 12GB

Why not big software?

Waste time to maintain, wast big storage and runtime memory, waste power, waste time to upload and download. It's waste people's life! Every desktop developer should known one thing, the embedded system developers sometime even fighting for one byte of storage in some situation. They never think about memory and storage like embedded system developers, so more and more big monster there. In today's software industry, Unix philosophy has been throw away completely!

They make software as big as possible, as complex as possible, but I believe in the opposite philosophy.

Screenshot





Features

  1. Well designed user operation interface. Intuitive and simple.
  2. High performance of managing large amount of files and big files.
  3. Fast search and replace in current document, selected folder, opened files and entire project.
  4. Smoothly edit multiple files that written in different programming languages simultaneously.
  5. Supports almost all common programming languages syntax highlighting and parsing.
  6. Auto-completion, sensitively typing with keywords, live parsing symbol definition with priority.
  7. Jump to definition and fast locate code lines between editing files by symbol index, bookmark or searching.
  8. Unlimited go back and forward, automatically remember jump location and current editing locations.
  9. Keeping entire state after quit, the opened files, selection of each file and the cursor location.
  10. Customisation of fonts and colours for the text editor.
  11. Full featured markdown editor, run Javascript code instantly, well support Web development.
  12. Ultra lightweight.

Other Builtin Features:
a. Run syntax checking and code snippets instantly.
b. C and C++ debugging with LLDB.
c. Binary file automatically detection.
d. Automatically detecting file encoding and convert to UTF-8 by default when open file.
e. Code block selection by double clicking the begin symbol of code block.
f. Preview all kinds of files, image, pdf, office documents, audio and video etc.

File Organisation

1. Add File or Folder in Workspace

a. Drag file or folder from Finder into Treeview directly.
b. Click "+" symbol on the bottom of Treeview.
c. Create temporary document:
Click menu: File → New
Click "+" symbol on the top of tabs view.
d. Click menu: File → Open Recent.
e. Add file or folder in a particular folder: right click the folder, on the popup menu → "Add File or Folder".
f. Create a new file or folder in a particular folder: right click the folder, on the popup menu → "New File" or "New Folder". (Input file or folder name and then click anywhere outside of the input box to close it.)
g. Reload a particular folder: right click the folder, on the popup menu → "Relod". (This operation is different with refresh operation, refresh operation will reload entire project.)

2. Remove File or Folder from Workspace

a. Select a file or folder, click "-" symbol on the bottom of the Treeview.
b. Right click a file or folder, on the popup menu → "Remove".
c. Use shortcut key "Option + Shift + R" to do the removing.
d. Click menu: File → Remove.

3. Delete File or Folder to Trash/Bin (Careful!)

a. Click menu: File → Delete.
b. Right click a particular file or folder: on the popup menu → "Delete".
c. Use shortcut key "Command + D" to do the deleting.

Refresh Symbol List or Bookmark (Breakpoint) List

Click toolbar "Functions": function definitions of current file will be re-parsed and represented in left side Treeview.
Click toolbar "Breakpoints": all breakpoint (bookmark) of current file will be re-loaded in the left side Treeview.

Auto-completion Selection

Type in class name, function name, or variable name or anything else, wait one to three seconds and use Up and Down arrow key to move selection in the candidates and click "Return" key to select one.

SPP File

SPP File is the abbreviation of "Speare Project Plist" file, it is the project file type of Speare that has an .spp file extension, it packs variant of project meta information together, including project folder and its bookmark/breakpoints, watches, opened tabs, selection of each tab, current selected tab etc.

  1. Create SPP File
    Click menu: File → Save as Speare Project file. This operation will store the root path of the nodes in the left side Treeview as a .spp file.

  2. Open SPP File
    Directly dragging the .spp file into Treeview, or select menu "File" → "Open", will load all indexed file and folder stored in the .spp file into the left side Treeview (Workspace Explorer).

When switch to another project, it is necessarily required to save current project so that the project meta information stored in .spp file and can be restore later otherwise these information will lost!

Search and Replace

  1. Search Current Document:
    a. Use the shortcut key "Control + F" to do the searching just like in TextEdit.
    b. Click search button on the toolbar and on the prompt dialog select "Current File".

  2. Search Current Folder:
    Click search button on the toolbar and on the prompt dialog select "Current Folder".

  3. Search Opened Files:
    Click search button on the toolbar and on the prompt dialog select "In Opened Tabs".

  4. Search Entire Project Folders:
    Click search button on the toolbar and on the prompt dialog select "In Entire Project".

  5. Searching by Index:

    a. Click symbol button on the toolbar and select items that parsed by the build-in syntax parsers.

    b. Click breakpoint button on the toolbar and select items that placed as bookmark or breakpoint.

  6. Searching items in left side Treeview:
    Input the item name (or prefix or suffix, or contained word) in the search field which located in the bottom of the left side Treeview and then enter "Return" key, click up and down arrow right side of the search field to iterate items.

Brief & History: each search result has brief of the source line and all be classified, and the history of search words remembered automatically, click the down arrow of the search field will allow to select the searched items in history.

Tab Selection and Dragging

Speare use tabs to manage multiple opened files on the right side, continuously click on the leftmost or rightmost tab can quickly scroll tabs to left side or right side so that opened files can be quickly switched. Dragging special tabs together will also can help simultaneously editing multiple files.

Tips: click tab can fast select the node of left side Treeview when it loaded or reloaded end.

File Rename and Save

1. File Rename
Click the item in the left side Treeview and input a new file name just like in Finder, and then click the left side icon to end editing.

2. File Save
Speare can save file automatically whenever it be edited but the temporary "Untitled files" will be asked to save when quit the app or load a .spp file, because load a .spp file will empty current Treeview.

In addition, Speare will change the icon colour of the item in the left side Treeview to indicate that it has been edited whenever it be edited, and will restore to default state when click the "Save" or "Save All" button on the toolbar.

Jump To Definition

Ensure the keyword selected and then right click one of the popup menu items. Speare provides all location where the symbol defined including header file and implement file.

Bookmark & Breakpoint

1. Add: click the line number.
2. Toggle: click on the marker, its colour will changed to dark or light, dark colour means breakpoint in debug mode.
3. Delete: right click on the marker → on the prompt menu, select "Remove".

Show in Finder

Right click the item in the left side Treeview (Workspace Explorer) and then click the prompt menu.

Insert full path of current file

a. Click menu: File → Insert Full Path.
b. Use shortcut key "Option + Shift + I" to do the work.

Back and Forward

Just click the "Back" or "Forward" button on the toolbar to switch different edited location in a same file or switch between the files that was being editing.

File OverWrite and Refresh

When you overwrite a file in Finder, Speare will ask you to reload it, you should save this file manually if you click "Cancel". You can also click the "Refresh" button on the bottom of the left site TreeView to reload the entire project, it may take a while to complete the loading for big project. When you overwrite, rename, add or delete a file or folder in Finder, please right click its parent folder in the left side TreeView and click "Reload" on the popup menu.

Colour Picker

Right click current editing file → select "Colour Picker" on the prompt menu, then a HTML colour will be inserted when pick a colour.

Customise Font and Colour

Click menu item "Preferences" and then set font and colour of editor background etc.

Add a new colour scheme:
Put you customised colour scheme in the following directory:
~/Library/Application Scripts/com.sevenuc.SpeareHelper/colorschemes
Please create the directory if it is not exists.

Markdown & HTML

1. Preview: select menu "View" → "Preview", see html or markdown file rendered in builtin web browser instantly.
2. Close Preview: select menu "View" → "Close Preview", close the opened builtin web browser.
3. Save Markdown: select menu "View" → "Save Markdown", save the generated html to local file, Speare has a builtin converter that can convert markdown to html instantly.

Note: a. supported file extensions: .htm, .html, .md, .mdown, .markdown.
b. click any file item in the left side Treeview will also close preview automatically.

Code Formatter

Click menu: Format → Re-Indent Selection.

Supported languages:
a. C, C++, Objective‑C, C#, Java (builtin support).
b. Ruby, Lua, Python, Perl, PHP, Tcl, JavaScript, Shell scripts, Dart, Go, Rust.
(located in the formatters directory, and requires some modification to correctly working.)

Location of formatters:
~/Library/Application Scripts/com.sevenuc.SpeareHelper/formatters
Please create the directory if it is not exists.

If the formatters has not installed, in the prompt dialog, select subfolder "com.sevenuc.SpeareHelper" and then click "Install Code Formatters" button. This directory contains various code formatter (aka. code beautifier) that used to indent and format code block for Speare code editor.

The rule of formatter is:
Speare code editor will give up formatted code block if there's something printed in stderr or nothing printed in stdout otherwise anything printed in stdout will be used to replace the selected code block.

Ensure the formatters correctly working, you should take a look at above directory, especially modify the shell script to match the path of executables (install interpreter or missing component), including:

a. js.sh: check Node.js installed and can be accessed from command line.
b. go.sh: check Go installed and can be accessed from command line.
c. php.sh: check PHP installed and can be accessed from command line.
d. rust.sh: check Rust and rustfmt installed and can be accessed from command line.
e. tcl.sh: check Tcl installed and can be accessed from command line.
f. dart.sh: check Dart and dartfmt installed and can be accessed from command line.

Note: The selected code block is complete or has logical begin and end border then the formatter can generate better output.

Lite Mode

Click siding button on toolbar and click menu "View → Hide Toolbar" then the app can be changed to an TextEdit-like editor.

Debug Mode

Speare Pro seamlessly support debugging C, C++, Ruby, mruby, Lua, Python, PHP, Perl and Tcl script, more info see here: → Speare debugger architecture.

File and Folder Filter

1. Click menu: View → Don't Show Hidden Files. Hide or display all hidden files.

2. Speare code editor uses a file named as ".speareignore" to hidden directory and file that you don't want it displayed in the left side Treeview (Workspace Explorer).

# 1. exclude directories by folder name (must end with /).
dist/
build/
.git/
.svn/
.hg/
CVS/
.deps/
.libs/
prefix+*/ (ignore directory name with prefix)
*+suffix/ (ignore directory name with suffix)
*+word+*/ (ignore directory name contains word)
...

# 2. exclude directories by full path (must end with /).
/xxxx/xxx/xxx/data/
/xxxx/xxx/xxx/xxx/resource/
...

# 3. exclude files by specified extension.
*.o
*.lo
*.la
*.so
*.class
*.gz
*.tar
*.zip
*.7z
*.iso
*.jar
...
(must starts with *.)

# 4. exclude files by file name.
.DS_Store (already ignored by builtin function)
someFile
someOtherFile
prefix+* (ignore file name with prefix)
*+suffix (ignore file name with suffix)
*+word+* (ignore file name contains word)
...

# 5. exclude files by full path.
/xxxx/xxx/xxx/someFile
/xxxx/xxx/xxx/xxx/someOtherFile
...

a. Line starts with '#' is comment.
b. Each line contains a match rule to ignore directory or file.

3. Create or edit .speareignore:
$ touch ~/Desktop/speareignore.txt
$ cp ~/Desktop/speareignore.txt /xxxx/xxxx/.speareignore:
Put the file in your root of source code folder.
$ cp /xxxx/xxxx/.speareignore ~/Desktop/speareignore.txt:
Edit the filter again.
$ cp ~/Desktop/speareignore.txt /xxxx/xxxx/.speareignore:
Save it back again.

Note:
a. The ignored directory and files will not be parsed and their symbol definitions will not be indexed in background.
b. When overwrite file or folder in Finder, they will not be asked to reload if they were set to be ignored (deprecated).
c. You can directly edit file .speareignore in Speare code editor and click the "Refresh" button on the bottom of the left site TreeView to reload the project folder.

Warning: File system monitor have been removed from version 1.2.38, please right click the particular folder to "Reload" it or click the "Refresh" button to reload the entire project.

About MATLAB source code

Please convert file extension name from .m to .mat to prevent conflict with objective-c files, to accomplish that, please download a simple perl script from here: rename.pl (2KB), and execute:
$ perl rename.pl /fullpath/of/your/source/code/directory.

About Dart programming language

Speare code editor uses extra component to parse and index Dart source code and format code block, please download the parser from here: dart_parser.tar.gz (2.8MB), and following readme.txt in it to configure it to working with the editor.
SHA256: c7499102bce7ae36ceb6679e858a059ce7b2c927428569667139c6cc4da9fee3

Add a New Programming Language

Download the guide from here: language_extension_protocol.pdf, and following the description to add a new programming language code runner, parser, syntax highlighting, code formatter and debugger in Speare code editor.

Instant Syntax Checking and Run Code Snippets

a. Press shortcut key "Command + R".
b. Click menu: File → Run External Command.

Location of the shell scripts for the external commands:
~/Library/Application Scripts/com.sevenuc.SpeareHelper/commands
Please create the directory if it is not exists.

This is a common interface that enables end user to run code for various of tasks immediately, usually includes syntax checking, unit test, and run code snippets.

You can put different of shell scripts in this directory to instantly run other tasks, such as automatic compile, building and packing, or run static code analysis tool (source code analyzer, such as PC-Lint, clang-analyzer, PHPLint etc), and any other tasks. Speare code editor determine which shell script should be called by the extension name of the source code files. One shell script service for one programming language. Every script can accept two input parameters, the full path of the current selected file and the selected code block, and the last parameter is optional and can be empty string.

#!/bin/bash
# $1 is the path of the current selected file
# $2 is the selected code block (optional)
ruby $1

The above is a sample shell script that accepts a file as input parameter and run it, if there's some syntax error, the error message will be printed in the debug output (the black area on bottom right ). Please execute "chmod +x" to ensure the script is executable. Speare code editor will merge stderr and stdout together and print them in the debug output.

The map between the source code file extension names and the entry shell script name:

c.sh: *.c 
cc.sh: *.cc, *.cxx, *.cpp, *.c++
ruby.sh: *.rb
lua.sh: *.lua
python.sh: *.py
perl.sh: *.pl
php.sh: *.php
tcl.sh: *.tcl
js.sh: *.js
sh.sh: *.sh (shell script)
go.sh: *.go
rust.sh: *.rs
dart.sh: *.dart

TO add a new programming language and associate its source code file extension names with an entry shell script, please refer this document: language_extension_protocol.pdf.

Note: Don't use this approach to run long running tasks but should launch Terminal.app to do such works.

Important Tips

1. Use ESC key or arrow key or 'Control+Z' to get out of suggested words list selection.
2. Please ensure all source code file and resource files have been dragged in the left side Treeview (Workspace Explorer) before start a debug session, because macOS app can't be allowed to access files outside of its sandbox.
3. When your source code file moved to another folder, you must drag the source code folder in Speare again then the debugging can correctly work.

FAQ

1. How to add syntax highlighting to support a new file type?
A: Open "/Applications/Speare.app/Contents/Resources/SyntaxDefinitions.plist", and carefully add the file extension name of the new file type in it, e.g. syntax highlighting all .jsx as JavaScript source code file:

  <key>JavaScript</key>
  <array>
  <string>js</string>
  <string>jsx</string>
  </array>
Syntax highlighting for a new programming language:
Please put the syntax highlighting definition file in the following directory:
~/Library/Application Scripts/com.sevenuc.SpeareHelper/languages
Please create the directory if it is not exists.

2. How to add a missing keyword to enable syntax highlighting in Speare?
A: Open "/Applications/Speare.app/Contents/Resources/Languages/xxlang.plist", and carefully insert the missing keyword in the "keywords" section.

<key>keywords</key>
<array>
<string>missing keyword</string>
...

3. How to add "Open With" in Finder to support open a file type with Speare?
A: Right click the file in Finder → Get Info → Open With: Other..., find Speare.app and select, and then Click "Change All..." button.

4. How to clean hidden file and folders used by version control systems?
download a simple python script from here: cleanfolder.py (5KB), and execute:
$ python cleanfolder.py -d "/fullpath/of/your/source/code/directory".

Programming Languages and Document Types

AMPL ASM ASP AWK Ada ActionScript Active4D AnsiblePlaybook Ant Apache Applescript Asciidoc AutoIt Autoconf Automake Basic Batch Beta Bibtex C C# C++ CMake CPrePro CSS Scss CUDA Clojure Cobol CoffeeScript ColdFusion Csound Ctags D DTS DbusIntrospect Diff DosBatch PowerShell Dtd Dylan Eiffel Elixir Elm Erlang eZ Publish F-Script Falcon Flex Forth Fortran FreeFem++ Fypp GEDCOM Gdbinit Glade Go Gradle GraphViz Groovy Haskell HTML Haxe Header IDL ITcl Iniconf Inko JSP Java JavaFX JavaProperties JavaScript Json Julia Kotlin Kuin LSL LaTeX LdScript Lilypond Lisp Logtalk Lua M4 MEL Makefile Man Markdown MATLAB Maven2 MetaPost Metaslang Moose MySQL Myrddin NASL NEURON Nemerle Objective-C Octave Ocaml Ox PDF PHP Parrot Pascal Passwd Perl Perl6 Pig Plist Pod PostScript Prolog Processing Protobuf Puppet PuppetManifest Python PythonLoggingConfig QemuHX QtMoc R R/S-PLUS RHTML RSpec RelaxNG Rexx Robot Racket RpmSpec Rst Ruby mruby Rust SGML SML SQL Scala Scheme Sedona Shell Slang Smalltalk Snippets Stata SuperCollider SVG Swift SystemTap SystemdUnit TTCN Tcl Tcl/Tk Tex TorqueScript TypeScript Udo VB VB.NET VHDL Vera Verilog SystemVerilog Vim WSDL WindRes XML XSD Xquery Xslt Yacc YAML YumRepo Zephir

Support

If your special programming language, compiler, interpreter or special document type requires Spear syntax highlighting or debugging support, please drop us a message.

Request and issue management on Github: https://github.com/chengdu/Speare.