Closed kovidgoyal closed 2 years ago
This is great news!
I built kitty and ran. I found that when I launch it from the default terminal, mouse positioning doesn't work, but when I launch it from DomTerm, it does. It seems it needs the scripts DomTerm sources to make the cursor posiioning work (at least in my bash setup).
For copy paste with the mouse, I understand this is how to do it: https://sw.kovidgoyal.net/kitty/overview/#mouse-features "Selecting text automatically copies it to the primary clipboard (on platforms with a primary clipboard).
You can middle click to paste from the primary clipboard (on platforms with a primary clipboard)." Is there something I need to set to turn the above on, because it doesn't seem to work for me?
It appears kitty attempts to write to .bashrc every time it opens. I suggest documenting the shell integration lines needed and letting users decide if they want to add them to their .bashrc or not.
Thanks for providing this integration. I did some minor testing and the open last output in less
is great, I just wish we could copy things without the mouse in less, but I am assuming we can change the pager to something else, like we currently have for the scrollback.
Some other feedback, all done based on fc528941
macos build with /usr/local/bin/python3.9 setup.py
and running ./kitty/launcher/kitty --config NONE
ctrl+shift+x
is not working for me, I tested on zsh and bash, ctrl+shit+z
is fine.I am not sure what I should do to test this, in this case, I just increased the font size a few times.
On Thu, Aug 19, 2021 at 06:38:23AM -0700, Fladson Gomes wrote:
Thanks for providing this integration. I did some minor testing and the
open last output in less
is great, I just wish we could copy things without the mouse in less, but I am assuming we can change the pager to something else, like we currently have for the scrollback.
It will use whatever you have set as pager in https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.scrollback_pager
Some other feedback, all done based on
fc528941
macos build with/usr/local/bin/python3.9 setup.py
and running./kitty/launcher/kitty --config NONE
ctrl+shift+x
is not working for me, I tested on zsh and bash,ctrl+shit+z
is fine.
You mean if you press ctrl+shift+z to go back a couple of prompts and then ctrl+shift+x to go forwards, it doesnt work? That works for me on my macOS machine.
- the prompt re-drawing is still not working for powerlevel10k
I am not sure what I should do to test this, in this case, I just increased the font size a few times.
Well, this will require input from the powerlevel10k developer. What I have done is to ensure that the y position of the cursor does not change with respect to the first line of the prompt due to reflow. So when redrawing a prompt, there is no longer a race condition and all the shell has to do is move the cursor up the same number of lines, then move it to the zero column, erase to the bottom of the screen and then redraw the prompt. This process should be pretty robust.
- "Click with the mouse anywhere in the current command to move the cursor there" is not working for me
Also works for me. What is it exactly that is not working? Steps I tried:
1) Type: some test words at the prompt 2) click on the "o" in some, the cursor moved there
I can confirm that all integration functions works fine under fish shell and zsh on macOS.
Click with the mouse anywhere in the current command to move the cursor there
If clicking the mouse fails to move the cursor, please note the new mouse_map default configuration.
mouse_map left click ungrabbed mouse_handle_click selection link prompt
However, although it functions properly, I notice that the latency is high, taking several hundred milliseconds from mouse click to cursor position update. May I ask if this is normal?
Also, with the fish shell, when creating the second tab, the bell icon appears in the first tab, which is annoying.
This does not appear under zsh, and returns to normal after turning off prompt integration with fish shell. (shell_integration no-prompt-mark
)
On Thu, Aug 19, 2021 at 06:38:18PM -0700, page-down wrote:
I can confirm that all integration functions works fine under fish shell and zsh on macOS.
Click with the mouse anywhere in the current command to move the cursor there
If clicking the mouse fails to move the cursor, please note the new mouse_map default configuration.
mouse_map left click ungrabbed mouse_handle_click selection link prompt
However, although it functions properly, I notice that the latency is high, taking several hundred milliseconds from mouse click to cursor position update. May I ask if this is normal?
Yes, tuneable by: https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.click_interval
Also, with the fish shell, when creating the second tab, the bell icon appears in the first tab, which is annoying.
This does not appear under zsh, and returns to normal after turning off prompt integration with fish shell. (
shell_integration no-prompt-mark
)
Doesn't happen for me, can you post a minimal fish config to recreate?
I built a fresh kitty, and I got the BEGIN_KITTY_SHELL_INTEGRATION
block in my .bashrc
as expected.
.bashrc
so it wouldn't try to set the terminal title, and it does not show the current directory: now a new terminal's title is always just bash
, and then after I execute a command it stays saying the previous command.
The titles do update as expected, but sometimes they show the wrong command. The message about HISTCONTROL
wasn't visible anywhere until I ran kitty from a terminal.
Doing tput reset; do-something-slow
leaves the title as bash
until do-something-slow
finishes. (but C+S+g obviates the need for the reset; I just need to update my muscle memory)all the above on Ubuntu 20.04.
post a minimal bashrc and bash version, so I can debug. All of the above work fine in bash for me, with bash 5.1.8
bash says it is version 5.0.17(1)-release (x86_64-pc-linux-gnu)
.
I started kitty like so: env - PATH=$PATH HOME=$HOME DISPLAY=$DISPLAY kitty --config NONE bash --norc
With this, the terminal title was set to bash
, as expected. I then sourced kitty.bash
and the terminal title became the current working directory, and my cursor became a bar (should it always be a bar?).
The cursor moves with clicks, and the terminal title behaviour seems reasonable. I'll work on getting a minimal reproducing bashrc tomorrow (need to sleep now). Looking at the PS1 you get in this, I think my PROMPT_COMMAND setting PS1 is what's breaking at least the title thing. Dunno about the cursor movement / change.
C+S+z/x still do nothing.
... the bell icon appears in the first tab ...
Doesn't happen for me, can you post a minimal fish config to recreate?
Never mind, this is a personal configuration issue.
However, I have found a minor problem. When running kitty for the first time, the configuration folder does not yet exist because the fish shell has never been run, so an error will be raised.
$ mv ~/.config/fish /tmp/
$ kitty --config=NONE -o shell=/usr/local/bin/fish
Traceback (most recent call last):
...
FileNotFoundError: [Errno 2] No such file or directory: '/Users/me/.config/fish/completions/tmpkxmlt3px.tmp'
For configuration file modifications, I personally suggest that it should be explicitly confirmed by the user for the first time and show the file path and the content to be inserted (or symlink).
(Just prompt like the quit confirmation. )
Since my configuration has its own structure, I don't want to be silently modified every time I start kitty with kitty --config=NONE
.
File that already existed: ~/.config/fish/conf.d/kitty.fish
(regular file) , were replaced with symlink, resulting in file loss.
I can confirm that everything listed works fine under macOS.
version:
On Thu, Aug 19, 2021 at 08:08:40PM -0700, John Lenton wrote:
bash says it is
version 5.0.17(1)-release (x86_64-pc-linux-gnu)
.I started kitty like so:
env - PATH=$PATH HOME=$HOME DISPLAY=$DISPLAY kitty --config NONE bash --norc
With this, the terminal title was set to
bash
, as expected. I then sourcedkitty.bash
and the terminal title became the current working directory, and my cursor became a bar (should it always be a bar?).
Yes, unless you are in "non-insert" mode, though support for that is only in zsh not bash.
The cursor moves with clicks, and the terminal title behaviour seems reasonable. I'll work on getting a minimal reproducing bashrc tomorrow (need to sleep now). Looking at the PS1 you get in this, I think my PROMPT_COMMAND setting PS1 is what's breaking at least the title thing. Dunno about the cursor movement / change. C+S+z/x still do nothing.
Sadly bash doesnt have very good hooks for this, so everything has to go into PS0/PS1 which is fragile.
On Thu, Aug 19, 2021 at 08:18:38PM -0700, page-down wrote:
... the bell icon appears in the first tab ...
Doesn't happen for me, can you post a minimal fish config to recreate?
Never mind, this is a personal configuration issue.
However, I have found a minor problem. When running kitty for the first time, the configuration folder does not yet exist because the fish shell has never been run, so an error will be raised.
$ mv ~/.config/fish /tmp/ $ kitty --config=NONE -o shell=/usr/local/bin/fish Traceback (most recent call last): ... FileNotFoundError: [Errno 2] No such file or directory: '/Users/me/.config/fish/completions/tmpkxmlt3px.tmp'
This is now fixed.
For configuration file modifications, I personally suggest that it should be explicitly confirmed by the user for the first time and show the file path and the content to be inserted (or symlink).
(Just prompt like the quit confirmation. )
Since my configuration has its own structure, I don't want to be silently modified every time I start kitty with
kitty --config=NONE
.
You can use
kitty --config=NONE -o shell_integration=enabled\ no-rc
And a first time check is not going to change this, since that check will happen only once, not every time you run kitty.
File that already existed:
~/.config/fish/conf.d/kitty.fish
(regular file) , were replaced with symlink, resulting in file loss.
Yes that is unfortunate, but I dont see a good way to fix this. I suppose I could check if the file is a regular file and if so rename it before creating the symlink.
OK, I sat own and went through the shell integration script, and pulled the necessary bits into my .bashrc
.
Everything works, except the C+S+x/C+S+z combos.
Just to be sure I'm not misunderstanding: C+S+h to open the scrollback, and within it C+S+z/C+S+x should move me between prompts, right? I also tried outside of the C+S+h scrollback pager in case I was misunderstanding but that didn't work either.
On Fri, Aug 20, 2021 at 01:41:37AM -0700, John Lenton wrote:
OK, I sat own and went through the shell integration script, and pulled the necessary bits into my
.bashrc
. Everything works, except the C+S+x/C+S+z combos. Just to be sure I'm not misunderstanding: C+S+h to open the scrollback, and within it C+S+z/C+S+x should move me between prompts, right? I also tried outside of the C+S+h scrollback pager in case I was misunderstanding but that didn't work either.
No the shortcuts work in normal kitty view, not in the scrollback pager.
Click on prompt command to move the cursor is very useful. Thank you very much.
Is it possible to delete the selected text?
I currently use the following custom kitten to delete, although it's not perfect. I need to click first, then go forward and select the text to be deleted, then execute it.
from typing import List
from kitty.boss import Boss
from kittens.tui.handler import result_handler
def main(args):
pass
@result_handler(type_of_input='selection', no_ui=True)
def handle_result(args: List[str], text: str, target_window_id: int, boss: Boss) -> None:
w = boss.window_id_map.get(target_window_id)
if w is not None and w.screen.cursor_at_prompt():
lines = w.screen.text_for_selection()
n = len(text or (lines and len(lines) == 1 and lines[0]))
if n > 0:
w.send_text('normal', '\x7f' * n) # Backspace * n
Why does the second parameter return None
even though the selection is already there? (with @result_handler(type_of_input='selection')
)
How to output debug log when no_ui
is True?
On Fri, Aug 20, 2021 at 06:49:01AM -0700, page-down wrote:
Click on prompt command to move the cursor is very useful. Thank you very much.
You are welcome.
Is it possible to delete the selected text?
No, doing that robustly is not really possible, since the selection could include the prompt, for instance.
I currently use the following custom kitten to delete, although it's not perfect. I need to click first, then go forward and select the text to be deleted, then execute it.
from typing import List from kitty.boss import Boss from kittens.tui.handler import result_handler def main(args): pass @result_handler(type_of_input='selection', no_ui=True) def handle_result(args: List[str], text: str, target_window_id: int, boss: Boss) -> None: w = boss.window_id_map.get(target_window_id) if w is not None and w.screen.cursor_at_prompt(): lines = w.screen.text_for_selection() n = len(text or (lines and len(lines) == 1 and lines[0])) if n > 0: w.send_text('normal', '\x7f' * n) # Backspace * n
Why does the second parameter return
None
even though the selection is already there? (with @.***_handler(type_of_input='selection')`)
The input is passed to main().
How to output debug log when
no_ui
is True?
https://sw.kovidgoyal.net/kitty/kittens/custom/#debugging-kittens
- When using confirm on quit windows that contain a shell sitting at the prompt doing nothing are ignored
In my own opinion, the purpose of confirm_os_window_close
is to protect the current working environment from being accidentally closed (lost). And the current changes have taken away its core capabilities.
A tab that doesn't execute any programs, a tab or OS window that has been laid out and has multiple paths open, still has its own value. Just like any other tab-enabled browser or editor software, it doesn't do anything, but it's there when you need it.
I would like to use the shell integration features while retaining the ability to prevent OS windows or tabs with multiple window from closing accidentally. Maybe make this new feature as a new auto
mode, but still keep the previous mode configurable. Thanks.
There are no changes to confirm_on_quit, you have to use negative values to trigger ignoring of windows sitting at prompts.
Sorry, I just saw the latest changes. The above feedback is for code that is a few dozen hours old.
Confirm that the positive integer value reverts to its original behavior.
No worries, I like to avoid making backwards incompatible changes as much as possible. Thus the use of negative numbers, see #3960 for discussion.
It looks like this might be clobbering $status
inside prompts on fish
. Impact should be relatively low because most fish prompts use $pipestatus
, which survives; I only noticed it because I randomly popped starship off my backlog a few days ago and happened to be running a very recent kitty when I tried it.
Versions of stuff:
saul@enki ~> kitty --version
kitty 0.23.1 created by Kovid Goyal
saul@enki ~> starship --version
starship 0.56.0
branch:
commit_hash:
build_time:2021-08-23 01:48:13 -07:00
build_env:rustc 1.53.0 (53cb7b09b 2021-06-17),stable-x86_64-unknown-linux-gnu (default)
I observe correct behavior when I preserve $status
by saving it at the start of kitty's injected fish_prompt
and restoring it right before invoking _ksi_original_fish_prompt
. Turning off shell integrations also fixes it.
There should be no problem with saving and restoring it. Since you already have the code, post a patch or a PR and I will merge.
I went ahead and implemented it: https://github.com/kovidgoyal/kitty/commit/72e15d8b4f4dae528681e8edcb59a79fbdabd018
havent tested it with starship but I verified that the value of $status is preserved before clling _ksi_original_fish_prompt
Can confirm fix, just pulled new kitty and tested with starship. Sorry I didn't get a patch in; I'd been using funced
to mess with the prompt functions live so didn't actually have one ready to go, lol. Thanks for the quick fix! :+1:
github.com/kovidgoyal/kitty [git master][$⇡][py v2.7.18]
➜ /bin/false
github.com/kovidgoyal/kitty [git master][$⇡][py v2.7.18]
✗ /bin/true
github.com/kovidgoyal/kitty [git master][$⇡][py v2.7.18]
➜
Would it be reasonable to ask that, when shell integration is enabled, get-text --extent
take a new value of (say) last-command
that gets the text you'd get with ctrl+shift+g?
On Wed, Sep 01, 2021 at 03:42:40PM -0700, John Lenton wrote:
Would it be reasonable to ask that, when shell integration is enabled,
get-text --extent
take a new value of (say)last-command
that gets the text you'd get with ctrl+shift+g?
Sure committed to master
Works brilliantly, thank you!
For the record, in case it helps anybody else: in my bash setup I (ab)use PROMPT_COMMAND for a number of things, e.g. getting info from git and virtualenv onto my prompt. I also use HISTIGNORE to ignore things I don't want in my history. These two things together means that the 'set the terminal title' aspect of shell integration as provided doesn't work. Instead what I've done is done the setup manually (as documented), and for the title integration I have, at the end of my .bashrc
,
case "$TERM" in
xterm*|rxvt*|vte*|gnome*)
trap '[ "${__SKIP:-}" -o "$BASH_COMMAND" = "__SKIP=1" ] || printf "\e]0;%s\a" "$BASH_COMMAND"' DEBUG
;;
esac
where __SKIP
is a variable I set at the beginning of my PROMPT_COMMAND and clear it at the end.
In researching this I found people saying to set -o functrace
so you also got the title set when using shell functions, but in my experience this breaks tab completion to a significant degree so I don't do that.
I have created new nightly kitty builds. These can be used for easier testing of this feature. Details of how to install are in the first post.
I've taken a look and noticed the completion for fish was put into the home folder, and not the vendor folder. This by design?
Otherwise, nice job! 🥳
Ref.: https://fishshell.com/docs/current/completions.html#where-to-put-completions
On Mon, Sep 20, 2021 at 12:11:13AM -0700, Birger J. Nordølum wrote:
I've taken a look and noticed the completion for fish was put into the home folder, and not the vendor folder. This by design?
Otherwise, nice job! 🥳
Ref.: https://fishshell.com/docs/current/completions.html#where-to-put-completions
kitty doesn't have permission to write to /usr/share. Packagers of kitty are free to place the completion scripts wherever they like in system kitty packages. See the shell-integration section in docs/build.rst for details.
I just took a look at all of these new features and they seem great! I especially like the confirm_on_quit changes.
I did notice that the "click to position cursor" feature is quite slow for me, it freezes for upwards of a second (using fish).
Is there a plan to implement these changes for layered shells? For instance: if I run $ bash
in my fish shell, none of these features seem to work, although it is probably a very slim use case.
On Sat, Sep 25, 2021 at 09:58:30AM -0700, Cole Wilson wrote:
I just took a look at all of these new features and they seem great! I especially like the confirm_on_quit changes.
I did notice that the "click to position cursor" feature is quite slow for me, it freezes for upwards of a second (using fish).
https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.click_interval
Is there a plan to implement these changes for layered shells? For instance: if I run
$ bash
in my fish shell, none of these features seem to work, although it is probably a very slim use case.
They work fine but you have to manually set the environment variable KITTY_SHELL_INTEGRATION=enabled when launching the subshell. And add the the three lines needed for integration to the subshell's rc files.
Great, thanks!
Would it be possible to have clicks outside the command text to not cause the cursor to be moved? And if not, is there a way to prevent that from triggering the bell?
https://user-images.githubusercontent.com/6032823/135128315-4252ace7-c89b-4a2e-9f85-4e1c4f3578d7.mp4
I'm using Bash.
Is it possible to optimize click-to-move-the-cursor for multi-line text in Fish Shell? There is a small issue where it takes multiple clicks between lines to position the cursor to the mouse position.
Steps to reproduce:
Screen recording:
On Tue, Sep 28, 2021 at 09:33:04AM -0700, jack1142 wrote:
Would it be possible to have clicks outside the command text to not cause the cursor to be moved? And if not, is there a way to prevent that from triggering the bell?
Not that I know of for either. It works by sending fake arrow key events, those will cause bells when there are extra ones. And while it is technically possible to have the shell mark the area of the actual editable text, getting that working robustly was too difficult. Some shells have right side prompts, multi-line prompts, etc, and they don't provide good hooks for doing so.
One could implement some kind of hack to ignore bells for some time after sending the fake keyboard events, but that is hacky and imprecise.
@page-down No idea sorry, I dont use fish shell. The way this works is kitty counts the number of characters between the current cursor position and the cell that was clicked and sends that number of left or right arrow key presses, causing the cursor to move to that position. Presumably fish requires some other kind of counting, maybe @faho can enlighten us?
EDIT: The relevant code is screen_fake_move_cursor_to_position() in screen.c
@jack1142 see if this helps with the bells https://github.com/kovidgoyal/kitty/commit/10fbf36e925f95a10d1586442fe4e9a20f3a84f7
Presumably fish requires some other kind of counting, maybe @faho can enlighten us?
I'm taking time off github, please ask @ridiculousfish instead.
@kovidgoyal the issue with fish and mouse-clicks is as follows. bash and zsh will place secondary lines at the start of the next line:
prompt> # line 1
# line 2
# line 3
but fish aligns them:
prompt> # line 1
# line 2
# line 3
it does this via cursor motions, not emitting spaces.
Now kitty assumes here that the first unoccupied cell is the end of the line. It doesn't handle the case where there is text after this cell, so it undercounts.
This patch fixes it by only breaking if the empty cell is last, but there may be a better way:
diff --git a/kitty/screen.c b/kitty/screen.c
index 07e4a6aa..4610c9d7 100644
--- a/kitty/screen.c
+++ b/kitty/screen.c
@@ -1471,11 +1471,11 @@ screen_fake_move_cursor_to_position(Screen *self, index_type x, index_type y) {
unsigned x_limit = y == end->y ? end->x : self->columns;
while (x < x_limit) {
unsigned int w = linebuf_char_width_at(self->linebuf, x, y);
- if (w == 0) {
+ if (w == 0 && x + 1 == x_limit) {
count += 1;
break;
}
- x += w;
+ x += w ? w : 1;
count += w;
}
x = 0;
Having not used Kitty too much, how similar is this to what Iterm2 provides? Were they your inspiration for creating the feature?
On Wed, Sep 29, 2021 at 01:10:01PM -0700, WSLUser wrote:
Having not used Kitty too much, how similar is this to what Iterm2 provides? Were they your inspiration for creating the feature?
I have no idea. I did use the same protocol as iTerm2 uses (well a subset of it) but that protocol comes from FinalTerm originally. I dont know what set of features iTerm's shell integration provides.
From reading: https://iterm2.com/documentation-shell-integration.html some features are in common, though others are provided by other facilities in kitty, such as https://sw.kovidgoyal.net/kitty/kittens/remote_file/ for remote file downloading. And https://sw.kovidgoyal.net/kitty/marks/ for marks.
iterm doesnt do some things that shell integration in kitty does, for example click to move cursor.
And kitty doesnt do some things that iterm does, for example, frequently used directories, as I believe this should be a feature of the shell not the terminal emulator.
@ridiculousfish: Thanks for the explanation. Your patch wont work as is, because zsh uses empty cells between the end of the text and the right prompt. So I modified it to count empty cells that occur only at the start of a line. This will possibly break for multiline text with blank lines, but I dont see a good way to handle that case.
@page-down see if the latest commit fixes it for you
@kovidgoyal Before this change, clicking the mouse two or three times in the same position would make the cursor move gradually to the specified position.
With the new empty cell detection, count
has been increasing continuously, and clicking at the same position will move the cursor back and forth to the beginning and end of multiple lines of text.
I modified it to first check and then increase count
and finally it works. However, the blank lines are indeed not processed. (Missing n position for n blank lines.)
For the case of blank lines, at the end of the loop, if the whole line is empty, count will be increased, and the blank line will be calculated correctly. (Although it is not possible to move to blank lines, that's acceptable.)
I wonder if there are any other circumstances that would cause problems with this treatment of blank lines?
diff --git a/kitty/screen.c b/kitty/screen.c
index 236c7298..1bfc17b5 100644
--- a/kitty/screen.c
+++ b/kitty/screen.c
@@ -1473,18 +1473,19 @@ screen_fake_move_cursor_to_position(Screen *self, index_type x, index_type y) {
while (x < x_limit) {
unsigned int w = linebuf_char_width_at(self->linebuf, x, y);
if (w == 0) {
- count += 1;
// we only stop counting the cells in the line at an empty cell
// if at least one non-empty cell is found. zsh uses empty cells
// between the end of the text ad the right prompt. fish uses empty
// cells at the start of a line when editing multiline text
if (!found_non_empty_cell) { x++; continue; }
+ count += 1;
break;
}
found_non_empty_cell = true;
x += w;
count += 1; // zsh requires a single arrow press to move fast dualwidth chars
}
+ if (!found_non_empty_cell) count +=1;
x = 0;
}
if (count) {
@page-down: You mean fish expects the blank cells at the start of the line to not need arrow keys? OK I have merged that, I dont think it breaks anything else, we can but try and see.
for example, frequently used directories
You have an OSC sequence for setting the working directory.I think you could use that to help determine those frequently used directories. Of course it wouldn't be perfect but I think getting it right most of the time would likely be better than not at all. It definitely has been useful for me and I'm sure plenty of others.
remote file downloading
So does Kitty support downloadable soft fonts - also known as dynamically redefinable character sets (DRCS) - using the DECDLD escape sequence? It's a cool feature and even Windows Terminal has it.
On Thu, Sep 30, 2021 at 06:20:24AM -0700, WSLUser wrote:
for example, frequently used directories
You have an OSC sequence for setting the working directory.I think you could use that to help determine those frequently used directories. Of course it wouldn't be perfect but I think getting it right most of the time would likely be better than not at all. It definitely has been useful for me and I'm sure plenty of others.
All shells already have this, I see no reason for it to be re-implemented in terminal emulators. For example: https://github.com/agkozak/zsh-z
remote file downloading
So does Kitty support downloadable soft fonts - also known as dynamically redefinable character sets (DRCS) - using the DECDLD escape sequence? It's a cool feature and even Windows Terminal has it.
No, it doesn't and if you wish to request such a feature open a separate issue for it, this one is for shell integration. If you do, provide more motivation than windows terminal supporting it. Some actual programs that use it and some reason why using it is better than just drawing graphics directly.
When the shell integration is enabled (bash) and I use Ctrl+Shift+T to open a new tab or Ctrl+Shift+W to close an open tab, this happens:
https://user-images.githubusercontent.com/6032823/135493608-38cc2646-7c1d-4dab-a3b6-4312f899719e.mp4
I just finished working on shell integration for kitty. Before releasing, I'd like some testing/feedback from the community.
In brief, shell integration enables features such as:
Open the output of the last command in a pager such as less (ctrl+shift+g)
Jump to the previous/next prompt in the scrollback (ctrl+shit+z/ctrl+shift+x)
Click with the mouse anywhere in the current command to move the cursor there
The current working directory or the command being executed are automatically displayed in the kitty window titlebar/tab title.
The text cursor is changed to a bar when editing commands at the shell prompt
Glitch free window resizing even with complex prompts. Achieved by erasing the prompt on resize and allowing the shell to redraw it cleanly.
Sophisticated completion for the kitty command in the shell
When using confirm on quit windows that contain a shell sitting at the prompt doing nothing are optionally ignored (if you use negative numbers for confirm_on_quit)
It's currently implemented for the zsh, fish and bash shells.
It works by installing hooks into the shell that inform kitty of changes in the shell state, via escape codes allowing kitty to know various things about the shell such as the location of the prompt, the command being run, etc. kitty then uses this information to enable the above features.
What I would like is:
1) Testing, especially if you already use some kind of fancy prompt setup, does the integration work with it/break it?
2) Comments on how well the functionality works/how useful it is
Details on how it works and how to configure it are in docs/shell-integration.rst
To try it out use a nightly build of kitty
or build from source.
Running it should automatically enable shell integration if you use one of the supported shells. To turn it off simply set
in kitty.conf
Note that shell integration for bash only will write three lines at the end of your .bashrc. These are safe to remove at any time, and will have no effect unless you are running kitty with shell integration enabled. This is needed because bash is the only shell that provides no way for the invoking program to inject code into it robustly.
Thanks, and enjoy!