summaryrefslogblamecommitdiffstats
path: root/2020/subtitles/emacsconf-2020--30-a-tour-of-vterm--gabriele-bozzola-sbozzolo-autogen.sbv
blob: 761568a6e2773803050c391e31aaf83e921a6cee (plain) (tree)



























                                        
                                      










                                      
                                       

                       
                                     































                                        
                                   




































































































































































































                                        
     













                                        
                                       



















                                       
                                      













                                    
                                     




                       
                                        































                                        
                                      

                       
                        

                       
                                      

                       
                   




























                                        
                                     











































                                        
                                        

                       
                                        
















                                       
                                 

                       
                    

                       
                                      

                       
                                     




                       
                               




                       
                                 




                       
                                     

                       
                                    




                       
                                        

                       
            

                       
                                     




                       
                                        

                       
                          







                                      
                                     































                                        
                                 










                                   
                                        
















                                        
                                        
















                                      
                                       
















                                       
                                 



                                    
0:00:00.880,0:00:06.080
hello and welcome to the stock

0:00:03.760,0:00:07.919
the title of the stock is a tour feature

0:00:06.080,0:00:08.559
a fast and fully featured terminal

0:00:07.919,0:00:11.840
emulator

0:00:08.559,0:00:13.360
inside new e-max so let's try to

0:00:11.840,0:00:14.559
understand what we mean with the pass

0:00:13.360,0:00:17.520
and fully featured

0:00:14.559,0:00:18.320
and to do that we'll compare v term with

0:00:17.520,0:00:20.640
the

0:00:18.320,0:00:22.400
packages which are built in Emacs mean

0:00:20.640,0:00:25.199
the term

0:00:22.400,0:00:26.720
so let's let's jump into the v term so

0:00:25.199,0:00:29.679
this is a feature buffer

0:00:26.720,0:00:31.519
and this is a ansi term buffer what I'm

0:00:29.679,0:00:32.160
going to do now is first I'm going to

0:00:31.519,0:00:35.760
prove you

0:00:32.160,0:00:37.520
what we move fast so to do that let me

0:00:35.760,0:00:39.280
open a large file display on screen or

0:00:37.520,0:00:40.239
large file this is about one megabyte of

0:00:39.280,0:00:43.520
data

0:00:40.239,0:00:44.160
and let me time that it takes about 0.6

0:00:43.520,0:00:47.200
seconds

0:00:44.160,0:00:49.760
with feature let's do the same with

0:00:47.200,0:00:51.520
with ancient term well we already

0:00:49.760,0:00:53.039
already see the difference

0:00:51.520,0:00:54.559
so I will use this time to tell you

0:00:53.039,0:00:57.360
what's different and

0:00:54.559,0:00:58.879
what is v term exactly so v term is a

0:00:57.360,0:01:01.120
terminal emulator built

0:00:58.879,0:01:02.719
on top of an external library the

0:01:01.120,0:01:05.519
library is called libvi term

0:01:02.719,0:01:07.200
and is the same library used by newton

0:01:05.519,0:01:10.000
for their own terminal emulator

0:01:07.200,0:01:10.799
it's a c library and this is what gives

0:01:10.000,0:01:15.119
us

0:01:10.799,0:01:17.280
a lot of good features first the speed

0:01:15.119,0:01:18.479
time spent here 0.6 is essentially the

0:01:17.280,0:01:21.520
time that it takes to

0:01:18.479,0:01:22.240
one convert the emax representation of

0:01:21.520,0:01:23.840
like text

0:01:22.240,0:01:26.400
into the visa and representation of what

0:01:23.840,0:01:28.479
was a string and two into

0:01:26.400,0:01:29.520
actually displaying that and that can

0:01:28.479,0:01:31.840
take time

0:01:29.520,0:01:33.680
if there's a if there's quantification

0:01:31.840,0:01:34.240
involved so these are the 0.6 seconds

0:01:33.680,0:01:36.960
there

0:01:34.240,0:01:37.920
as we say in the in ancestor that's much

0:01:36.960,0:01:39.920
much

0:01:37.920,0:01:41.680
more time it's much slower so the

0:01:39.920,0:01:42.880
terminal will feel much snappier much

0:01:41.680,0:01:46.079
faster

0:01:42.880,0:01:47.840
but that's not the main benefit or the

0:01:46.079,0:01:48.799
only benefit of using this external

0:01:47.840,0:01:52.320
library

0:01:48.799,0:01:55.439
feature the second big benefit

0:01:52.320,0:01:56.560
is that v term has support for all the

0:01:55.439,0:01:59.200
escape codes

0:01:56.560,0:02:01.119
that exterm has support for so v term is

0:01:59.200,0:02:03.600
essentially as running x term

