|
| 1 | +# Acme text editor |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +Acme is a Zen-style text editor. |
| 6 | + |
| 7 | +Using Acme you sacrifice: |
| 8 | +- configuration files |
| 9 | +- themes |
| 10 | +- syntax highlighting |
| 11 | +- autocompletion |
| 12 | +- specific language support |
| 13 | +- *your favourite Vim/Emacs/Sublime feature* :trollface: |
| 14 | + |
| 15 | +What you gain is that instead of spending too much time configuring your editor, you will focus on actual working. |
| 16 | + |
| 17 | +The killer feature of Acme is how it integrates into surrounding system. Acme is not trying to be a complete environment by itself. Acme acts as a glue which links together other programs and tools. With Acme the OS becomes your IDE. |
| 18 | + |
| 19 | +## Install |
| 20 | + |
| 21 | +### FreeBSD |
| 22 | +``` |
| 23 | +pkg install plan9port |
| 24 | +``` |
| 25 | + |
| 26 | +### macOS |
| 27 | +``` |
| 28 | +brew install plan9port |
| 29 | +``` |
| 30 | + |
| 31 | +### Debian |
| 32 | +``` |
| 33 | +sudo apt-get install gcc libx11-dev libxt-dev libxext-dev libfontconfig1-dev |
| 34 | +git clone https://github.com/9fans/plan9port $HOME/plan9 |
| 35 | +cd $HOME/plan9/plan9port |
| 36 | +./INSTALL -r $HOME/plan9 |
| 37 | +``` |
| 38 | + |
| 39 | +## Environment setup |
| 40 | + |
| 41 | +### Bash |
| 42 | +``` |
| 43 | +export PLAN9="/path/to/plan9port" |
| 44 | +export PATH="$PATH:$PLAN9/bin" |
| 45 | +``` |
| 46 | + |
| 47 | +### Tcsh |
| 48 | +``` |
| 49 | +setenv PLAN9 /path/to/plan9port |
| 50 | +set path = ($path $PLAN9/bin) |
| 51 | +``` |
| 52 | + |
| 53 | +## Font |
| 54 | + |
| 55 | +Run font server: |
| 56 | +``` |
| 57 | +fontsrv |
| 58 | +``` |
| 59 | + |
| 60 | +In case it's not installed: |
| 61 | +``` |
| 62 | +cd /path/to/plan9port/src/cmd/fontsrv/ |
| 63 | +9 mk install |
| 64 | +``` |
| 65 | + |
| 66 | +Have a look at all available fonts: |
| 67 | +``` |
| 68 | +9p ls font |
| 69 | +``` |
| 70 | + |
| 71 | +Try one of them: |
| 72 | +``` |
| 73 | +acme -f /mnt/font/'Droid Sans Mono'/13a/font |
| 74 | +``` |
| 75 | + |
| 76 | +## Run |
| 77 | + |
| 78 | +I spawn Acme by running `a` script. |
| 79 | + |
| 80 | +## Scripts |
| 81 | + |
| 82 | +Who is who in **bin** directory: |
| 83 | + |
| 84 | +- `+ EXP` lisp-style polish notation calculator; example: `+ '(+ 1 2 3)'` |
| 85 | +- `F`, `lne`, `lpe`, `ne`, `pe` perl one-liners shortcuts |
| 86 | +- `a` start Acme |
| 87 | +- `a+ SYMBOL` alignment (default is fat comma: `|a+ '=>'`, erlang proplist: `|a+ ' '`) |
| 88 | +- `c+ SYMBOL` add comment (perl: `|c+` or `|c+ '#'`, erlang: `|c+ %`, js: `|c+ //`) |
| 89 | +- `c- SYMBOL` delete comment (perl/erlang: `|c-`, js: `|c- //`) |
| 90 | +- `cc+` snake_case to CamelCase |
| 91 | +- `cc-` CamelCase to snake_case |
| 92 | +- `d` works like `Edit , d` |
| 93 | +- `eman MODULE` shortcut for `erl -man MODULE` (displays the manual page for the Erlang module MODULE) |
| 94 | +- `g+ WHAT` recursively grep current directory |
| 95 | +- `git+ MESSAGE` git: commit and push to master |
| 96 | +- `h+` transform line to heading |
| 97 | +- `hg+ MESSAGE` hg: commit and push to master |
| 98 | +- `html+` html boilerplate |
| 99 | +- `lc+` to lowercase |
| 100 | +- `nobs+` is taken from plan9 `nobs` (it removes all backspace characters and the characters that precede them) |
| 101 | +- `perl+` perl boilerplate (shebang, `use strict` etc) |
| 102 | +- `put+ BROWSER` regular `Put` plus reload active tab in browser: `ff` | `ch` | `sa` |
| 103 | +- `s-` remove leading whitespace |
| 104 | +- `s2t N_SPACES` spaces to tabs (default: 4 spaces to 1 tab) |
| 105 | +- `t2s N_SPACES` tabs to spaces (default: 1 tab to 4 spaces) |
| 106 | +- `t+` add tab |
| 107 | +- `t-` delete tab |
| 108 | +- `uc+` to uppercase |
| 109 | +- `w+ WIDTH` (hello, `fmt -w WIDTH`) |
| 110 | + |
| 111 | +Put these guys in your **$path**. |
| 112 | + |
| 113 | +## Random notes |
| 114 | + |
| 115 | +- `Edit =` find out the current line number |
| 116 | +- `:13` goto 13th line |
| 117 | +- `:0` goto file beginning |
| 118 | +- `:$` goto file end |
| 119 | +- `:0,$` or `:,` or `Edit ,` select the whole file |
| 120 | +- `:1,5` select lines 1..5 |
| 121 | +- `Edit , d` clear window |
| 122 | +- `Edit , < echo hello world` replace window body with some text |
| 123 | +- `Edit , < erl -man maps` replace window body with erlang manual |
| 124 | +- `Edit , s/text/TEXT/g` or `Edit , | perl -pe 's/text/TEXT/g'` global replace |
| 125 | +- `$%` or `$samfile` current file name |
| 126 | +- `$winid` current window id |
| 127 | +- `echo some text | 9p write acme/$winid/body` append to the end of current window |
| 128 | +- keyboard shortcuts: |
| 129 | + - `ctrl-u` delete from cursor to start of line |
| 130 | + - `ctrl-w` delete word before the cursor |
| 131 | + - `ctrl-h` delete character before the cursor |
| 132 | + - `ctrl-a` move cursor to start of the line |
| 133 | + - `ctrl-e` move cursor to end of the line |
| 134 | + - `ctrl-i` tab |
| 135 | + - `ctrl-j` enter |
| 136 | + - `ctrl-f` filepath autocompletion |
| 137 | + - `fn-*left arrow*` go home (macOS) |
| 138 | + - `fn-*right arrow*` go end (macOS) |
| 139 | +- `:foobar` search forward |
| 140 | +- `:-/foobar` search backwards |
| 141 | +- press `esc` to select the last typed text |
| 142 | +- press `esc` again to delete any selected text |
| 143 | +- `Font` switch between fonts |
| 144 | +- `:/^hel` regexp match: lines starting with 'hel' |
| 145 | +- `:/lo\n/` regexp match: lines ending with 'lo' |
| 146 | +- `:/^b/,/^e/` regexp match: lines between starting with 'b' and starting with 'e' |
| 147 | +- `Dump` write the state of acme to the file |
| 148 | +- `Load` restore from the dump |
| 149 | +- `Edit , > perl` pipe window body through perl interpreter (better than `perl -e ...`) |
| 150 | + |
| 151 | +## Sam commands |
| 152 | + |
| 153 | +- `Edit +/hello/` search 'hello' forward |
| 154 | +- `Edit -/hello/` search 'hello' backward |
| 155 | +- `Edit , > wc -l` count lines in file |
| 156 | +- `Edit , | sort` sort lines |
| 157 | +- `Edit 3,5p` print lines 3..5 in new window |
| 158 | +- `Edit 3,5 |uc+` lines 3..5 upper cased |
| 159 | +- `Edit 3,5 s/HE/he/g` replace on 3..5 lines only |
| 160 | +- `Edit 2 d` delete second line |
| 161 | +- `Edit 2 a/new\n/` append text after 2nd line |
| 162 | +- `Edit 2 i/new\n/` insert text before 2nd line |
| 163 | + |
| 164 | +## Cut / Copy selection to a file |
| 165 | + |
| 166 | +- select some text |
| 167 | +- cut: `| sed '' > file.txt` |
| 168 | +- copy: `> sed '' > file.txt` |
| 169 | +- pipe selection to a file: `> awk '{ print(toupper($1)) }' | sort | nl > file.txt` |
| 170 | + |
| 171 | +## Other Plan9 goodies |
| 172 | + |
| 173 | +- `win` start shell in a new window |
| 174 | +- `page FILE` view graphics files |
| 175 | +- `web URL` open url in your browser |
| 176 | + |
| 177 | +## Resources |
| 178 | + |
| 179 | +- [Acme homepage](http://acme.cat-v.org/) |
| 180 | +- [A Tour of the Acme Editor](http://www.youtube.com/watch?v=dP1xVpMPn8M) |
| 181 | +- [Plan 9 Acme Intro](http://www.youtube.com/watch?v=dopu3ZtdCsg) |
| 182 | +- [On using Acme as a day-to-day text editor](http://jlouisramblings.blogspot.ru/2013/04/acme-as-editor_20.html) |
| 183 | +- [Let’s Try Acme](http://echosa.github.io/blog/categories/acme/) |
| 184 | +- [Plan 9 configuration](https://github.com/jlouis/plan9-setup) |
| 185 | +- [Extensibility in the Acme text editor](http://www.mostlymaths.net/2013/03/extensibility-programming-acme-text-editor.html) |
| 186 | +- [Plan 9 from User Space](https://github.com/9fans/plan9port) |
| 187 | +- [Community: 9fans](http://plan9.bell-labs.com/wiki/plan9/9fans/index.html) |
| 188 | +- [Google group: plan9port-dev](https://groups.google.com/forum/#forum/plan9port-dev) |
| 189 | +- [Plan 9 and FreeBSD](https://forums.freebsd.org/threads/rio.29736/) |
0 commit comments