-
Notifications
You must be signed in to change notification settings - Fork 1
/
plumbing-examples
74 lines (63 loc) · 2.52 KB
/
plumbing-examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# This was taken from the default rules
addrelem='((#?[0-9]+)|(/[A-Za-z0-9_\^]+/?)|[.$])'
addr=:($addrelem([,;+\-]$addrelem)*)
twocolonaddr = ([0-9]+)[:.]([0-9]+)
# The rules below don't have `isfile` in them because my system that runs
# the plumber doesn't have my dev box's files mounted. You should be able
# to replace the first `data set $1` line in each rule with `arg isfile $1`.
# ---------------------------------------------------------------------------
# Open paths named `/tmp/buffer-*.??????` as fifos in Kakoune.
# Sets plumb_wdir on the buffer so that plumb clicks work.
# FIXME: Should we be trying to use `action=showdata` instead??
type is text
data matches '/tmp/buffer-([.a-zA-Z¡-0-9_\-@]*[a-zA-Z¡-0-9_\-])\.......'
data set $0
data set $file
attr add session=kakoune
attr add 'evaluate=''edit -fifo %§'$file'§ %§'$1'§ ; try %{set-option window plumb_wdir %§'$wdir'§}'''
plumb to edit
# ---------------------------------------------------------------------------
# Files tagged by line number:columnumber or linenumber.columnumber, twice
type is text
data matches '([.a-zA-Z¡-0-9_/\-@]*[a-zA-Z¡-0-9_/\-])':$twocolonaddr,$twocolonaddr
data set $1
data set $file
attr add session=kakoune
attr add 'evaluate=''edit -existing %§'$data'§ ; select '$2'.'$3','$4'.'$5''''
plumb to edit
# Files tagged by line number:columnumber or linenumber.columnumber
type is text
data matches '([.a-zA-Z¡-0-9_/\-@]*[a-zA-Z¡-0-9_/\-])':$twocolonaddr
data set $1
data set $file
attr add session=kakoune
attr add 'evaluate=''edit -existing %§'$data'§ '$2' '$3''''
plumb to edit
# Files tagged by line number.
type is text
data matches '([.a-zA-Z¡-0-9_/\-@]*[a-zA-Z¡-0-9_/\-])'$addr
data set $1
data set $file
attr add session=kakoune
attr add 'evaluate=''edit -existing %§'$data'§ '$2' ; execute-keys gi'''
plumb to edit
# Untagged paths are just opened.
type is text
data matches '([.a-zA-Z¡-0-9_/\-@]*[a-zA-Z¡-0-9_/\-])'
data set $1
data set $file
attr add session=kakoune
attr add 'evaluate=''edit -existing %§'$data'§'''
plumb to edit
# When action=showdata and we haven't matched anything above, display the data
# in a scratch buffer. This allows you to do things like:
#
# git show |9 plumb -i
#
type is text
type set $attr
type matches '.*action=showdata.*'
type set text
attr add session=kakoune
attr add 'evaluate=''plumb-showdata ; try %{set-option window plumb_wdir %§'$wdir'§}'''
plumb to edit