0:02:01.119,0:02:04.799
inside an imax buffer so let's see that

0:02:03.600,0:02:07.119
this for example

0:02:04.799,0:02:08.239
let's start by looking at the support

0:02:07.119,0:02:09.920
for colors

0:02:08.239,0:02:11.840
we have support for all the colors out

0:02:09.920,0:02:15.040
of the box we don't have to do anything

0:02:11.840,0:02:15.680
and if we did the same here well we have

0:02:15.040,0:02:17.920
only

0:02:15.680,0:02:19.680
20 colors there's a way to get all the

0:02:17.920,0:02:23.040
colors but it's much more involved

0:02:19.680,0:02:26.000
but this is not where v term shines

0:02:23.040,0:02:27.200
uh we can run all the commands that we

0:02:26.000,0:02:30.480
want

0:02:27.200,0:02:33.040
h top and cdu

0:02:30.480,0:02:33.840
everything runs here also this title

0:02:33.040,0:02:36.400
it's a

0:02:33.840,0:02:37.040
it's a fairly complicated manipulation

0:02:36.400,0:02:40.879
of

0:02:37.040,0:02:42.319
the window and it will not work here

0:02:40.879,0:02:44.640
it just doesn't work actually now the

0:02:42.319,0:02:48.400
terminal is probably messed up

0:02:44.640,0:02:50.959
yes so using this external library

0:02:48.400,0:02:52.000
removes the burden from the developers

0:02:50.959,0:02:54.000
of having to implement

0:02:52.000,0:02:55.360
support for all these cape codes we just

0:02:54.000,0:02:58.480
use those

0:02:55.360,0:03:01.760
so in many ways running veteran

0:02:58.480,0:03:04.400
is us running extern inside a max

0:03:01.760,0:03:05.840
but it's better than that because since

0:03:04.400,0:03:08.879
this is an e-max buffer

0:03:05.840,0:03:09.760
we can enjoy a lot of features from

0:03:08.879,0:03:11.920
Emacs

0:03:09.760,0:03:13.200
as well as a tighter integration with

0:03:11.920,0:03:16.560
e-max itself

0:03:13.200,0:03:17.599
for example as you see here the title of

0:03:16.560,0:03:20.720
my buffer

0:03:17.599,0:03:21.760
is from the director I'm in so let's go

0:03:20.720,0:03:24.799
to my tmp

0:03:21.760,0:03:26.560
the title will change so there's

0:03:24.799,0:03:28.000
information being exchanged between v

0:03:26.560,0:03:29.760
term and index

0:03:28.000,0:03:32.000
and of course the title is not the only

0:03:29.760,0:03:34.799
place where information is exchanged

0:03:32.000,0:03:35.920
I can find a file and I will be in the

0:03:34.799,0:03:38.239
directory

0:03:35.920,0:03:40.000
where my terminal is this feature is

0:03:38.239,0:03:41.680
also available in nc term

0:03:40.000,0:03:43.840
and it works also on b term and it

0:03:41.680,0:03:44.720
follows me so if I go to tmp I'll get

0:03:43.840,0:03:48.000
the tmp

0:03:44.720,0:03:48.640
if I ssh to a remote server it will work

0:03:48.000,0:03:51.120
also

0:03:48.640,0:03:53.920
on remote servers as well which is a

0:03:51.120,0:03:55.760
very nice way to edit files remotely

0:03:53.920,0:03:57.360
while we're working on a shelf and

0:03:55.760,0:03:59.599
second while vterm

0:03:57.360,0:04:02.159
is not an e-lisp interpreter like

0:03:59.599,0:04:06.080
initial what we can do is we can

0:04:02.159,0:04:08.319
still run inbox functions so for example

0:04:06.080,0:04:10.159
that requires some configuration the

0:04:08.319,0:04:12.480
term

0:04:10.159,0:04:14.000
command message I as you see there's a

0:04:12.480,0:04:16.239
higher so what I'm doing

0:04:14.000,0:04:17.199
is I'm executing the eagles function I

0:04:16.239,0:04:19.840
and I can drop that

0:04:17.199,0:04:20.320
and turn it around uh hash function to

0:04:19.840,0:04:24.880
run

0:04:20.320,0:04:27.600
a-list functions or another one file see

0:04:24.880,0:04:28.800
we call this feature message passing and

0:04:27.600,0:04:30.880
it requires

0:04:28.800,0:04:32.000
some configuration on the emac side as

0:04:30.880,0:04:34.000
well as in the shell side

0:04:32.000,0:04:35.360
it's important to stress what's the

0:04:34.000,0:04:37.360
nature of feature

0:04:35.360,0:04:39.120
for instance every time I'm sending a

0:04:37.360,0:04:40.800
key binding it's not immediately clear

0:04:39.120,0:04:42.720
if my intention is to send it to the

0:04:40.800,0:04:44.320
shell or to imax so v term implements

0:04:42.720,0:04:46.800
some reasonable defaults

0:04:44.320,0:04:49.120
but at the moment it's mainly packaged

0:04:46.800,0:04:51.199
to display characters on a screen

0:04:49.120,0:04:53.600
so for example if you're using evil the

0:04:51.199,0:04:55.759
editing commands in evil will not work

0:04:53.600,0:04:57.840
immediately there's some work to be done

0:04:55.759,0:04:58.479
and integration can be improved on that

0:04:57.840,0:05:00.240
side but

0:04:58.479,0:05:02.240
sometimes we really want this to behave

0:05:00.240,0:05:05.440
exactly like a imax buffer

0:05:02.240,0:05:07.039
we want to be able to search if

0:05:05.440,0:05:08.880
if I try to get it to search it will not

0:05:07.039,0:05:09.360
work I will send it to the shop so to do

0:05:08.880,0:05:12.400
that

0:05:09.360,0:05:12.800
we enabled the term copy mode so as you

0:05:12.400,0:05:15.280
see

0:05:12.800,0:05:17.039
copy mode and now this buffer is

0:05:15.280,0:05:21.120
essentially a fundamental buffer

0:05:17.039,0:05:24.400
I can move around as I can search

0:05:21.120,0:05:25.840
uh so it must have I

0:05:24.400,0:05:27.120
can do everything I want and there are

0:05:25.840,0:05:29.600
additional features for example I can

0:05:27.120,0:05:31.440
jump around

0:05:29.600,0:05:32.639
all the prompts and I find this

0:05:31.440,0:05:34.400
extremely useful

0:05:32.639,0:05:35.919
because I can copy update from my

0:05:34.400,0:05:39.199
programs or

0:05:35.919,0:05:42.400
what I always have to do is I have to

0:05:39.199,0:05:43.120
google some errors so what I do is I

0:05:42.400,0:05:45.919
select that

0:05:43.120,0:05:46.880
and I have my keybinding in maksakov and

0:05:45.919,0:05:49.199
I'm googling

0:05:46.880,0:05:50.400
what I have to google so this is very

0:05:49.199,0:05:52.800
nice and

0:05:50.400,0:05:54.400
if I now that have selected something if

0:05:52.800,0:05:57.120
I just press return I will

0:05:54.400,0:05:57.440
go back to my normal editing mode with

0:05:57.120,0:06:00.400
the

0:05:57.440,0:06:01.600
text copied so I can paste it back so

0:06:00.400,0:06:04.160
it's a quick way to

0:06:01.600,0:06:06.400
interact with copy and interact with uh

0:06:04.160,0:06:07.840
with the output of a buffer so finally

0:06:06.400,0:06:10.560
let's discuss how to actually

0:06:07.840,0:06:12.400
use beta let's circle back and let's go

0:06:10.560,0:06:14.400
and let's look at the github repo

0:06:12.400,0:06:15.520
where development is happening v term is

0:06:14.400,0:06:17.919
available in velpa

0:06:15.520,0:06:18.960
but since it's leveraging the power of

0:06:17.919,0:06:20.639
an external module

0:06:18.960,0:06:22.000
you must have Emacs compiled with

0:06:20.639,0:06:25.600
support for modules

0:06:22.000,0:06:27.199
and many distros like ubuntu debian

0:06:25.600,0:06:29.840
that's not there so you have to get

0:06:27.199,0:06:30.160
Emacs with support for modules compiling

0:06:29.840,0:06:32.000
or

0:06:30.160,0:06:33.840
getting images somewhere else and also

0:06:32.000,0:06:34.400
the first time you are going to use this

0:06:33.840,0:06:37.440
which

0:06:34.400,0:06:40.319
works only on mac or

0:06:37.440,0:06:41.759
new linux systems Emacs will try to find

0:06:40.319,0:06:43.680
and compile this module

0:06:41.759,0:06:45.440
so it's important this requirement is

0:06:43.680,0:06:47.600
important if you're using windows

0:06:45.440,0:06:49.199
well that's not it's not available and

0:06:47.600,0:06:52.560
will not work

0:06:49.199,0:06:53.440
so to conclude I want to just advertise

0:06:52.560,0:06:56.240
this page

0:06:53.440,0:06:57.120
if you have problems look at the issues

0:06:56.240,0:06:59.039
and

0:06:57.120,0:07:00.800
open unusual in case we'll try to help

0:06:59.039,0:07:02.639
you we are very excited about feature

0:07:00.800,0:07:10.319
and I think it's a transformative

0:07:02.639,0:07:10.319
terminal experience inside glue imax