Ec
What is this?
Simple text editor inspired by Plan9 text editors (Sam & Acme) for macOS
Concept
- Offer very simple text editing features in core.
- Use mouse
- User can extend the editor with external commands instead of plugin.
- Use command language to edit text.
- Use platform native toolkits instead of reimplement it.
Mouse Action
Ec support right-click, left-click action on Acme(Sorry mouse-chords is not yet implemented..)
- Right-click to open file(and jump addr) or Look string in body
- Shift + Right-click to open file(and jump addr) or LookBack string in body
- Middle-Click to Execute Command
Command Language
Ec support basic acme(sam) command and add some extensions.
| Command | Action | |
|---|---|---|
| Edit EditCommand | Apply EditCommand to document body | |
| Look text | Forward search text | |
| LookBack text | Backward search text | |
| win | Launch terminal on current document directory | |
| | Unix-command | Replace dot by result of command applied to dot | |
| > Unix-command | Send dot to standard input of command | |
| < Unix-command | Replace dot by standard output of command |
Simple Address
| Address | Meaning |
|---|---|
| Number | Line number |
| +Number | Relative line number |
| -Number | Relative line number |
| /regexp/ | The first following match of regexp |
| +regexp/ | The first following match of regexp |
| +regexp/ | The first previous match of regexp |
| $ | The end of the file |
| 0 | The head of the file |
| . | Dot |
Compound addresses
| Address | Meaning |
|---|---|
| a1,a2 | From left of a1 to the right of a2 |
| a1+a2 | The address a2 evaluated starting at right of a1 |
| a1-a2 | a2 evaluated in the reverse direction starting at left of a1 |
Edit Commands
| Command | Action |
|---|---|
| a/text/ | Append text after dot |
| i/text/ | Insert text after dot |
| c/text/ | Change text in dot |
| d | Delete text in dot |
| a/text/ | Append text after dot |
| x/regexp/ command | For each match of regexp, set dot and run command |
| y/regexp/ command | Between adjecent matches of regexp, set dot and run command |
| g/regexp/ command | If dot contains matche of regexp, run command |
| v/regexp/ command | If dot does not contain a match of regexp, run command |
| | Unix-command | Replace dot by result of command applied to dot |
| > Unix-command | Send dot to standard input of command |
| < Unix-command | Replace dot by standard output of command |
| { commands } | Group of commands |
Preference File
Preference file is at~/.ec.yml
| Key | Meaning | Value | Default Value |
|---|---|---|---|
| mainBgColor | Background color of main text view | #rgb hex code | #FFFEEB |
| mainFgColor | Foreground color of main text view | #rgb hex code | #000000 |
| subBgColor | Background color of tagline text view | #rgb hex code | #E4FEFF |
| leftSelectBgColor | Background color of left mouse selection | #rgb hex code | #EEEB91 |
| leftSelectFgColor | Foreground color of left mouse selection | #rgb hex code | #000000 |
| rightSelectBgColor | Background color of left mouse selection | #rgb hex code | #015B00 |
| rightSelectFgColor | Foreground color of left mouse selection | #rgb hex code | #FFFFFF |
| otherSelectBgColor | Background color of left mouse selection | #rgb hex code | #A00000 |
| otherSelectFgColor | Foreground color of left mouse selection | #rgb hex code | #FFFFFF |
| fontName | Font name of text views | Fontname | System font |
| fontSize | Font size of text views | Number | System font size |
| expandTab | Expand tab | true, false | false |
| autoIndent | Automatic indent newline with previous line. | true, false | false |
| tabWidth | Tab character width | Number | 4 |
File Path based settiongs(fileTypes)
Override settings for file path:
fileTypes:
- path: "^.*\.go$"
expandTab: false
- path: Makefile
expandTab: false