summaryrefslogblamecommitdiffstats
path: root/2020/subtitles/emacsconf-2020--30-a-tour-of-vterm--gabriele-bozzola-sbozzolo-autogen.vtt
blob: 49db09890624be3e6e6f4fb8709eb3d174656902 (plain) (tree)
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634

























































































































































































































































































































































































































































































































































































































































                                        
WEBVTT

00:00:00.880 --> 00:00:03.760
hello and welcome to the stock

00:00:03.760 --> 00:00:06.080
the title of the stock is a tour feature

00:00:06.080 --> 00:00:07.919
a fast and fully featured terminal

00:00:07.919 --> 00:00:08.559
emulator

00:00:08.559 --> 00:00:11.840
inside new e-max so let's try to

00:00:11.840 --> 00:00:13.360
understand what we mean with the pass

00:00:13.360 --> 00:00:14.559
and fully featured

00:00:14.559 --> 00:00:17.520
and to do that we'll compare v term with

00:00:17.520 --> 00:00:18.320
the

00:00:18.320 --> 00:00:20.640
packages which are built in Emacs mean

00:00:20.640 --> 00:00:22.400
the term

00:00:22.400 --> 00:00:25.199
so let's let's jump into the v term so

00:00:25.199 --> 00:00:26.720
this is a feature buffer

00:00:26.720 --> 00:00:29.679
and this is a ansi term buffer what I'm

00:00:29.679 --> 00:00:31.519
going to do now is first I'm going to

00:00:31.519 --> 00:00:32.160
prove you

00:00:32.160 --> 00:00:35.760
what we move fast so to do that let me

00:00:35.760 --> 00:00:37.520
open a large file display on screen or

00:00:37.520 --> 00:00:39.280
large file this is about one megabyte of

00:00:39.280 --> 00:00:40.239
data

00:00:40.239 --> 00:00:43.520
and let me time that it takes about 0.6

00:00:43.520 --> 00:00:44.160
seconds

00:00:44.160 --> 00:00:47.200
with feature let's do the same with

00:00:47.200 --> 00:00:49.760
with ancient term well we already

00:00:49.760 --> 00:00:51.520
already see the difference

00:00:51.520 --> 00:00:53.039
so I will use this time to tell you

00:00:53.039 --> 00:00:54.559
what's different and

00:00:54.559 --> 00:00:57.360
what is v term exactly so v term is a

00:00:57.360 --> 00:00:58.879
terminal emulator built

00:00:58.879 --> 00:01:01.120
on top of an external library the

00:01:01.120 --> 00:01:02.719
library is called libvi term

00:01:02.719 --> 00:01:05.519
and is the same library used by newton

00:01:05.519 --> 00:01:07.200
for their own terminal emulator

00:01:07.200 --> 00:01:10.000
it's a c library and this is what gives

00:01:10.000 --> 00:01:10.799
us

00:01:10.799 --> 00:01:15.119
a lot of good features first the speed

00:01:15.119 --> 00:01:17.280
time spent here 0.6 is essentially the

00:01:17.280 --> 00:01:18.479
time that it takes to

00:01:18.479 --> 00:01:21.520
one convert the emax representation of

00:01:21.520 --> 00:01:22.240
like text

00:01:22.240 --> 00:01:23.840
into the visa and representation of what

00:01:23.840 --> 00:01:26.400
was a string and two into

00:01:26.400 --> 00:01:28.479
actually displaying that and that can

00:01:28.479 --> 00:01:29.520
take time

00:01:29.520 --> 00:01:31.840
if there's a if there's quantification

00:01:31.840 --> 00:01:33.680
involved so these are the 0.6 seconds

00:01:33.680 --> 00:01:34.240
there

00:01:34.240 --> 00:01:36.960
as we say in the in ancestor that's much

00:01:36.960 --> 00:01:37.920
much

00:01:37.920 --> 00:01:39.920
more time it's much slower so the

00:01:39.920 --> 00:01:41.680
terminal will feel much snappier much

00:01:41.680 --> 00:01:42.880
faster

00:01:42.880 --> 00:01:46.079
but that's not the main benefit or the

00:01:46.079 --> 00:01:47.840
only benefit of using this external

00:01:47.840 --> 00:01:48.799
library

00:01:48.799 --> 00:01:52.320
feature the second big benefit

00:01:52.320 --> 00:01:55.439
is that v term has support for all the

00:01:55.439 --> 00:01:56.560
escape codes

00:01:56.560 --> 00:01:59.200
that exterm has support for so v term is

00:01:59.200 --> 00:02:01.119
essentially as running x term

00:02:01.119 --> 00:02:03.600
inside an imax buffer so let's see that

00:02:03.600 --> 00:02:04.799
this for example

00:02:04.799 --> 00:02:07.119
let's start by looking at the support

00:02:07.119 --> 00:02:08.239
for colors

00:02:08.239 --> 00:02:09.920
we have support for all the colors out

00:02:09.920 --> 00:02:11.840
of the box we don't have to do anything

00:02:11.840 --> 00:02:15.040
and if we did the same here well we have

00:02:15.040 --> 00:02:15.680
only

00:02:15.680 --> 00:02:17.920
20 colors there's a way to get all the

00:02:17.920 --> 00:02:19.680
colors but it's much more involved

00:02:19.680 --> 00:02:23.040
but this is not where v term shines

00:02:23.040 --> 00:02:26.000
uh we can run all the commands that we

00:02:26.000 --> 00:02:27.200
want

00:02:27.200 --> 00:02:30.480
h top and cdu

00:02:30.480 --> 00:02:33.040
everything runs here also this title

00:02:33.040 --> 00:02:33.840
it's a

00:02:33.840 --> 00:02:36.400
it's a fairly complicated manipulation

00:02:36.400 --> 00:02:37.040
of

00:02:37.040 --> 00:02:40.879
the window and it will not work here

00:02:40.879 --> 00:02:42.319
it just doesn't work actually now the

00:02:42.319 --> 00:02:44.640
terminal is probably messed up

00:02:44.640 --> 00:02:48.400
yes so using this external library

00:02:48.400 --> 00:02:50.959
removes the burden from the developers

00:02:50.959 --> 00:02:52.000
of having to implement

00:02:52.000 --> 00:02:54.000
support for all these cape codes we just

00:02:54.000 --> 00:02:55.360
use those

00:02:55.360 --> 00:02:58.480
so in many ways running veteran

00:02:58.480 --> 00:03:01.760
is us running extern inside a max

00:03:01.760 --> 00:03:04.400
but it's better than that because since

00:03:04.400 --> 00:03:05.840
this is an e-max buffer

00:03:05.840 --> 00:03:08.879
we can enjoy a lot of features from

00:03:08.879 --> 00:03:09.760
Emacs

00:03:09.760 --> 00:03:11.920
as well as a tighter integration with

00:03:11.920 --> 00:03:13.200
e-max itself

00:03:13.200 --> 00:03:16.560
for example as you see here the title of

00:03:16.560 --> 00:03:17.599
my buffer

00:03:17.599 --> 00:03:20.720
is from the director I'm in so let's go

00:03:20.720 --> 00:03:21.760
to my tmp

00:03:21.760 --> 00:03:24.799
the title will change so there's

00:03:24.799 --> 00:03:26.560
information being exchanged between v

00:03:26.560 --> 00:03:28.000
term and index

00:03:28.000 --> 00:03:29.760
and of course the title is not the only

00:03:29.760 --> 00:03:32.000
place where information is exchanged

00:03:32.000 --> 00:03:34.799
I can find a file and I will be in the

00:03:34.799 --> 00:03:35.920
directory

00:03:35.920 --> 00:03:38.239
where my terminal is this feature is

00:03:38.239 --> 00:03:40.000
also available in nc term

00:03:40.000 --> 00:03:41.680
and it works also on b term and it

00:03:41.680 --> 00:03:43.840
follows me so if I go to tmp I'll get

00:03:43.840 --> 00:03:44.720
the tmp

00:03:44.720 --> 00:03:48.000
if I ssh to a remote server it will work

00:03:48.000 --> 00:03:48.640
also

00:03:48.640 --> 00:03:51.120
on remote servers as well which is a

00:03:51.120 --> 00:03:53.920
very nice way to edit files remotely

00:03:53.920 --> 00:03:55.760
while we're working on a shelf and

00:03:55.760 --> 00:03:57.360
second while vterm

00:03:57.360 --> 00:03:59.599
is not an e-lisp interpreter like

00:03:59.599 --> 00:04:02.159
initial what we can do is we can

00:04:02.159 --> 00:04:06.080
still run inbox functions so for example

00:04:06.080 --> 00:04:08.319
that requires some configuration the

00:04:08.319 --> 00:04:10.159
term

00:04:10.159 --> 00:04:12.480
command message I as you see there's a

00:04:12.480 --> 00:04:14.000
higher so what I'm doing

00:04:14.000 --> 00:04:16.239
is I'm executing the eagles function I

00:04:16.239 --> 00:04:17.199
and I can drop that

00:04:17.199 --> 00:04:19.840
and turn it around uh hash function to

00:04:19.840 --> 00:04:20.320
run

00:04:20.320 --> 00:04:24.880
a-list functions or another one file see

00:04:24.880 --> 00:04:27.600
we call this feature message passing and

00:04:27.600 --> 00:04:28.800
it requires

00:04:28.800 --> 00:04:30.880
some configuration on the emac side as

00:04:30.880 --> 00:04:32.000
well as in the shell side

00:04:32.000 --> 00:04:34.000
it's important to stress what's the

00:04:34.000 --> 00:04:35.360
nature of feature

00:04:35.360 --> 00:04:37.360
for instance every time I'm sending a

00:04:37.360 --> 00:04:39.120
key binding it's not immediately clear

00:04:39.120 --> 00:04:40.800
if my intention is to send it to the

00:04:40.800 --> 00:04:42.720
shell or to imax so v term implements

00:04:42.720 --> 00:04:44.320
some reasonable defaults

00:04:44.320 --> 00:04:46.800
but at the moment it's mainly packaged

00:04:46.800 --> 00:04:49.120
to display characters on a screen

00:04:49.120 --> 00:04:51.199
so for example if you're using evil the

00:04:51.199 --> 00:04:53.600
editing commands in evil will not work

00:04:53.600 --> 00:04:55.759
immediately there's some work to be done

00:04:55.759 --> 00:04:57.840
and integration can be improved on that

00:04:57.840 --> 00:04:58.479
side but

00:04:58.479 --> 00:05:00.240
sometimes we really want this to behave

00:05:00.240 --> 00:05:02.240
exactly like a imax buffer

00:05:02.240 --> 00:05:05.440
we want to be able to search if

00:05:05.440 --> 00:05:07.039
if I try to get it to search it will not

00:05:07.039 --> 00:05:08.880
work I will send it to the shop so to do

00:05:08.880 --> 00:05:09.360
that

00:05:09.360 --> 00:05:12.400
we enabled the term copy mode so as you

00:05:12.400 --> 00:05:12.800
see

00:05:12.800 --> 00:05:15.280
copy mode and now this buffer is

00:05:15.280 --> 00:05:17.039
essentially a fundamental buffer

00:05:17.039 --> 00:05:21.120
I can move around as I can search

00:05:21.120 --> 00:05:24.400
uh so it must have I

00:05:24.400 --> 00:05:25.840
can do everything I want and there are

00:05:25.840 --> 00:05:27.120
additional features for example I can

00:05:27.120 --> 00:05:29.600
jump around

00:05:29.600 --> 00:05:31.440
all the prompts and I find this

00:05:31.440 --> 00:05:32.639
extremely useful

00:05:32.639 --> 00:05:34.400
because I can copy update from my

00:05:34.400 --> 00:05:35.919
programs or

00:05:35.919 --> 00:05:39.199
what I always have to do is I have to

00:05:39.199 --> 00:05:42.400
google some errors so what I do is I

00:05:42.400 --> 00:05:43.120
select that

00:05:43.120 --> 00:05:45.919
and I have my keybinding in maksakov and

00:05:45.919 --> 00:05:46.880
I'm googling

00:05:46.880 --> 00:05:49.199
what I have to google so this is very

00:05:49.199 --> 00:05:50.400
nice and

00:05:50.400 --> 00:05:52.800
if I now that have selected something if

00:05:52.800 --> 00:05:54.400
I just press return I will

00:05:54.400 --> 00:05:57.120
go back to my normal editing mode with

00:05:57.120 --> 00:05:57.440
the

00:05:57.440 --> 00:06:00.400
text copied so I can paste it back so

00:06:00.400 --> 00:06:01.600
it's a quick way to

00:06:01.600 --> 00:06:04.160
interact with copy and interact with uh

00:06:04.160 --> 00:06:06.400
with the output of a buffer so finally

00:06:06.400 --> 00:06:07.840
let's discuss how to actually

00:06:07.840 --> 00:06:10.560
use beta let's circle back and let's go

00:06:10.560 --> 00:06:12.400
and let's look at the github repo

00:06:12.400 --> 00:06:14.400
where development is happening v term is

00:06:14.400 --> 00:06:15.520
available in velpa

00:06:15.520 --> 00:06:17.919
but since it's leveraging the power of

00:06:17.919 --> 00:06:18.960
an external module

00:06:18.960 --> 00:06:20.639
you must have Emacs compiled with

00:06:20.639 --> 00:06:22.000
support for modules

00:06:22.000 --> 00:06:25.600
and many distros like ubuntu debian

00:06:25.600 --> 00:06:27.199
that's not there so you have to get

00:06:27.199 --> 00:06:29.840
Emacs with support for modules compiling

00:06:29.840 --> 00:06:30.160
or

00:06:30.160 --> 00:06:32.000
getting images somewhere else and also

00:06:32.000 --> 00:06:33.840
the first time you are going to use this

00:06:33.840 --> 00:06:34.400
which

00:06:34.400 --> 00:06:37.440
works only on mac or

00:06:37.440 --> 00:06:40.319
new linux systems Emacs will try to find

00:06:40.319 --> 00:06:41.759
and compile this module

00:06:41.759 --> 00:06:43.680
so it's important this requirement is

00:06:43.680 --> 00:06:45.440
important if you're using windows

00:06:45.440 --> 00:06:47.600
well that's not it's not available and

00:06:47.600 --> 00:06:49.199
will not work

00:06:49.199 --> 00:06:52.560
so to conclude I want to just advertise

00:06:52.560 --> 00:06:53.440
this page

00:06:53.440 --> 00:06:56.240
if you have problems look at the issues

00:06:56.240 --> 00:06:57.120
and

00:06:57.120 --> 00:06:59.039
open unusual in case we'll try to help

00:06:59.039 --> 00:07:00.800
you we are very excited about feature

00:07:00.800 --> 00:07:02.639
and I think it's a transformative

00:07:02.639 --> 00:07:10.319
terminal experience inside glue imax