run
8.18
top
← prev up next →

tmux-vim-demoπŸ”— i

D. Ben Knoble

This language provides a convenient way to run a demo.

The demo is formed from a running shell and a script. The script is simply a record of commands you may or may not want to send to the shell, so it has some things in common with an actor’s script of lines as well as with a programmer’s program script.

Running a program in this language will spawn a new tmux session with a shell on the left and Vim (in readonly mode by default) on the right. Vim will have two keybindings: Normal-mode r sends the line under the cursor to the shell and moves down a line. Visual-mode r does the same for the visually-selected lines.

If the #:pre directive is given, the corresponding commands will be given to tmux new-session: the shell pane on the left will be replaced with the result of those commands.

If the #:demo? directive is given it controls whether Vim will be in readonly mode. The value #t (the default) means readonly mode while #f means read-write mode.

Keybindings require tpope/vim-tbone to be installed in Vim, or at least a compatible definition of :Twrite. Technically the programs produced by this language will run without it; however, the r keybindings will produce errors.

demo

::=

[name]

[dir]

[pre-commands]

[demo]

Script lines ...

name

::=

#:namesession name (string)

dir

::=

#:dirdirectory for demo (string)

pre-commands

::=

#:precommands for shell (string)

demo

::=

#:demo?readonly mode? (boolean)

The module tmux-vim-demo also provides library bindings.

The language expands into a call to run-demo and exit s with the returned status-code.

procedure

( run-demo name
dir
filename
pre-commands
demo?)byte?
name:(or/c #fstring? )
dir:(or/c #fstring? )
filename:string?
pre-commands:(or/c #fstring? )
demo?:boolean?
Runs the demo in a tmux session named name with directory dir. The opened file is filename. Returns the exit code of the tmux invocation.

If name is #f, uses the base-name of filename.

If dir is #f, uses the user’s home directory.

If pre-commands is #f, lets tmux spawn a shell or its default-command. Otherwise, they are given to new-session.

If demo?, run view (Vim in readonly mode). Otherwise, run vim.

procedure

( run namedirfilenamepre-commands)byte?

name:(or/c #fstring? )
dir:(or/c #fstring? )
filename:string?
pre-commands:(or/c #fstring? )
Same as run-demo with demo? being #f.

procedure

( run-racket-demo namedirfilename)byte?

name:(or/c #fstring? )
dir:(or/c #fstring? )
filename:string?
Same as run-demo with demo? being #t and pre-commands being "racket".

procedure

( run-racket namedirfilename)byte?

name:(or/c #fstring? )
dir:(or/c #fstring? )
filename:string?
Same as run-demo with demo? being #f and pre-commands being "racket".

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /