Skip to content

Commit 7908335

Browse files
committed
Rework READMe
1 parent 5d7201f commit 7908335

File tree

1 file changed

+13
-159
lines changed

1 file changed

+13
-159
lines changed

README.md

Lines changed: 13 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ or by installing `SPC` on your system.
2121
SPC ff -r foo RET i -r "Hello World" ESC SPC fs RET
2222
```
2323

24+
`SPC` expects an Emacs daemon to be already running and ready to receive keyboard macros.
25+
You can start such a daemon manually within Emacs by executing `M-x server-start`.
26+
Or by using a nixos or nix-darwin service that starts an emacs daemon.
27+
28+
There are many options that let you customize how `SPC` talks to your Emacs daemon.
29+
Running `SPC --help` shows the command usage.
30+
31+
2432
### Installing with NixOS or Home-Manager
2533

2634
This flake provides the SPC package that can be added to your environment packages.
@@ -35,7 +43,7 @@ home.packages = [
3543
```
3644

3745

38-
### Imperative Installation
46+
### Nix Imperative Installation
3947

4048
Install `SPC` in your nix profile.
4149

@@ -45,6 +53,10 @@ SPC --help
4553
```
4654

4755

56+
### Installing wihout Nix
57+
58+
Just download `bin/SPC`, it expects coreutils and emacs on PATH.
59+
4860
### Motivation
4961

5062
`SPC` was [born](https://github.com/vic/vix/blob/c55260f9591c7b243145fbbab37d68e775783a8d/vix/modules/vic/emacs/default.nix#L49) as an integration utility to make other applications interact with DOOM/Spacemacs by sending keystrokes.
@@ -66,164 +78,6 @@ just as if you would have typed it.
6678
Some people might also want to create several command aliases to ease frequent use
6779
cases. See the [Integrations] section.
6880

69-
70-
### Manual Page
71-
72-
`SPC` expects an Emacs daemon to be already running and ready to receive keyboard macros.
73-
You can start such a daemon manually within Emacs by executing `M-x server-start`.
74-
Or by using a nixos or nix-darwin service that starts an emacs daemon.
75-
76-
There are many options that let you customize how `SPC` talks to your Emacs daemon.
77-
Running `SPC --help` shows the command usage, included here for reference:
78-
79-
80-
<!--BEGIN_HELP-->
81-
82-
```
83-
SPC - Send a SPC keyboard macro to Spacemacs or DOOM Emacs via emacsclient.
84-
85-
USAGE
86-
87-
SPC [OPTION..] [KEYS..] [-- emacsclient options]
88-
89-
KEYS are key sequence strings in the format accepted by `(kbd)` and as
90-
returned by commands such as `C-h k` in Emacs.
91-
92-
93-
OPTIONS
94-
95-
-D, --describe
96-
Causes emacs to print a brief description of the received
97-
key sequence. This option is useful when debugging or
98-
constructing your first keyboard macro.
99-
100-
-r, --raw <INPUT>
101-
Sends INPUT as if it was directly typed on Emacs.
102-
Since raw inputs can be any byte sequence they are encoded
103-
using the `base64` command and decoded on the Emacs daemon.
104-
105-
This is useful for sending keys that otherwise would be
106-
interpreted as options for SPC itself.
107-
108-
eg. `-r --lisp` will send `(kbd "- - l i s p")` to Emacs.
109-
110-
-f, --file-raw <FILE>
111-
Sends all content from FILE as if directly typed on Emacs.
112-
113-
-f-, --stdin
114-
Sends all content from STDIN as if directly typed on Emacs.
115-
116-
-l, --lisp <CODE>
117-
Expects CODE to be an Emacs lisp expression that produces a
118-
keycode vector.
119-
120-
eg. `-l '(kbd "M-x help RET")'`
121-
122-
-L, --leader <KEYS>
123-
Use KEYS as leader at start of keyboard macro.
124-
Defaults to `SPC` in Spacemacs and DOOM Emacs.
125-
126-
Can also be used to remove the leader, eg:
127-
`SPC -L '' M-x doctor RET`
128-
129-
-W, --wrapper <WRAPPER>
130-
Wrap the keyboard macro invocation inside custom lisp.
131-
The WRAPPER code must include a `(SPC_MACRO)` lisp FORM
132-
that will be replaced with the actual macro invocation.
133-
134-
This option allows you to eg, select a custom buffer or
135-
doing anything special before/after the kbd macro is sent.
136-
137-
eg. `-W '(message "%s" (quote (SPC_MACRO)))'` will just echo
138-
the generated code inside Emacs and actually do nothing.
139-
140-
-WPRINT
141-
A predefined WRAPPER that prints the current buffer text.
142-
143-
eg. in DOOM Emacs the following command will print the ORG
144-
agenda headlines matching "standup":
145-
`SPC oAM standup RET -WPRINT`
146-
147-
148-
149-
-M, --macro-caller <MACRO_CALLER>
150-
Custom Emacs lisp code that executes a keyboard macro.
151-
The MACRO_CALLER code must include a `(SPC_KEYS)`
152-
lisp FORM that will be replaced with the actual
153-
keys vector.
154-
155-
By default it uses `(execute-kbd-macro (SPC_KEYS))`
156-
but can be overriden to and not evaluate the keys at all.
157-
158-
eg. `-M '(key-description (SPC_KEYS))'` just prints the
159-
keysequence that Emacs received.
160-
161-
--dry-run
162-
Just print the emacsclient command that would be run.
163-
164-
-h, --help
165-
Show this help and exit.
166-
167-
--
168-
Stop parsing arguments.
169-
All remaining arguments are given directly to the
170-
emacsclient command.
171-
172-
173-
174-
ENVIRONMENT VARIABLES
175-
176-
SPC_LEADER The leader key used for sending keychords.
177-
178-
Defaults to `SPC` on both Spacemacs and DOOM Emacs.
179-
180-
SPC_WRAPPER Equivalent to always using a `--wrapper` option.
181-
182-
SPC_MACRO_CALLER Equivalent to always using a `--macro-caller` option.
183-
184-
SPC_CLIENT_CMD The command used to send emacslisp code.
185-
It must at least support the `--eval LISP` option.
186-
187-
Defaults to `emacsclient`
188-
189-
SPC_CLIENT_OPTS Additional options for emacsclient.
190-
See `emacsclient --help`.
191-
192-
For example, setting this to `--tty` will
193-
tell emacsclient to always use the terminal UI.
194-
195-
EXAMPLES
196-
197-
# Describe what `SPC f f` does
198-
SPC -D ff # => SPC f f runs the command counsel-find-file
199-
200-
# Remove leader, describe `M-x`
201-
SPC -L '' -D M-x # => M-x runs the command counsel-M-x
202-
203-
# find file in remote Emacs and go to 10th line
204-
SPC ff -r "$PWD/README.md" RET 10 gg
205-
206-
# open Magit rebase interactive in current terminal
207-
SPC g/ri -- --tty
208-
209-
# on DOOM Emacs: create a new ORG Agenda TODO and download an attached URL
210-
SPC Xt C-c C-a u -r "https://example.org" RET -r "Checkout this website" RET C-c C-c
211-
212-
# on DOOM Emacs: open an scratch buffer and pretty-print as json to the terminal
213-
SPC bXi -f some.json ESC -r ':(json-pretty-print-buffer)' RET -WPRINT
214-
215-
216-
REPORTING ISSUES
217-
218-
See https://github.com/vic/SPC for issues, usage examples, integrations and
219-
contributing awesome ideas on how to use SPC to control Emacs from the terminal.
220-
221-
Made with <33 by vic <http://twitter.com/oeiuwq>
222-
```
223-
<!--END_HELP-->
224-
225-
226-
22781
## Integrations
22882

22983
Of course the potential of `SPC` depends on your daily workflow, the tooling

0 commit comments

Comments
 (0)