/usr/share/vile/pictmode.rc is in vile-common 9.8s-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | ; $Header: /usr/build/vile/vile/macros/RCS/pictmode.rc,v 1.4 2005/04/19 19:21:59 tom Exp $
; this procedure implements a primitive ascii picture-drawing mode.
; pgf, may '95
; motions are accomplished with the usual h, j, k, and l keys
; (the arrow keys do _not_ work here). in addition, the u, i,
; n, and m keys will perform diagonal motions. look at your
; keyboard to see why these were chosen.
; normally, entering the motion characters (h, j, k, l, u, i, n, m)
; will draw appropriate box outlines, using the -, |, /, and \ characters.
; lines will be drawn instead with a specific character if the 'c' command
; is given -- you will be prompted for a character. this can be
; cancelled, to revert lines to their "natural" rendition, with the
; 'C' command. for example, to draw with a '+' character, you would
; use "c+" and when finished, would cancel with "C".
; the ^T command will allow you to enter a string of text. this
; text will accumulate until ESC, CR, or NL is typed.
; all other input will be inserted as-is, with no cursor movement. so
; the space bar can be used to "erase" previously drawn stuff.
; space for the picture must be pre-allocated, with, for example:
; 80i <ESC>yy24p
;
; start this up with "run pic"
; to bind it to a key instead, change it to a "NN store-macro", and
; then bind "execute-macro NN" to the key you want.
store-procedure replc
; never replace a newline
~if &equ $char 0xA
~return
~endif
~if &seq %userchar &chr 0
replace-character %linechar
~else
replace-character %userchar
~endif
~endm
store-procedure pic
~local %keywas %linechar %textkey %userchar
set-variable %keywas &chr 0
set-variable %userchar &chr 0
set-variable %linechar &chr 0
write-message "entering picture, end with ESC"
redraw-display
~while 1
set-variable %keywas >k
; was it ESC? quit if so.
~if &seq %keywas &chr 0x1b
~break
~endif
; Rectangular Lines: h, j, k, l
~if &seq %keywas h
~force backward-character
set-variable %linechar -
run replc
~goto redraw
~endif
~if &seq %keywas l
~force forward-character
set-variable %linechar -
run replc
~goto redraw
~endif
~if &seq %keywas j
~force down-line
set-variable %linechar |
run replc
~goto redraw
~endif
~if &seq %keywas k
~force up-line
set-variable %linechar |
run replc
~goto redraw
~endif
; Diagonal Lines: u, i, n, m
~if &seq %keywas u
~force up-line
~force backward-character
set-variable %linechar "\\"
run replc
~goto redraw
~endif
~if &seq %keywas i
~force up-line
~force forward-character
set-variable %linechar /
run replc
~goto redraw
~endif
~if &seq %keywas n
~force down-line
~force backward-character
set-variable %linechar /
run replc
~goto redraw
~endif
~if &seq %keywas m
~force down-line
~force forward-character
set-variable %linechar "\\"
run replc
~goto redraw
~endif
; Rectangular Motions: ^H, ^L, ^J, ^K
; was it ^H
~if &seq %keywas &chr 0x8
~force backward-character
~goto redraw
~endif
; was it ^L
~if &seq %keywas &chr 0xC
~force forward-character
~goto redraw
~endif
; was it ^J
~if &seq %keywas &chr 0xA
~force down-line
~goto redraw
~endif
; was it ^K
~if &seq %keywas &chr 0xB
~force up-line
~goto redraw
~endif
; Diagonal Motions: ^U, ^I, ^N, ^M
; was it ^U
~if &seq %keywas &chr 0x15
~force up-line
~force backward-character
~goto redraw
~endif
; was it ^I
~if &seq %keywas &chr 0x9
~force up-line
~force forward-character
~goto redraw
~endif
; was it ^N
~if &seq %keywas &chr 0xE
~force down-line
~force backward-character
~goto redraw
~endif
; was it ^M
~if &seq %keywas &chr 0xD
~force down-line
~force forward-character
~goto redraw
~endif
; Text: ^Ttext to be entered<CR>
; was it ^T
~if &seq %keywas &chr 0x14
write-message "entering text, end with CR"
redraw-display
set-variable %textkey 0
~while 1
set-variable %textkey >k
; was it CR (^M)
~if &seq %textkey &chr 0xD
~break
~endif
; was it LF (^J)
~if &seq %textkey &chr 0xA
~break
~endif
; was it ESC (^[)
~if &seq %textkey &chr 0x1B
~break
~endif
; was it BS (^H) or DEL?
~if &or &seq %textkey &chr 0x7f &seq %textkey &chr 0x8
~force backward-character
replace-character &chr 0x20
~force backward-character
set-variable %textkey &chr $char
~endif
replace-character %textkey
~force forward-character
redraw-display
~endwhile
write-message "text done, drawing lines again"
~goto redraw
~endif
; user-selected lines: 'c' to set the linechar, 'C' to cancel
~if &seq %keywas c
write-message "enter char to draw with: "
set-variable %userchar >k
write-message &cat "will draw with: " %userchar
~goto redraw
~endif
~if &seq %keywas C
write-message "will draw normal lines again"
set-variable %userchar &chr 0
~goto redraw
~endif
; Everything else is self inserting
replace-character %keywas
*redraw
redraw-display
~endwhile
write-message "picture mode done"
~endm
|