Under construction. (Last change: 20 June 2023)
Parkour is a Lua library and a few text editor plugins for structured editing of Lisp S-expressions.
This chapter describes behaviour common to all plugins based on Parkour.
Parkour maps the typical objects used in text editors to S-expressions (atoms and lists):
Parkour provides the following motion types:
When the cursor is in code, they skip over comments. (For other ways to descend into comments, see word-descent, delete-descent, semicolon-descent)
When the cursor is inside a quasi-list, horizontal motions land on individual words.
Moreover, when in a group of line comments, horizontal motions will leave the current comment
and enter the previous/next one, effectively treating the whole group as a single comment.
Besides the sexp-aware editing operators, which have dedicated key bindings, Parkour enhances the behaviour of common keys like BS, DEL, RET, SPC, and ;.
If in the code that would be commented out there was a delimiter whose match is on another line, the delimiter and anything to the right of it is moved to the next line in order to prevent any unbalancing.
In Clojure and Fennel square brackets are required at certain places. Parkour will insert a square bracket even if you pressed the wrong kind of delimiter (paren, brace, or even double-quote).
In some Scheme dialects (e.g., Racket) square brackets are recommended for readability reasons. If you are using such a dialect, you can get this behaviour by enabling the auto_square_brackets option.
Some features could not be abstracted into the Parkour library and had to be implemented in the top-layer code of a particular editor plugin.
This is a generalization over linewise pasting — pasting a previously deleted/yanked sexp object will put it before or after the current object and insert an appropriate whitespace separator (space or newline), regardless of where exactly the cursor is.
This makes it easy to, say, transpose/barf/slurp, without using the dedicated operators, this way flattening the learning curve a bit.
Of course, the dedicated operators have their advantages — fewer keypresses, keeping cursor position, atomic undo, dot-repeatability.
When inside a list or quasi-list, d-ing with a motion that lands on one of the delimiters will remove the opposite delimiter as well. This merges two paredit commands — splice-killing-{forward,backward} and splicing, into the NORMAL-mode delete. You can use dE, dB, x, or X, but any motion that leads to the above situation will do (even something like d5h).
This reverses the typical for vi verb-noun order, and makes vi motions work like those in Kakoune.