chore: import official kitty sources from upstream
Bring the kovidgoyal/kitty codebase in as the base of FWS-Kitty, vendored at upstream commit 91fb38a without its git history.
This commit is contained in:
commit
7e7d249099
1134 files changed
+433629
No files matched your search
Vendored
+95
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* custom.css
|
||||
* Copyright (C) 2018 Kovid Goyal
|
||||
*
|
||||
* Distributed under terms of the MIT license.
|
||||
*/
|
||||
|
||||
.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.sidebar-logo {
|
||||
height: 128px;
|
||||
}
|
||||
|
||||
.major-features li {
|
||||
margin-bottom: 0.75ex;
|
||||
margin-top: 0.75ex;
|
||||
}
|
||||
|
||||
.sidebar-tree a.current {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
details > summary {
|
||||
color: var(--color-link);
|
||||
cursor: pointer;
|
||||
text-decoration-color: var(--color-link-underline);
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
|
||||
/* pygments adds an underline to some white-space, this is particularly visible in
|
||||
* dark mode. Remove it. */
|
||||
.highlight .w {
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
/* Custom shader demo cards */
|
||||
.shader-demo-card {
|
||||
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
||||
}
|
||||
|
||||
.shader-demo-card:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
/* Video modal overlay */
|
||||
.shader-modal-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.85);
|
||||
z-index: 10000;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.shader-modal-overlay.active {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
html.shader-modal-open {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.shader-modal-container {
|
||||
position: relative;
|
||||
max-width: 90vw;
|
||||
max-height: 90vh;
|
||||
}
|
||||
|
||||
.shader-modal-close {
|
||||
position: absolute;
|
||||
top: -2rem;
|
||||
right: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: #fff;
|
||||
font-size: 2rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.shader-modal-close:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.shader-modal-video {
|
||||
display: block;
|
||||
max-width: 90vw;
|
||||
max-height: 85vh;
|
||||
border-radius: 4px;
|
||||
}
|
||||
Vendored
+127
@@ -0,0 +1,127 @@
|
||||
/* vim:fileencoding=utf-8
|
||||
*
|
||||
* Copyright (C) 2021 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
*
|
||||
* Distributed under terms of the GPLv3 license
|
||||
*/
|
||||
/*jshint esversion: 6 */
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
function get_sidebar_tree() {
|
||||
return document.querySelector('.sidebar-tree');
|
||||
}
|
||||
|
||||
function scroll_sidebar_node_into_view(a) {
|
||||
var ss = get_sidebar_tree().closest('.sidebar-scroll');
|
||||
if (!ss || !a) return;
|
||||
ss.style.position = 'relative';
|
||||
var pos = 0;
|
||||
while (true) {
|
||||
pos += a.offsetTop;
|
||||
a = a.offsetParent;
|
||||
if (!a || a == ss) break;
|
||||
}
|
||||
ss.scrollTo({top: pos, behavior: 'instant'});
|
||||
}
|
||||
|
||||
function mark_current_link(sidebar_tree, a, onload) {
|
||||
var li = a.closest('li.has-children');
|
||||
while (li) {
|
||||
li.querySelector('input[type=checkbox]').setAttribute('checked', 'checked');
|
||||
li = li.parentNode.closest('li.has-children');
|
||||
}
|
||||
sidebar_tree.querySelectorAll('.current').forEach(function (elem) {
|
||||
elem.classList.remove('current');
|
||||
});
|
||||
if (onload) scroll_sidebar_node_into_view(a);
|
||||
a.classList.add('current');
|
||||
}
|
||||
|
||||
function show_hash_in_sidebar(onload) {
|
||||
const sidebar_tree = get_sidebar_tree();
|
||||
if (document.location.hash.length > 1) {
|
||||
var a = sidebar_tree.querySelector('a[href="' + document.location.hash + '"]');
|
||||
if (a) mark_current_link(sidebar_tree, a, onload);
|
||||
} else {
|
||||
if (onload) scroll_sidebar_node_into_view(sidebar_tree.querySelector('.current-page a'));
|
||||
}
|
||||
}
|
||||
|
||||
function init_sidebar() {
|
||||
const sidebar_tree = document.querySelector('.sidebar-tree');
|
||||
if (!sidebar_tree || sidebar_tree.dataset.inited === 'true') return;
|
||||
sidebar_tree.dataset.inited = 'true';
|
||||
show_hash_in_sidebar(true);
|
||||
window.addEventListener('hashchange', show_hash_in_sidebar.bind(null, false));
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", init_sidebar);
|
||||
init_sidebar();
|
||||
|
||||
function init_shader_modals() {
|
||||
var cards = document.querySelectorAll('.shader-demo-card');
|
||||
if (!cards.length) return;
|
||||
|
||||
var overlay = document.createElement('div');
|
||||
overlay.id = 'shader-video-modal';
|
||||
overlay.className = 'shader-modal-overlay';
|
||||
overlay.innerHTML =
|
||||
'<div class="shader-modal-container">' +
|
||||
'<button class="shader-modal-close" aria-label="Close">×</button>' +
|
||||
'<video class="shader-modal-video" autoplay loop muted playsinline controls></video>' +
|
||||
'</div>';
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
var video = overlay.querySelector('.shader-modal-video');
|
||||
var close_btn = overlay.querySelector('.shader-modal-close');
|
||||
|
||||
var saved_scroll_y = 0;
|
||||
|
||||
function open_modal(video_src) {
|
||||
saved_scroll_y = window.scrollY;
|
||||
video.innerHTML = '<source src="' + video_src + '" type="video/webm">';
|
||||
video.addEventListener('loadedmetadata', function on_meta() {
|
||||
video.style.width = video.videoWidth + 'px';
|
||||
video.removeEventListener('loadedmetadata', on_meta);
|
||||
});
|
||||
video.load();
|
||||
video.play();
|
||||
overlay.classList.add('active');
|
||||
document.documentElement.classList.add('shader-modal-open');
|
||||
}
|
||||
|
||||
function close_modal() {
|
||||
overlay.classList.remove('active');
|
||||
video.pause();
|
||||
video.innerHTML = '';
|
||||
video.style.width = '';
|
||||
document.documentElement.classList.remove('shader-modal-open');
|
||||
window.scrollTo({top: saved_scroll_y, left: 0, behavior: 'instant'});
|
||||
}
|
||||
|
||||
cards.forEach(function(card) {
|
||||
var link = card.querySelector('a.sd-stretched-link');
|
||||
if (!link) return;
|
||||
var href = link.getAttribute('href');
|
||||
if (!href || href.slice(-5) !== '.webm') return;
|
||||
link.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
open_modal(href);
|
||||
});
|
||||
});
|
||||
|
||||
close_btn.addEventListener('click', close_modal);
|
||||
overlay.addEventListener('click', function(e) {
|
||||
if (e.target === overlay) close_modal();
|
||||
});
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') close_modal();
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", init_shader_modals);
|
||||
|
||||
}());
|
||||
|
||||
Vendored
+617
@@ -0,0 +1,617 @@
|
||||
WEBVTT
|
||||
|
||||
1
|
||||
00:00:00.000 --> 00:00:07.240
|
||||
Hello, I am Kovid Goyal, the creator of kitty. In this video, I will give you a brief tour
|
||||
|
||||
2
|
||||
00:00:07.240 --> 00:00:13.640
|
||||
of kitty's productivity enhancing features. kitty started as a personal project to enhance
|
||||
|
||||
3
|
||||
00:00:13.640 --> 00:00:18.520
|
||||
my own terminal experience, but has since grown into something used by thousands of people
|
||||
|
||||
4
|
||||
00:00:18.520 --> 00:00:25.640
|
||||
the world over. kitty is designed for terminal power users, people who, like me, prefer to
|
||||
|
||||
5
|
||||
00:00:25.640 --> 00:00:31.520
|
||||
spend the entire day in the terminal and use the terminal for every task imaginable. kitty has
|
||||
|
||||
6
|
||||
00:00:31.520 --> 00:00:37.800
|
||||
many features and niceties that make this kind of workflow both more productive and more fun.
|
||||
|
||||
7
|
||||
00:00:37.800 --> 00:00:45.440
|
||||
Let's start with something simple. Often, when running commands in the terminal, it so happens
|
||||
|
||||
8
|
||||
00:00:45.440 --> 00:00:51.960
|
||||
that a command produces lots of output and takes a long time to run. You might find yourself
|
||||
|
||||
9
|
||||
00:00:51.960 --> 00:00:58.040
|
||||
wanting to examine that output in more detail. You can, of course, scroll up and just look at the
|
||||
|
||||
10
|
||||
00:00:58.040 --> 00:01:03.880
|
||||
output, but sometimes it's useful to open it in an editor or a pager and say search through it
|
||||
|
||||
11
|
||||
00:01:03.880 --> 00:01:10.360
|
||||
or filter it. kitty has a built-in feature wherein if you press the Control Shift and G key,
|
||||
|
||||
12
|
||||
00:01:10.360 --> 00:01:16.120
|
||||
the output from the last command opens in the pager. As you can see here, the output from the
|
||||
|
||||
13
|
||||
00:01:16.120 --> 00:01:23.480
|
||||
ls command is opened in a pager: less, in my case. This is not limited to just the last command. You
|
||||
|
||||
14
|
||||
00:01:23.480 --> 00:01:29.800
|
||||
can actually scroll up and here you can see a compile output from building kitty to examine the
|
||||
|
||||
15
|
||||
00:01:29.800 --> 00:01:33.880
|
||||
output of any previous command. You hold the Control Shift key and right click on the output
|
||||
|
||||
16
|
||||
00:01:35.160 --> 00:01:41.400
|
||||
and there you go. It opens in the pager as before. I can now search through it or refer to it
|
||||
|
||||
17
|
||||
00:01:41.480 --> 00:01:48.760
|
||||
to my heart's content. You can even use kitty's multiple windows feature to have the pager window
|
||||
|
||||
18
|
||||
00:01:48.760 --> 00:01:56.520
|
||||
pop up as a separate window. You can see here there are now two windows. One has the original shell
|
||||
|
||||
19
|
||||
00:01:57.320 --> 00:02:05.640
|
||||
and one has the output from the clicked command open in a pager. I can scroll through this
|
||||
|
||||
20
|
||||
00:02:05.640 --> 00:02:10.760
|
||||
output and refer to it while typing future commands. I find this facility extremely handy and
|
||||
|
||||
21
|
||||
00:02:10.760 --> 00:02:17.160
|
||||
use it several times every day. Note that this feature is implemented in kitty by means of
|
||||
|
||||
22
|
||||
00:02:17.160 --> 00:02:22.680
|
||||
shell integration. Shell integration means that kitty works with common shells such as bash,
|
||||
|
||||
23
|
||||
00:02:22.680 --> 00:02:29.080
|
||||
Z shell, fish etc. to enable this and other niceties. For example, you will notice that the current
|
||||
|
||||
24
|
||||
00:02:29.080 --> 00:02:34.600
|
||||
working directory is shown in the window title bar. If I change to some other directory,
|
||||
|
||||
25
|
||||
00:02:34.680 --> 00:02:40.760
|
||||
the window title bar changes. Similarly, if I run a command, say for example, sleep,
|
||||
|
||||
26
|
||||
00:02:41.400 --> 00:02:47.160
|
||||
the name of the command shows up in the window title bar while it's running. Once the sleep is over,
|
||||
|
||||
27
|
||||
00:02:47.160 --> 00:02:53.800
|
||||
the title bar goes back to the working directory. This is a small example of some of kitty's
|
||||
|
||||
28
|
||||
00:02:53.800 --> 00:03:01.160
|
||||
productivity features that make working the terminal all day much more fun and productive.
|
||||
|
||||
29
|
||||
00:03:01.480 --> 00:03:08.840
|
||||
Now, let's try something a little more fancy. Consider that most quotidian of terminal
|
||||
|
||||
30
|
||||
00:03:08.840 --> 00:03:13.800
|
||||
experiences listing files. So here we go. Let's list some files.
|
||||
|
||||
31
|
||||
00:03:15.640 --> 00:03:21.080
|
||||
Looks pretty standard so far. A rather colorful list of files and a couple of directories.
|
||||
|
||||
32
|
||||
00:03:21.960 --> 00:03:27.720
|
||||
The fun starts when you click on one of these files. So for example, let's see how kitty is
|
||||
|
||||
33
|
||||
00:03:27.720 --> 00:03:33.480
|
||||
launched. Holding down the control shift keys, I click on it. And as you can see,
|
||||
|
||||
34
|
||||
00:03:34.440 --> 00:03:40.280
|
||||
the launcher.c file has opened up in my editor of choice, which is vim. And I can edit it to do
|
||||
|
||||
35
|
||||
00:03:40.280 --> 00:03:46.520
|
||||
whatever. Simply by clicking on the file. And that's not all. You can even click on an image.
|
||||
|
||||
36
|
||||
00:03:46.520 --> 00:03:56.200
|
||||
For example, let's click on the kitty logo. And there we go. It opens in the terminal. You can view
|
||||
|
||||
37
|
||||
00:03:56.200 --> 00:04:03.160
|
||||
the image. So as you can see, simply clicking on files on the listing, you can open them.
|
||||
|
||||
38
|
||||
00:04:03.800 --> 00:04:09.240
|
||||
And of course, kitty is meant for power users, which means that you don't have to use the mouse.
|
||||
|
||||
39
|
||||
00:04:09.880 --> 00:04:18.200
|
||||
You can instead press control shift P and Y. And it lists all the files with a number
|
||||
|
||||
40
|
||||
00:04:18.200 --> 00:04:23.960
|
||||
next to their names. So for example, if I press six, once again, the kitty logo opens up.
|
||||
|
||||
41
|
||||
00:04:26.680 --> 00:04:34.600
|
||||
These features are powered by two things. The first is the ls command has a
|
||||
|
||||
42
|
||||
00:04:36.120 --> 00:04:39.400
|
||||
facility to output hyperlinks. So let's see
|
||||
|
||||
43
|
||||
00:04:42.920 --> 00:04:50.440
|
||||
here the ls command on my computer. As you can see here, has the --hyperlink=auto flag
|
||||
|
||||
44
|
||||
00:04:50.440 --> 00:04:58.600
|
||||
added to it, this means that every file that ls lists is actually a hyperlink. You can see
|
||||
|
||||
45
|
||||
00:04:58.600 --> 00:05:04.280
|
||||
that it gets underlined when you move the mouse over it. The second thing that makes this possible
|
||||
|
||||
46
|
||||
00:05:05.320 --> 00:05:14.040
|
||||
is a piece of configuration in kitty called open-actions.conf. In this file, you can tell kitty
|
||||
|
||||
47
|
||||
00:05:14.040 --> 00:05:21.800
|
||||
what to do when you open a file, for example, by clicking on it. So here, you can see that this
|
||||
|
||||
48
|
||||
00:05:21.800 --> 00:05:30.840
|
||||
entry on this line tells kitty that for files of MIME type text, open it in the editor in an overlay
|
||||
|
||||
49
|
||||
00:05:30.840 --> 00:05:37.240
|
||||
window, which means a window overlayed on the current window. Similarly, image files are opened
|
||||
|
||||
50
|
||||
00:05:37.320 --> 00:05:48.280
|
||||
in kitty itself using the icat kitten and so on. This entry here is of particular interest. It uses
|
||||
|
||||
51
|
||||
00:05:48.280 --> 00:05:56.600
|
||||
another kitten, which is a small program that's part of kitty, to allow you to directly click on
|
||||
|
||||
52
|
||||
00:05:56.600 --> 00:06:03.720
|
||||
search results from a grep tool and open them in an editor. So let's see that in action.
|
||||
|
||||
53
|
||||
00:06:04.680 --> 00:06:13.240
|
||||
Here we go. Let me run my grep tool, which, and search for say, hyperlink.
|
||||
|
||||
54
|
||||
00:06:15.000 --> 00:06:21.320
|
||||
Here you can see a bunch of results. So moving the mouse over these results, they get underlined,
|
||||
|
||||
55
|
||||
00:06:21.320 --> 00:06:27.800
|
||||
indicating they're clickable. So let's open this one and there you see it has opened in the editor
|
||||
|
||||
56
|
||||
00:06:27.960 --> 00:06:34.600
|
||||
right on the click line. This is extremely convenient for searching through files in the terminal.
|
||||
|
||||
57
|
||||
00:06:35.960 --> 00:06:49.160
|
||||
This in turn is powered by, let's see here what we have and the kitten. Now kittens are small
|
||||
|
||||
58
|
||||
00:06:49.160 --> 00:06:53.880
|
||||
kitty programs that enhance its functionality. So here the kitten is the hyperlinked grep kitten.
|
||||
|
||||
59
|
||||
00:06:54.760 --> 00:07:00.040
|
||||
So what that does is it takes the output from a grep program and adds hyperlinks to it so that
|
||||
|
||||
60
|
||||
00:07:00.600 --> 00:07:07.560
|
||||
they become clickable when displayed in kitty. So as you can see here, these simple features that
|
||||
|
||||
61
|
||||
00:07:07.560 --> 00:07:14.280
|
||||
are designed in a composable and modular way allow you to greatly enhance the experience of
|
||||
|
||||
62
|
||||
00:07:14.280 --> 00:07:23.080
|
||||
using a terminal. Since we have been talking of hyperlinks, let's note that the usefulness
|
||||
|
||||
63
|
||||
00:07:23.080 --> 00:07:29.000
|
||||
is not limited only to the local machine. You can even use them over SSH connections to remote
|
||||
|
||||
64
|
||||
00:07:29.000 --> 00:07:39.880
|
||||
servers. So for example, let me SSH into one of my servers and do an ls --hyperlink=auto.
|
||||
|
||||
65
|
||||
00:07:41.320 --> 00:07:48.200
|
||||
You can see some files have been listed. One of them is an image. Let's click on this image and
|
||||
|
||||
66
|
||||
00:07:48.200 --> 00:07:54.440
|
||||
see what happens. As you can see it opens up in a kitty kitten. This is the remote file kitten
|
||||
|
||||
67
|
||||
00:07:54.440 --> 00:07:59.400
|
||||
and it gives you some options for what you want to do with the image. You can edit it. You can
|
||||
|
||||
68
|
||||
00:07:59.400 --> 00:08:04.520
|
||||
open it. You can save it to your local computer. So let's choose to open it to view the file locally.
|
||||
|
||||
69
|
||||
00:08:10.520 --> 00:08:16.200
|
||||
There we go. The remote file kitten seamlessly downloads the image in the background and opens it
|
||||
|
||||
70
|
||||
00:08:16.200 --> 00:08:24.920
|
||||
locally on the local computer. This is useful if particularly for viewing a complicated file such as
|
||||
|
||||
71
|
||||
00:08:24.920 --> 00:08:33.160
|
||||
images, videos, etc. that the remote server may not be able to handle. But the remote file kitten
|
||||
|
||||
72
|
||||
00:08:33.160 --> 00:08:38.600
|
||||
is not limited simply to opening. You can also edit files. So for example, here we have a simple
|
||||
|
||||
73
|
||||
00:08:39.240 --> 00:08:48.360
|
||||
text file. Let's click on it and once again the remote file kitten opens.
|
||||
|
||||
74
|
||||
00:08:50.120 --> 00:08:53.960
|
||||
It gives you the option to edit the file. So let's choose that option by pressing the E key.
|
||||
|
||||
75
|
||||
00:08:56.360 --> 00:09:02.600
|
||||
You can see that the kitten downloads the file and let's make some changes to it.
|
||||
|
||||
76
|
||||
00:09:03.160 --> 00:09:10.200
|
||||
Notice that this is running in vim on my local machine with all the customization and
|
||||
|
||||
77
|
||||
00:09:12.200 --> 00:09:19.400
|
||||
facilities available. Let me save and quit vim. The remote file kitten automatically
|
||||
|
||||
78
|
||||
00:09:19.400 --> 00:09:26.360
|
||||
updates the file on the server. Let's cat it again. And you see that the file has been edited
|
||||
|
||||
79
|
||||
00:09:27.240 --> 00:09:32.600
|
||||
as expected. This is really useful if you tend to spend a lot of time SSH
|
||||
|
||||
80
|
||||
00:09:32.600 --> 00:09:38.840
|
||||
into servers and you need to edit, make a one off edit using a fancy editor or similar.
|
||||
|
||||
81
|
||||
00:09:40.760 --> 00:09:47.000
|
||||
I should note that as far as it comes to images, you can actually view images directly over
|
||||
|
||||
82
|
||||
00:09:47.000 --> 00:09:53.960
|
||||
SSH connections thanks to yet another kitten, the icat image viewing kitten in kitty. We'll discuss
|
||||
|
||||
83
|
||||
00:09:53.960 --> 00:09:58.840
|
||||
that and some more fancy kittens in the following segment.
|
||||
|
||||
84
|
||||
00:10:01.080 --> 00:10:06.200
|
||||
Now it's time to have some fun with images. I know terminals are text devices but sometimes
|
||||
|
||||
85
|
||||
00:10:06.200 --> 00:10:10.120
|
||||
it's cool to be able to display images and even useful if you're SSH into a remote computer.
|
||||
|
||||
86
|
||||
00:10:10.120 --> 00:10:14.680
|
||||
I need to quickly look at a graph or a report that's available as an image.
|
||||
|
||||
87
|
||||
00:10:15.800 --> 00:10:22.520
|
||||
So without further ado, let's see how we do that. We use the icat kitten which is a
|
||||
|
||||
88
|
||||
00:10:24.120 --> 00:10:29.000
|
||||
small program written that's distributed as part of kitty that can display images within kitty.
|
||||
|
||||
89
|
||||
00:10:30.440 --> 00:10:34.440
|
||||
Here I'll display the kitty logo as you can see shows up as an image in the right there in the
|
||||
|
||||
90
|
||||
00:10:34.440 --> 00:10:41.400
|
||||
terminal itself. The icat kitten can also download images from the internet and display them.
|
||||
|
||||
91
|
||||
00:10:41.400 --> 00:10:47.640
|
||||
Here we'll see it doing that with an animated gif of a Rubik's cube. I have icat
|
||||
|
||||
92
|
||||
00:10:48.120 --> 00:10:50.680
|
||||
aliased as just the icat command on my computer.
|
||||
|
||||
93
|
||||
00:10:53.800 --> 00:10:57.880
|
||||
So here you see it downloaded the Rubik's cube and it's displaying the animation. The animation
|
||||
|
||||
94
|
||||
00:10:57.880 --> 00:11:05.640
|
||||
will continue playing even while you type other commands. The kitty graphics protocol that powers
|
||||
|
||||
95
|
||||
00:11:05.640 --> 00:11:10.920
|
||||
the icat kitten is integrated with many other programs. For example, the Ranger file manager.
|
||||
|
||||
96
|
||||
00:11:11.400 --> 00:11:17.800
|
||||
Here you see we've opened a folder full of images. And as you scroll through the files,
|
||||
|
||||
97
|
||||
00:11:17.800 --> 00:11:23.400
|
||||
Ranger displays thumbnails of the images using the kitty graphics protocol right there in the
|
||||
|
||||
98
|
||||
00:11:23.400 --> 00:11:30.200
|
||||
terminal. Another cool feature of the kitty graphics protocol is that it works over SSH. So if I
|
||||
|
||||
99
|
||||
00:11:30.200 --> 00:11:45.000
|
||||
SSH into one of my servers and run icat Athenaum.jpg, you see that the image is displayed directly
|
||||
|
||||
100
|
||||
00:11:45.000 --> 00:11:51.880
|
||||
in the terminal even though it's on a remote server. The image data is sent over the TTY pipe
|
||||
|
||||
101
|
||||
00:11:52.920 --> 00:11:58.120
|
||||
over SSH. When running locally, the graphics protocol is smart enough to avoid the overhead of
|
||||
|
||||
102
|
||||
00:11:58.120 --> 00:12:06.280
|
||||
doing this and to use the local file system to display images. Another cool kitten that kitty has
|
||||
|
||||
103
|
||||
00:12:06.280 --> 00:12:12.600
|
||||
is the unicode input kitten, which you can use to input arbitrary unicode symbols, emoji, etc.
|
||||
|
||||
104
|
||||
00:12:12.600 --> 00:12:18.440
|
||||
into your terminal. Just press control shift U and then type the name of the symbol you want. So
|
||||
|
||||
105
|
||||
00:12:18.440 --> 00:12:25.720
|
||||
for example, here we have a cat. We can insert a cat face with tears of joy into our terminal
|
||||
|
||||
106
|
||||
00:12:26.440 --> 00:12:33.240
|
||||
and there you have it right there at the prompt. You can search for all sorts of symbols. Here we have
|
||||
|
||||
107
|
||||
00:12:33.240 --> 00:12:43.800
|
||||
some beer. Let's celebrate this great kitten right here. So this is useful. If you find yourself
|
||||
|
||||
108
|
||||
00:12:43.800 --> 00:12:49.160
|
||||
doing a lot of chatting using terminal chat programs such as WeeChat and you want to send your
|
||||
|
||||
109
|
||||
00:12:49.160 --> 00:12:57.240
|
||||
buddies emoji or other other symbols. We have talked a fair bit about kittens and how they can
|
||||
|
||||
110
|
||||
00:12:57.240 --> 00:13:02.520
|
||||
be used to enhance the terminal experience. Now let's discuss something more basic window management.
|
||||
|
||||
111
|
||||
00:13:03.160 --> 00:13:08.360
|
||||
kitty has the ability to tile multiple windows next to each other and manage them using flexible
|
||||
|
||||
112
|
||||
00:13:08.360 --> 00:13:14.120
|
||||
layouts. You can also create multiple tabs. So let's create some windows by pressing control shift
|
||||
|
||||
113
|
||||
00:13:14.120 --> 00:13:19.880
|
||||
enter. You see we have three windows tiled next to each other. We can create some new tabs as well.
|
||||
|
||||
114
|
||||
00:13:20.600 --> 00:13:25.080
|
||||
The tabs are displayed at the bottom. The tab titles show the current working directory
|
||||
|
||||
115
|
||||
00:13:25.720 --> 00:13:32.840
|
||||
or actually whatever title the program running in the shell sets. So let's close these tabs.
|
||||
|
||||
116
|
||||
00:13:32.840 --> 00:13:39.480
|
||||
Get back to the windows. As you can see these windows are tiled next to each other. You can press
|
||||
|
||||
117
|
||||
00:13:39.480 --> 00:13:45.800
|
||||
control shift and the window number to switch to a window. So one for the first two for the second
|
||||
|
||||
118
|
||||
00:13:45.800 --> 00:13:52.520
|
||||
three for the third and so on. You can even visually switch by pressing control shift F7 and simply
|
||||
|
||||
119
|
||||
00:13:52.520 --> 00:14:00.040
|
||||
typing the number of the window you want to switch to. Now while we are discussing multiple windows
|
||||
|
||||
120
|
||||
00:14:00.040 --> 00:14:05.160
|
||||
let's look at a cool feature whereby we can type in one window and have the text appear in all
|
||||
|
||||
121
|
||||
00:14:05.160 --> 00:14:11.800
|
||||
the windows simultaneously. This is useful if you want to do a poor man's automation of multiple
|
||||
|
||||
122
|
||||
00:14:11.800 --> 00:14:18.280
|
||||
servers for example. To do this let's open the kitty shell which we can do by pressing control shift
|
||||
|
||||
123
|
||||
00:14:18.280 --> 00:14:23.800
|
||||
escape. The kitty shell is a shell where you can issue commands to kitty itself to make it do things.
|
||||
|
||||
124
|
||||
00:14:24.840 --> 00:14:31.560
|
||||
So here let's first change the layout to grid which works better with four windows
|
||||
|
||||
125
|
||||
00:14:32.040 --> 00:14:42.520
|
||||
and now to actually broadcast the text we need to launch the broadcast kitten which we can do
|
||||
|
||||
126
|
||||
00:14:42.520 --> 00:14:56.920
|
||||
like this. And we see that we have a broadcast window available at which we can type. Let me type
|
||||
|
||||
127
|
||||
00:14:57.000 --> 00:15:03.080
|
||||
the command ls. You see that ls has been typed in every single window. You can backspace and it works
|
||||
|
||||
128
|
||||
00:15:03.080 --> 00:15:09.080
|
||||
as expected. Let's execute the ls command and we see that the ls has been executed in every window
|
||||
|
||||
129
|
||||
00:15:09.080 --> 00:15:16.360
|
||||
showing different outputs. Let's clear out these outputs and end the broadcast session.
|
||||
|
||||
130
|
||||
00:15:18.280 --> 00:15:23.560
|
||||
So as you can see here the kitty shell is quite a powerful tool.
|
||||
|
||||
131
|
||||
00:15:24.440 --> 00:15:31.000
|
||||
A note that the shell is powered by something called the kitty remote control protocol.
|
||||
|
||||
132
|
||||
00:15:31.000 --> 00:15:36.840
|
||||
This allows you to control kitty from other shells, other terminals, programs running on your
|
||||
|
||||
133
|
||||
00:15:36.840 --> 00:15:42.120
|
||||
computer etc. And this is very powerful. Anything you can do in the shell you can also do
|
||||
|
||||
134
|
||||
00:15:42.120 --> 00:15:48.360
|
||||
via the remote control facility. Let's have a quick look at it. Change the layout to stack so we
|
||||
|
||||
135
|
||||
00:15:48.920 --> 00:15:54.360
|
||||
focused on the shell window. Let's see some commands. So here you can see a list of commands
|
||||
|
||||
136
|
||||
00:15:54.360 --> 00:15:59.400
|
||||
available in the shell. You can do things like create new windows, set window titles, set window
|
||||
|
||||
137
|
||||
00:15:59.400 --> 00:16:08.760
|
||||
logos, send text to windows, set change the opacity, select windows, all sorts of things resize them,
|
||||
|
||||
138
|
||||
00:16:09.800 --> 00:16:15.240
|
||||
send signals to children running in windows etc. You can change the colors, you can run kittens,
|
||||
|
||||
139
|
||||
00:16:16.200 --> 00:16:23.560
|
||||
and on and on and on. So this forms a general scripting ability for kitty and allows you to
|
||||
|
||||
140
|
||||
00:16:23.560 --> 00:16:30.840
|
||||
control kitty and automate various tasks in it. Your imagination is the limit when it comes to
|
||||
|
||||
141
|
||||
00:16:30.840 --> 00:16:38.920
|
||||
use cases. Since this is supposed to be a brief tour I think I'll end here but before I go
|
||||
|
||||
142
|
||||
00:16:39.560 --> 00:16:44.680
|
||||
let's see how to bling-up the kitty terminal a bit by changing its colors. kitty actually has
|
||||
|
||||
143
|
||||
00:16:44.680 --> 00:16:52.440
|
||||
a themes kitten that has a large collection of themes downloaded from a central repository.
|
||||
|
||||
144
|
||||
00:16:52.440 --> 00:16:57.720
|
||||
Let's run it and see what happens. So here you can see there are literally hundreds of themes
|
||||
|
||||
145
|
||||
00:16:59.560 --> 00:17:06.680
|
||||
organized by dark and light colors. You can choose a theme you want. So for example I like
|
||||
|
||||
146
|
||||
00:17:06.680 --> 00:17:15.640
|
||||
Belafonte. So let's change to that by pressing the Enter key and then the M key to tell the kitten
|
||||
|
||||
147
|
||||
00:17:15.640 --> 00:17:21.880
|
||||
to modify kitty.conf to make the change permanent and you see that kitty now uses the Belafonte theme.
|
||||
|
||||
148
|
||||
00:17:22.760 --> 00:17:28.120
|
||||
Note that the kitten can actually be run non interactively as well. So for example if you specify
|
||||
|
||||
149
|
||||
00:17:28.120 --> 00:17:35.000
|
||||
the theme name on the command line it will change the theme directly without running interactively.
|
||||
|
||||
150
|
||||
00:17:35.800 --> 00:17:41.960
|
||||
You can actually choose where all to change the colors either in the current terminal or
|
||||
|
||||
151
|
||||
00:17:41.960 --> 00:17:47.880
|
||||
all running terminals on your system. So as you can see the themes kitten is a nice way to
|
||||
|
||||
152
|
||||
00:17:49.240 --> 00:17:55.080
|
||||
make your terminal experience a little more colorful. I personally use it to adjust the colors
|
||||
|
||||
153
|
||||
00:17:55.080 --> 00:18:03.720
|
||||
to the time of day so that the screen ambient brightness is the best match for my eyes.
|
||||
|
||||
154
|
||||
00:18:03.720 --> 00:18:12.440
|
||||
And I think with that I'll say goodbye and thank you and hope you enjoy using kitty.
|
||||
Vendored
+617
@@ -0,0 +1,617 @@
|
||||
WEBVTT
|
||||
|
||||
1
|
||||
00:00:00.000 --> 00:00:07.240
|
||||
Hola, soy Kovid Goyal, el creador de kitty. En este video, les daré un breve recorrido
|
||||
|
||||
2
|
||||
00:00:07.240 --> 00:00:13.640
|
||||
por las funciones de kitty diseñadas para mejorar la productividad. kitty comenzó como un proyecto personal para mejorar
|
||||
|
||||
3
|
||||
00:00:13.640 --> 00:00:18.520
|
||||
mi propia experiencia en la terminal, pero desde entonces ha crecido hasta ser utilizado por miles de personas
|
||||
|
||||
4
|
||||
00:00:18.520 --> 00:00:25.640
|
||||
en todo el mundo. kitty está diseñado para usuarios avanzados de la terminal, personas que, como yo, prefieren
|
||||
|
||||
5
|
||||
00:00:25.640 --> 00:00:31.520
|
||||
pasar todo el día en la terminal y la usan para cualquier tarea imaginable. kitty tiene
|
||||
|
||||
6
|
||||
00:00:31.520 --> 00:00:37.800
|
||||
muchas características y detalles que hacen que este tipo de flujo de trabajo sea más productivo y divertido.
|
||||
|
||||
7
|
||||
00:00:37.800 --> 00:00:45.440
|
||||
Empecemos con algo simple. A menudo, al ejecutar comandos en la terminal, sucede
|
||||
|
||||
8
|
||||
00:00:45.440 --> 00:00:51.960
|
||||
que un comando produce mucha salida y tarda mucho tiempo en ejecutarse. Es posible que te veas
|
||||
|
||||
9
|
||||
00:00:51.960 --> 00:00:58.040
|
||||
queriendo examinar esa salida con más detalle. Por supuesto, puedes desplazarte hacia arriba y simplemente mirar la
|
||||
|
||||
10
|
||||
00:00:58.040 --> 00:01:03.880
|
||||
salida, pero a veces es útil abrirla en un editor o un paginador y, por ejemplo, buscar en ella
|
||||
|
||||
11
|
||||
00:01:03.880 --> 00:01:10.360
|
||||
o filtrarla. kitty tiene una función integrada en la que si presionas las teclas Control, Mayús y G,
|
||||
|
||||
12
|
||||
00:01:10.360 --> 00:01:16.120
|
||||
la salida del último comando se abre en el paginador. Como puedes ver aquí, la salida del
|
||||
|
||||
13
|
||||
00:01:16.120 --> 00:01:23.480
|
||||
comando ls se abre en un paginador: less, en mi caso. Esto no se limita solo al último comando.
|
||||
|
||||
14
|
||||
00:01:23.480 --> 00:01:29.800
|
||||
De hecho, puedes desplazarte hacia arriba y aquí puedes ver la salida de compilación al construir kitty para examinar la
|
||||
|
||||
15
|
||||
00:01:29.800 --> 00:01:33.880
|
||||
salida de cualquier comando anterior. Mantienes presionadas las teclas Control y Mayús y haces clic derecho en la salida
|
||||
|
||||
16
|
||||
00:01:35.160 --> 00:01:41.400
|
||||
y listo. Se abre en el paginador como antes. Ahora puedo buscar en ella o consultarla
|
||||
|
||||
17
|
||||
00:01:41.480 --> 00:01:48.760
|
||||
tanto como quiera. Incluso puedes usar la función de múltiples ventanas de kitty para que la ventana del paginador
|
||||
|
||||
18
|
||||
00:01:48.760 --> 00:01:56.520
|
||||
aparezca como una ventana separada. Puedes ver aquí que ahora hay dos ventanas. Una tiene la shell original
|
||||
|
||||
19
|
||||
00:01:57.320 --> 00:02:05.640
|
||||
y la otra tiene abierta la salida del comando cliqueado en un paginador. Puedo desplazarme por esta
|
||||
|
||||
20
|
||||
00:02:05.640 --> 00:02:10.760
|
||||
salida y consultarla mientras escribo futuros comandos. Encuentro esta función extremadamente útil y
|
||||
|
||||
21
|
||||
00:02:10.760 --> 00:02:17.160
|
||||
la uso varias veces al día. Ten en cuenta que esta función está implementada en kitty mediante la
|
||||
|
||||
22
|
||||
00:02:17.160 --> 00:02:22.680
|
||||
integración con la shell. La integración con la shell significa que kitty funciona con shells comunes como bash,
|
||||
|
||||
23
|
||||
00:02:22.680 --> 00:02:29.080
|
||||
Z shell, fish, etc. para habilitar esto y otros detalles. Por ejemplo, notarás que el directorio
|
||||
|
||||
24
|
||||
00:02:29.080 --> 00:02:34.600
|
||||
de trabajo actual se muestra en la barra de título de la ventana. Si me cambio a otro directorio,
|
||||
|
||||
25
|
||||
00:02:34.680 --> 00:02:40.760
|
||||
la barra de título de la ventana cambia. De manera similar, si ejecuto un comando, por ejemplo, sleep,
|
||||
|
||||
26
|
||||
00:02:41.400 --> 00:02:47.160
|
||||
el nombre del comando aparece en la barra de título de la ventana mientras se ejecuta. Una vez que termina el sleep,
|
||||
|
||||
27
|
||||
00:02:47.160 --> 00:02:53.800
|
||||
la barra de título vuelve al directorio de trabajo. Este es un pequeño ejemplo de algunas de las características de
|
||||
|
||||
28
|
||||
00:02:53.800 --> 00:03:01.160
|
||||
productividad de kitty que hacen que trabajar todo el día en la terminal sea mucho más divertido y productivo.
|
||||
|
||||
29
|
||||
00:03:01.480 --> 00:03:08.840
|
||||
Ahora, probemos algo un poco más avanzado. Considera la experiencia más cotidiana de la
|
||||
|
||||
30
|
||||
00:03:08.840 --> 00:03:13.800
|
||||
terminal: listar archivos. Así que vamos. Listemos algunos archivos.
|
||||
|
||||
31
|
||||
00:03:15.640 --> 00:03:21.080
|
||||
Parece bastante estándar hasta ahora. Una lista de archivos bastante colorida y un par de directorios.
|
||||
|
||||
32
|
||||
00:03:21.960 --> 00:03:27.720
|
||||
Lo divertido empieza cuando haces clic en uno de estos archivos. Por ejemplo, veamos cómo se ejecuta
|
||||
|
||||
33
|
||||
00:03:27.720 --> 00:03:33.480
|
||||
kitty. Manteniendo presionadas las teclas Control y Mayús, hago clic en él. Y como puedes ver,
|
||||
|
||||
34
|
||||
00:03:34.440 --> 00:03:40.280
|
||||
el archivo launcher.c se ha abierto en mi editor preferido, que es vim. Y puedo editarlo para hacer
|
||||
|
||||
35
|
||||
00:03:40.280 --> 00:03:46.520
|
||||
lo que sea. Simplemente haciendo clic en el archivo. Y eso no es todo. Incluso puedes hacer clic en una imagen.
|
||||
|
||||
36
|
||||
00:03:46.520 --> 00:03:56.200
|
||||
Por ejemplo, hagamos clic en el logo de kitty. Y ahí lo tenemos. Se abre en la terminal. Puedes ver
|
||||
|
||||
37
|
||||
00:03:56.200 --> 00:04:03.160
|
||||
la imagen. Así que, como puedes ver, simplemente haciendo clic en los archivos de la lista, puedes abrirlos.
|
||||
|
||||
38
|
||||
00:04:03.800 --> 00:04:09.240
|
||||
Y, por supuesto, kitty está pensado para usuarios avanzados, lo que significa que no tienes que usar el ratón.
|
||||
|
||||
39
|
||||
00:04:09.880 --> 00:04:18.200
|
||||
En su lugar, puedes presionar Control, Mayús, P e Y. Y lista todos los archivos con un número
|
||||
|
||||
40
|
||||
00:04:18.200 --> 00:04:23.960
|
||||
al lado de sus nombres. Así que, por ejemplo, si presiono seis, una vez más, el logo de kitty se abre.
|
||||
|
||||
41
|
||||
00:04:26.680 --> 00:04:34.600
|
||||
Estas características funcionan gracias a dos cosas. La primera es que el comando ls tiene una
|
||||
|
||||
42
|
||||
00:04:36.120 --> 00:04:39.400
|
||||
función para generar hipervínculos. Así que veamos
|
||||
|
||||
43
|
||||
00:04:42.920 --> 00:04:50.440
|
||||
aquí el comando ls en mi computadora. Como puedes ver aquí, tiene el argumento --hyperlink=auto
|
||||
|
||||
44
|
||||
00:04:50.440 --> 00:04:58.600
|
||||
añadido, esto significa que cada archivo que ls lista es en realidad un hipervínculo. Puedes ver
|
||||
|
||||
45
|
||||
00:04:58.600 --> 00:05:04.280
|
||||
que se subraya cuando pasas el ratón sobre él. La segunda cosa que hace esto posible
|
||||
|
||||
46
|
||||
00:05:05.320 --> 00:05:14.040
|
||||
es un archivo de configuración en kitty llamado open-actions.conf. En este archivo, puedes decirle a kitty
|
||||
|
||||
47
|
||||
00:05:14.040 --> 00:05:21.800
|
||||
qué hacer cuando abres un archivo, por ejemplo, al hacer clic en él. Aquí puedes ver que esta
|
||||
|
||||
48
|
||||
00:05:21.800 --> 00:05:30.840
|
||||
entrada en esta línea le dice a kitty que para archivos de tipo texto, los abra en el editor en una ventana
|
||||
|
||||
49
|
||||
00:05:30.840 --> 00:05:37.240
|
||||
superpuesta (overlay), lo que significa una ventana superpuesta sobre la ventana actual. Del mismo modo, los archivos de imagen se abren
|
||||
|
||||
50
|
||||
00:05:37.320 --> 00:05:48.280
|
||||
en el propio kitty usando el kitten icat, y así sucesivamente. Esta entrada de aquí es de particular interés. Utiliza
|
||||
|
||||
51
|
||||
00:05:48.280 --> 00:05:56.600
|
||||
otro kitten, que es un pequeño programa que forma parte de kitty, para permitirte hacer clic directamente en
|
||||
|
||||
52
|
||||
00:05:56.600 --> 00:06:03.720
|
||||
los resultados de búsqueda de una herramienta grep y abrirlos en un editor. Vamos a ver eso en acción.
|
||||
|
||||
53
|
||||
00:06:04.680 --> 00:06:13.240
|
||||
Aquí vamos. Déjenme ejecutar mi herramienta grep y buscar, por ejemplo, hyperlink.
|
||||
|
||||
54
|
||||
00:06:15.000 --> 00:06:21.320
|
||||
Aquí pueden ver varios resultados. Al pasar el ratón sobre estos resultados, se subrayan,
|
||||
|
||||
55
|
||||
00:06:21.320 --> 00:06:27.800
|
||||
lo que indica que se puede hacer clic en ellos. Así que abramos este y ahí ven que se ha abierto en el editor
|
||||
|
||||
56
|
||||
00:06:27.960 --> 00:06:34.600
|
||||
justo en la línea cliqueada. Esto es extremadamente conveniente para buscar a través de archivos en la terminal.
|
||||
|
||||
57
|
||||
00:06:35.960 --> 00:06:49.160
|
||||
Esto, a su vez, funciona gracias a... veamos qué tenemos aquí y el kitten. Ahora bien, los kittens son pequeños
|
||||
|
||||
58
|
||||
00:06:49.160 --> 00:06:53.880
|
||||
programas de kitty que mejoran su funcionalidad. Aquí el kitten es el hyperlinked grep.
|
||||
|
||||
59
|
||||
00:06:54.760 --> 00:07:00.040
|
||||
Lo que hace es tomar la salida de un programa grep y añadirle hipervínculos para que
|
||||
|
||||
60
|
||||
00:07:00.600 --> 00:07:07.560
|
||||
sean cliqueables cuando se muestran en kitty. Como pueden ver aquí, estas funciones simples que
|
||||
|
||||
61
|
||||
00:07:07.560 --> 00:07:14.280
|
||||
están diseñadas de forma composible y modular te permiten mejorar enormemente la experiencia de
|
||||
|
||||
62
|
||||
00:07:14.280 --> 00:07:23.080
|
||||
usar una terminal. Ya que hemos estado hablando de hipervínculos, cabe destacar que su utilidad
|
||||
|
||||
63
|
||||
00:07:23.080 --> 00:07:29.000
|
||||
no se limita únicamente a la máquina local. Incluso puedes usarlos a través de conexiones SSH a servidores
|
||||
|
||||
64
|
||||
00:07:29.000 --> 00:07:39.880
|
||||
remotos. Por ejemplo, déjenme conectarme por SSH a uno de mis servidores y hacer un ls --hyperlink=auto.
|
||||
|
||||
65
|
||||
00:07:41.320 --> 00:07:48.200
|
||||
Pueden ver que se han listado algunos archivos. Uno de ellos es una imagen. Hagamos clic en esta imagen y
|
||||
|
||||
66
|
||||
00:07:48.200 --> 00:07:54.440
|
||||
veamos qué pasa. Como pueden ver, se abre en un kitten de kitty. Este es el kitten de archivos remotos
|
||||
|
||||
67
|
||||
00:07:54.440 --> 00:07:59.400
|
||||
y te da algunas opciones sobre lo que quieres hacer con la imagen. Puedes editarla, puedes
|
||||
|
||||
68
|
||||
00:07:59.400 --> 00:08:04.520
|
||||
abrirla o puedes guardarla en tu computadora local. Así que elijamos abrirla para ver el archivo localmente.
|
||||
|
||||
69
|
||||
00:08:10.520 --> 00:08:16.200
|
||||
Ahí está. El kitten de archivos remotos descarga fluidamente la imagen en segundo plano y la abre
|
||||
|
||||
70
|
||||
00:08:16.200 --> 00:08:24.920
|
||||
localmente en la computadora. Esto es útil, particularmente para ver un archivo complicado como
|
||||
|
||||
71
|
||||
00:08:24.920 --> 00:08:33.160
|
||||
imágenes, videos, etc., que el servidor remoto quizás no pueda procesar. Pero el kitten de archivos remotos
|
||||
|
||||
72
|
||||
00:08:33.160 --> 00:08:38.600
|
||||
no se limita simplemente a abrir. También puedes editar archivos. Por ejemplo, aquí tenemos un simple
|
||||
|
||||
73
|
||||
00:08:39.240 --> 00:08:48.360
|
||||
archivo de texto. Hagamos clic en él y, una vez más, el kitten de archivos remotos se abre.
|
||||
|
||||
74
|
||||
00:08:50.120 --> 00:08:53.960
|
||||
Te da la opción de editar el archivo. Así que elijamos esa opción presionando la tecla E.
|
||||
|
||||
75
|
||||
00:08:56.360 --> 00:09:02.600
|
||||
Pueden ver que el kitten descarga el archivo y hagámosle algunos cambios.
|
||||
|
||||
76
|
||||
00:09:03.160 --> 00:09:10.200
|
||||
Noten que esto se está ejecutando en vim en mi máquina local con todas las personalizaciones y
|
||||
|
||||
77
|
||||
00:09:12.200 --> 00:09:19.400
|
||||
funciones disponibles. Dejemos guardar y salir de vim. El kitten de archivos remotos actualiza
|
||||
|
||||
78
|
||||
00:09:19.400 --> 00:09:26.360
|
||||
automáticamente el archivo en el servidor. Hagamos cat de nuevo. Y ven que el archivo ha sido editado
|
||||
|
||||
79
|
||||
00:09:27.240 --> 00:09:32.600
|
||||
como se esperaba. Esto es muy útil si sueles pasar mucho tiempo en conexiones SSH
|
||||
|
||||
80
|
||||
00:09:32.600 --> 00:09:38.840
|
||||
en servidores y necesitas editar o hacer una edición puntual usando un editor avanzado o similar.
|
||||
|
||||
81
|
||||
00:09:40.760 --> 00:09:47.000
|
||||
Debo señalar que, en lo que respecta a imágenes, de hecho puedes ver imágenes directamente sobre
|
||||
|
||||
82
|
||||
00:09:47.000 --> 00:09:53.960
|
||||
conexiones SSH gracias a otro kitten, el kitten de visualización de imágenes icat en kitty. Discutiremos
|
||||
|
||||
83
|
||||
00:09:53.960 --> 00:09:58.840
|
||||
eso y algunos otros kittens más avanzados en el siguiente segmento.
|
||||
|
||||
84
|
||||
00:10:01.080 --> 00:10:06.200
|
||||
Ahora es momento de divertirse un poco con imágenes. Sé que las terminales son dispositivos de texto, pero a veces
|
||||
|
||||
85
|
||||
00:10:06.200 --> 00:10:10.120
|
||||
es genial poder mostrar imágenes e incluso útil si estás conectado por SSH a una computadora remota
|
||||
|
||||
86
|
||||
00:10:10.120 --> 00:10:14.680
|
||||
y necesitas mirar rápidamente un gráfico o un informe que está disponible como imagen.
|
||||
|
||||
87
|
||||
00:10:15.800 --> 00:10:22.520
|
||||
Así que sin más preámbulos, veamos cómo hacemos eso. Usamos el kitten icat, que es un
|
||||
|
||||
88
|
||||
00:10:24.120 --> 00:10:29.000
|
||||
pequeño programa escrito que se distribuye como parte de kitty y que puede mostrar imágenes dentro de kitty.
|
||||
|
||||
89
|
||||
00:10:30.440 --> 00:10:34.440
|
||||
Aquí mostraré el logo de kitty; como pueden ver, aparece como una imagen justo ahí en la
|
||||
|
||||
90
|
||||
00:10:34.440 --> 00:10:41.400
|
||||
propia terminal. El kitten icat también puede descargar imágenes de internet y mostrarlas.
|
||||
|
||||
91
|
||||
00:10:41.400 --> 00:10:47.640
|
||||
Aquí lo veremos haciendo eso con un GIF animado de un cubo de Rubik. Tengo icat
|
||||
|
||||
92
|
||||
00:10:48.120 --> 00:10:50.680
|
||||
configurado con un alias como simplemente el comando icat en mi computadora.
|
||||
|
||||
93
|
||||
00:10:53.800 --> 00:10:57.880
|
||||
Aquí ven que descargó el cubo de Rubik y está mostrando la animación. La animación
|
||||
|
||||
94
|
||||
00:10:57.880 --> 00:11:05.640
|
||||
continuará reproduciéndose incluso mientras escribes otros comandos. El protocolo de gráficos de kitty que impulsa
|
||||
|
||||
95
|
||||
00:11:05.640 --> 00:11:10.920
|
||||
al kitten icat está integrado con muchos otros programas. Por ejemplo, el administrador de archivos Ranger.
|
||||
|
||||
96
|
||||
00:11:11.400 --> 00:11:17.800
|
||||
Aquí ven que hemos abierto una carpeta llena de imágenes. Y a medida que te desplazas por los archivos,
|
||||
|
||||
97
|
||||
00:11:17.800 --> 00:11:23.400
|
||||
Ranger muestra miniaturas de las imágenes usando el protocolo de gráficos de kitty ahí mismo en la
|
||||
|
||||
98
|
||||
00:11:23.400 --> 00:11:30.200
|
||||
terminal. Otra función genial del protocolo de gráficos de kitty es que funciona sobre SSH. Así que si me
|
||||
|
||||
99
|
||||
00:11:30.200 --> 00:11:45.000
|
||||
conecto por SSH a uno de mis servidores y ejecuto icat Athenaum.jpg, ven que la imagen se muestra directamente
|
||||
|
||||
100
|
||||
00:11:45.000 --> 00:11:51.880
|
||||
en la terminal aunque esté en un servidor remoto. Los datos de la imagen se envían a través de la canalización TTY
|
||||
|
||||
101
|
||||
00:11:52.920 --> 00:11:58.120
|
||||
sobre SSH. Al ejecutarse localmente, el protocolo de gráficos es lo suficientemente inteligente como para evitar la sobrecarga de
|
||||
|
||||
102
|
||||
00:11:58.120 --> 00:12:06.280
|
||||
hacer esto y usar el sistema de archivos local para mostrar las imágenes. Otro kitten genial que tiene kitty
|
||||
|
||||
103
|
||||
00:12:06.280 --> 00:12:12.600
|
||||
es el kitten de entrada Unicode, que puedes usar para ingresar símbolos Unicode arbitrarios, emojis, etc.
|
||||
|
||||
104
|
||||
00:12:12.600 --> 00:12:18.440
|
||||
en tu terminal. Solo presiona Control, Mayús y U, y luego escribe el nombre del símbolo que deseas. Así que,
|
||||
|
||||
105
|
||||
00:12:18.440 --> 00:12:25.720
|
||||
por ejemplo, aquí tenemos un gato. Podemos insertar una cara de gato con lágrimas de alegría en nuestra terminal,
|
||||
|
||||
106
|
||||
00:12:26.440 --> 00:12:33.240
|
||||
y ahí lo tienen justo en la línea de comandos. Puedes buscar todo tipo de símbolos. Aquí tenemos
|
||||
|
||||
107
|
||||
00:12:33.240 --> 00:12:43.800
|
||||
algo de cerveza. Celebremos este gran kitten justo aquí. Esto es útil si te encuentras
|
||||
|
||||
108
|
||||
00:12:43.800 --> 00:12:49.160
|
||||
chateando mucho usando programas de chat de terminal como WeeChat y quieres enviar a tus
|
||||
|
||||
109
|
||||
00:12:49.160 --> 00:12:57.240
|
||||
amigos emojis u otros símbolos. Hemos hablado bastante sobre los kittens y cómo se pueden
|
||||
|
||||
110
|
||||
00:12:57.240 --> 00:13:02.520
|
||||
usar para mejorar la experiencia de la terminal. Ahora hablemos de algo más básico: la gestión de ventanas.
|
||||
|
||||
111
|
||||
00:13:03.160 --> 00:13:08.360
|
||||
kitty tiene la capacidad de organizar varias ventanas en mosaico, una al lado de la otra, y gestionarlas usando diseños flexibles.
|
||||
|
||||
112
|
||||
00:13:08.360 --> 00:13:14.120
|
||||
También puedes crear múltiples pestañas. Vamos a crear algunas ventanas presionando Control, Mayús y Enter.
|
||||
|
||||
113
|
||||
00:13:14.120 --> 00:13:19.880
|
||||
Ven que tenemos tres ventanas organizadas una al lado de la otra. También podemos crear algunas pestañas nuevas.
|
||||
|
||||
114
|
||||
00:13:20.600 --> 00:13:25.080
|
||||
Las pestañas se muestran en la parte inferior. Los títulos de las pestañas muestran el directorio de trabajo actual,
|
||||
|
||||
115
|
||||
00:13:25.720 --> 00:13:32.840
|
||||
o en realidad cualquier título que establezca el programa ejecutado en la shell. Así que cerremos estas pestañas.
|
||||
|
||||
116
|
||||
00:13:32.840 --> 00:13:39.480
|
||||
Volvamos a las ventanas. Como pueden ver, estas ventanas están dispuestas una al lado de la otra. Puedes presionar
|
||||
|
||||
117
|
||||
00:13:39.480 --> 00:13:45.800
|
||||
Control, Mayús y el número de ventana para cambiar a una ventana. Uno para la primera, dos para la segunda,
|
||||
|
||||
118
|
||||
00:13:45.800 --> 00:13:52.520
|
||||
tres para la tercera, y así sucesivamente. Incluso puedes cambiar visualmente presionando Control, Mayús, F7 y simplemente
|
||||
|
||||
119
|
||||
00:13:52.520 --> 00:14:00.040
|
||||
escribiendo el número de la ventana a la que deseas cambiar. Ahora, mientras discutimos sobre ventanas múltiples,
|
||||
|
||||
120
|
||||
00:14:00.040 --> 00:14:05.160
|
||||
veamos una función genial mediante la cual podemos escribir en una ventana y hacer que el texto aparezca en todas
|
||||
|
||||
121
|
||||
00:14:05.160 --> 00:14:11.800
|
||||
las ventanas simultáneamente. Esto es útil si quieres hacer una automatización básica o casera de múltiples
|
||||
|
||||
122
|
||||
00:14:11.800 --> 00:14:18.280
|
||||
servidores, por ejemplo. Para hacer esto, abramos la shell de kitty, lo cual podemos hacer presionando Control, Mayús y Escape.
|
||||
|
||||
123
|
||||
00:14:18.280 --> 00:14:23.800
|
||||
La shell de kitty es una consola donde puedes emitir comandos a la propia kitty para hacer que ejecute cosas.
|
||||
|
||||
124
|
||||
00:14:24.840 --> 00:14:31.560
|
||||
Aquí, primero cambiemos el diseño a cuadrícula (grid), que funciona mejor con cuatro ventanas,
|
||||
|
||||
125
|
||||
00:14:32.040 --> 00:14:42.520
|
||||
y ahora, para transmitir realmente el texto, necesitamos lanzar el kitten de transmisión (broadcast), lo cual podemos hacer así.
|
||||
|
||||
126
|
||||
00:14:42.520 --> 00:14:56.920
|
||||
Y vemos que tenemos una ventana de transmisión disponible en la que podemos escribir. Déjenme escribir
|
||||
|
||||
127
|
||||
00:14:57.000 --> 00:15:03.080
|
||||
el comando ls. Ven que ls se ha escrito en cada una de las ventanas. Puedes borrar y funciona
|
||||
|
||||
128
|
||||
00:15:03.080 --> 00:15:09.080
|
||||
como se espera. Ejecutemos el comando ls y vemos que ls se ha ejecutado en cada ventana
|
||||
|
||||
129
|
||||
00:15:09.080 --> 00:15:16.360
|
||||
mostrando diferentes salidas. Limpiemos estas salidas y terminemos la sesión de transmisión.
|
||||
|
||||
130
|
||||
00:15:18.280 --> 00:15:23.560
|
||||
Como pueden ver aquí, la shell de kitty es una herramienta bastante potente.
|
||||
|
||||
131
|
||||
00:15:24.440 --> 00:15:31.000
|
||||
Tengan en cuenta que la shell funciona mediante algo llamado protocolo de control remoto de kitty.
|
||||
|
||||
132
|
||||
00:15:31.000 --> 00:15:36.840
|
||||
Esto te permite controlar kitty desde otras shells, otras terminales, programas que se ejecutan en tu
|
||||
|
||||
133
|
||||
00:15:36.840 --> 00:15:42.120
|
||||
computadora, etc. Y esto es muy potente. Cualquier cosa que puedas hacer en la shell también la puedes hacer
|
||||
|
||||
134
|
||||
00:15:42.120 --> 00:15:48.360
|
||||
a través de la función de control remoto. Echémosle un vistazo rápido. Cambiemos el diseño a apilado (stack) para
|
||||
|
||||
135
|
||||
00:15:48.920 --> 00:15:54.360
|
||||
enfocarnos en la ventana de la shell. Veamos algunos comandos. Aquí pueden ver una lista de comandos
|
||||
|
||||
136
|
||||
00:15:54.360 --> 00:15:59.400
|
||||
disponibles en la shell. Puedes hacer cosas como crear nuevas ventanas, establecer títulos de ventana, establecer
|
||||
|
||||
137
|
||||
00:15:59.400 --> 00:16:08.760
|
||||
logos de ventana, enviar texto a ventanas, cambiar la opacidad, seleccionar ventanas, todo tipo de cosas, redimensionarlas,
|
||||
|
||||
138
|
||||
00:16:09.800 --> 00:16:15.240
|
||||
enviar señales a procesos hijos que se ejecutan en ventanas, etc. Puedes cambiar los colores, puedes ejecutar kittens,
|
||||
|
||||
139
|
||||
00:16:16.200 --> 00:16:23.560
|
||||
y mucho, mucho más. Así que esto forma una capacidad de scripting general para kitty y te permite
|
||||
|
||||
140
|
||||
00:16:23.560 --> 00:16:30.840
|
||||
controlar kitty y automatizar varias tareas en ella. Tu imaginación es el límite cuando se trata de
|
||||
|
||||
141
|
||||
00:16:30.840 --> 00:16:38.920
|
||||
casos de uso. Dado que se supone que este es un recorrido breve, creo que terminaré aquí, pero antes de irme,
|
||||
|
||||
142
|
||||
00:16:39.560 --> 00:16:44.680
|
||||
veamos cómo darle un toque de estilo a la terminal kitty cambiando sus colores. De hecho, kitty tiene
|
||||
|
||||
143
|
||||
00:16:44.680 --> 00:16:52.440
|
||||
un kitten de temas que tiene una gran colección de temas descargados de un repositorio central.
|
||||
|
||||
144
|
||||
00:16:52.440 --> 00:16:57.720
|
||||
Ejecutémoslo y veamos qué pasa. Aquí pueden ver que hay literalmente cientos de temas
|
||||
|
||||
145
|
||||
00:16:59.560 --> 00:17:06.680
|
||||
organizados por colores oscuros y claros. Puedes elegir el tema que quieras. Por ejemplo, a mí me gusta
|
||||
|
||||
146
|
||||
00:17:06.680 --> 00:17:15.640
|
||||
Belafonte. Así que cambiemos a ese presionando la tecla Enter y luego la tecla M para decirle al kitten
|
||||
|
||||
147
|
||||
00:17:15.640 --> 00:17:21.880
|
||||
que modifique kitty.conf para hacer el cambio permanente, y ven que kitty ahora usa el tema Belafonte.
|
||||
|
||||
148
|
||||
00:17:22.760 --> 00:17:28.120
|
||||
Noten que el kitten también se puede ejecutar de forma no interactiva. Por ejemplo, si especificas
|
||||
|
||||
149
|
||||
00:17:28.120 --> 00:17:35.000
|
||||
el nombre del tema en la línea de comandos, cambiará el tema directamente sin ejecutarse de forma interactiva.
|
||||
|
||||
150
|
||||
00:17:35.800 --> 00:17:41.960
|
||||
En realidad, puedes elegir en dónde cambiar los colores, ya sea en la terminal actual o
|
||||
|
||||
151
|
||||
00:17:41.960 --> 00:17:47.880
|
||||
en todas las terminales en ejecución en tu sistema. Así que, como pueden ver, el kitten de temas es una buena manera de
|
||||
|
||||
152
|
||||
00:17:49.240 --> 00:17:55.080
|
||||
hacer que tu experiencia en la terminal sea un poco más colorida. Personalmente lo uso para ajustar los colores
|
||||
|
||||
153
|
||||
00:17:55.080 --> 00:18:03.720
|
||||
según la hora del día, para que el brillo ambiental de la pantalla se adapte lo mejor posible a mis ojos.
|
||||
|
||||
154
|
||||
00:18:03.720 --> 00:18:12.440
|
||||
Y creo que con eso me despediré. Gracias y espero que disfruten usando kitty.
|
||||
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
.video-with-timestamps dl {
|
||||
display: grid;
|
||||
grid-template-columns: max-content auto;
|
||||
}
|
||||
|
||||
.video-with-timestamps dt {
|
||||
grid-column-start: 1;
|
||||
}
|
||||
|
||||
.video-with-timestamps dd {
|
||||
grid-column-start: 2;
|
||||
margin-left: 1em;
|
||||
}
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
/*jshint esversion: 6 */
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
function init_timestamps() {
|
||||
document.querySelectorAll('.video-with-timestamps').forEach(loc => {
|
||||
if (loc.dataset.inited === 'true') return;
|
||||
loc.dataset.inited = 'true';
|
||||
const container_id = loc.id;
|
||||
const dl = loc.querySelector('dl');
|
||||
dl.querySelectorAll('dt').forEach(dt => {
|
||||
dt.innerHTML = '<a href="javascript:void(0)" style="text-decoration: none"><time>' + dt.innerHTML + '</time></a>';
|
||||
dt.style.display = 'inline';
|
||||
});
|
||||
dl.addEventListener('click', handle_timestamp_click.bind(null, container_id));
|
||||
});
|
||||
}
|
||||
|
||||
function handle_timestamp_click(container_id, e) {
|
||||
if (e.target.tagName.toUpperCase() === 'TIME') {
|
||||
const timestamp = e.target.textContent;
|
||||
if (timestamp) {
|
||||
const [minutes, seconds] = timestamp.split(':');
|
||||
const total_seconds = parseInt(minutes) * 60 + parseInt(seconds);
|
||||
const video = document.querySelector('#' + container_id + ' video');
|
||||
video.currentTime = total_seconds;
|
||||
video.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init_timestamps();
|
||||
document.addEventListener('DOMContentloaded', init_timestamps);
|
||||
})();
|
||||
Reference in new issue
Block a user