description | Plugin for the Vis editor |
owner | 8ubr3blt@NOanonSPAMaddy.me |
last change | Sun, 17 Mar 2024 14:38:58 +0000 (17 22:38 +0800) |
URL | git://repo.or.cz/vis-parkour.git |
https://repo.or.cz/vis-parkour.git | |
push URL | ssh://repo.or.cz/vis-parkour.git |
https://repo.or.cz/vis-parkour.git (learn more) | |
bundle info | vis-parkour.git downloadable bundles |
content tags |
vis-parkour is a structured editing plugin for the vis editor, based on the parkour library.
In ~/.config/vis/visrc.lua
:
local pk = require'vis-parkour'
-- optional:
pk.auto_square_brackets = true
pk.lispwords.scheme.lambda = 0
pk.repl_fifo = os.getenv('HOME')..'/.repl_fifo'
pk.emacs = false
pk.autoselect = true
auto_square_brackets
Rewrites any delimiter to a square bracket at certain locations.
Has effect only on Scheme; for Clojure and Fennel this behaviour is always on.
Works both when inserting and wrapping.
The locations are not configurable ATM, but are grouped by language in the code - see, for example, the Fennel config.
lispwords
.dialect.word
The plugin comes with a set of indentation rules for each supported file type,
but they are incomplete and sometimes will be wrong (due to multiple possible dialects under a single file type).
The lispwords
table allows customizing those rules by setting the desired number of distinguished arguments
a function/macro has. (0
is like defun
in Emacs.)
As an example, see the built-in indent numbers for Scheme.
repl_fifo
This option can be set to the path of a named pipe from which a REPL (or anything, really) can read input.
Pressing Enter
will send to this pipe either the current paragraph or the visual selection.
This works in INSERT mode, too, but only when the cursor is after the last character of a paragraph.
Since REPL commands fit the criteria for paragraph (a top-level S-expression), they get sent as well.
emacs
The plugin comes with two key themes - emacs and vim.
Both are enabled by default (there is no overlap between their key mappings; moreover, the emacs
theme consists entirely of INSERT-mode mappings).
Setting this option to false will disable the emacs
key theme.
Note: The linked key themes are the only "documentation" on the available keyboard shortcuts ATM.
autoselect
("Kakoune mode")Setting this option to true will make every motion that has an associated S-expression textobject to automatically select it.
INSERT mode can be directly switched to from VISUAL mode; i
will put the cursor before the selection, and a
- after it.
Note: the Kakoune reference is mainly wrt the noun-verb order; this is not an attempt to recreate Kakoune's own key mappings. (Adding a new key theme could do that, but only to an extent.)
d
, and left intact if you use c
(or are in INSERT mode).y
/d
/c
was used with a textobject, p
will paste after the current S-expression,
and P
- before it.d
and y
:yE
/yB
wraps the copied half of the list in the same delimiters as the original (including any reader macro prefix).dE
/dB
does so too, and splices the original list.v
while in VISUAL mode expands the selection by semantic units.For some of the supported dialects (Guile, Racket, and Fennel, currently), the plugin cooperates with vis-goto-file, and parses include expressions for it.
Vis lacks a "file-changed" kind of event, so the plugin cannot detect any changes other than
those it caused itself.
This can be a problem if you use custom operators, or rotate visual selections (maybe other things, too).
When a change goes undetected, the internal parse tree grows out of sync with the actual text,
word boundaries are no longer where the plugin expects them to be, and various weird and hard-to-reproduce issues may occur.
A work-around is to call undo and redo right after an external change.
Count argument is not implemented yet for operators and textobjects (but works for motions). OTOH, dot-repeating and semantic expansion of the visual selection do work and can often be good enough a substitute.
Dot-repeating a deletion will concatenateallthepieces in the register instead of overwriting the last piece.
5 months ago | master | logtree |
11 months ago | wrap | logtree |
11 months ago | fix-paragraph | logtree |
11 months ago | exclusive-paragraph | logtree |
11 months ago | dot-repeat | logtree |
11 months ago | objectwise | logtree |