Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get shell integration working correctly (MacOS, Zsh) #4788

Closed
suessflorian opened this issue Mar 4, 2022 · 11 comments
Closed

Unable to get shell integration working correctly (MacOS, Zsh) #4788

suessflorian opened this issue Mar 4, 2022 · 11 comments
Labels

Comments

@suessflorian
Copy link

suessflorian commented Mar 4, 2022

Describe the bug
Prepending prompts with some sort of escape code 133;A and command output with 133;C.

To Reproduce
Steps to reproduce the behavior:

  1. Ctrl+Shift+h or Ctrl+Shift+g
  2. See escape codes prepended.

Recording
https://user-images.githubusercontent.com/23600725/156856048-68ed461a-988c-4ec8-801e-3d4a4252e25d.mov

Environment details

kitty 0.24.3 created by Kovid Goyal
Darwin florians-mbp-2.lan 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
ProductName:	macOS ProductVersion:	12.1 BuildVersion:	21C52
Frozen: True
Paths:
  kitty: /Applications/kitty.app/Contents/MacOS/kitty
  base dir: /Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
  system shell: /bin/zsh
Loaded config files:
  /Users/floriansuess/.config/kitty/kitty.conf

Config options different from defaults:

Important environment variables seen by the kitty process:
	PATH                                /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
	LANG                                en_NZ.UTF-8
	SHELL                               /bin/zsh
	USER                                floriansuess

Additional Context
Escape codes are not prepended upon shell_integration disabled.

@suessflorian
Copy link
Author

Hugely appreciate the work you've done on this terminal @kovidgoyal by the way 🙇‍♂️

@page-down
Copy link
Contributor

I can reproduce the issue.

I remember that there was a recent update to kitty ansi sanitizer, maybe it has something to do with that?

@kovidgoyal
Copy link
Owner

This is just because less on macOS does not handle OSC escape codes.
Not sure what the best solution for it is. I suppose one could detect
macOS and strip them ourselves. It would be sad to do that since it
means prompts and hyperlinks wont be marked in case the user is using a
more capable pager program than the builtin less. As a workaround if you
install less form brew and use that as your pager, you should be fine.

It's a real shame macOS has such poor basic utilities.

@suessflorian
Copy link
Author

Oh @kovidgoyal I totally see, well 😅 I was hoping, especially for the fantastic ctrl+shift+g I could start using nvim directly as my pager, so I'm not phased here. I'd be happy to close this and leave this issue by blaming macOS?

@kovidgoyal
Copy link
Owner

leave it open for now, let me think about it.

@suessflorian
Copy link
Author

Hey @kovidgoyal, I've just tried using less installed via brew.

Documents/my-dotfiles % which less
/opt/homebrew/bin/less
 Documents/my-dotfiles % less --version
less 590 (PCRE2 regular expressions)
Copyright (C) 1984-2021  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less

Still seeing those escape codes 🤔

@suessflorian
Copy link
Author

Also seeing the escape codes when trying out nvim as a pager. Maybe there's something wrong with my machine 🤔... Wondering if other people are running into this.

@page-down
Copy link
Contributor

That's because there is no homebrew bin directory in kitty's own environment variable PATH.
So kitty found /usr/bin/less, which is still the one that comes with macOS.
Use the following configuration option to add your homebrew bin path.
https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.exe_search_path

As for using Neovim as a pager, here is my configuration and it works fine.
#719 (comment)

@karlb
Copy link

karlb commented Apr 13, 2022

I also see this problem on Linux with the following versions:
kitty 0.25.0 created by Kovid Goyal
fish, version 3.4.1
less 551 (GNU regular expressions)

@page-down
Copy link
Contributor

page-down commented Apr 13, 2022

Update your less to the latest version. (I know some older lts distributions still use this old version.)

The new version of less fixes a lot of problems and is worth updating, since you are using the latest fish and kitty.

You don't need to override the ones that come with the system, if you don't want to break other dependencies. Just change the kitty scrollback pager to point to a different path to latest less.

I've fixed it but never submitted a PR because I didn't think it was worth it. It's a waste of time to start additional process to check the version or check the sentinel file every time.

@karlb
Copy link

karlb commented Apr 13, 2022

Yes, it works with less 590. Thanks for the quick reply, I'm really not used to the less version making a difference!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants