Closed gregorias closed 11 months ago
You cant detect shell integration is active from kitty settings if you are using manual integration. With manual integration everything happens in the shell, I suppose you could do something like run
$SHELL -il -c "echo $PS1" | cat -v
and check for the presence of the shell integration OSC codes in the output. Or look at the shell integration scripts in kitty and see what variables/functions they define for each shell and write your detection code as above but checking for those instead. Either way you'd need to special case fish.
Hi @gregorias, thank you for the issue, could you provide the output of :KittyScrollbackCheckHealth
? This will give me info on your configuration.
You cant detect shell integration is active from kitty settings if you are using manual integration. With manual integration everything happens in the shell, I suppose you could do something like run
$SHELL -il -c "echo $PS1" | cat -v
and check for the presence of the shell integration OSC codes in the output. Or look at the shell integration scripts in kitty and see what variables/functions they define for each shell and write your detection code as above but checking for those instead. Either way you'd need to special case fish.
Hey @kovidgoyal! Thanks for the info. I am checking for the KITTY_SHELL_INTEGRATION
environment variable. https://github.com/mikesmithgh/kitty-scrollback.nvim/blob/8cdd64f765bea81ec46f337babe050c51313be07/python/kitty_scrollback_nvim.py#L20
But, I suppose this may not be reliable if the user is setting it up manually.
Interesting idea about checking the OSC codes.
I'm not sure if I need to be as strict on this check, maybe I can try and just warn if none of those OSC prompt markers are found.
==============================================================================
kitty-scrollback: require("kitty-scrollback.health").check()
kitty-scrollback: Neovim version 0.9+ ~
- OK NVIM 0.9.4
- If you are using a version of nvim that is less than 0.10, then formatting on this checkhealth may be malformed
kitty-scrollback: kitty-scrollback.nvim version ~
- OK `|`\___/`|` *kitty-scrollback.nvim* @ `469dfe3`
=) `^`Y`^` (=
\ *^* / If you have any issues or questions using *kitty-scrollback.nvim* then
` )=*=( ` please create an issue at
/ \ https://github.com/mikesmithgh/kitty-scrollback.nvim/issues and
| | provide the `KittyScrollbackCheckHealth` report.
/| | | |\
\| | `|`_`|`/\
/_// ___/ *Bonus* *points* *for* *cat* *memes*
\_)
kitty-scrollback: Kitty remote control ~
- OK `kitty @ ls` exited with code *0*
kitty-scrollback: Kitty data ~
- OK Kitty data available
>lua
{
columns = 300,
cursor_x = 1,
cursor_y = 83,
kitty_config_dir = "/Users/grzesiek/.config/kitty",
kitty_opts = {
allow_remote_control = "yes",
listen_on = "unix:/tmp/kitty",
scrollback_fill_enlarged_window = false,
scrollback_lines = 2000,
scrollback_pager = { "less", "--chop-long-lines", "--RAW-CONTROL-CHARS", "+INPUT_LINE_NUMBER" },
scrollback_pager_history_size = 0,
shell_integration = { "disabled" }
},
kitty_scrollback_config = "ksb_builtin_checkhealth",
kitty_version = { 0, 31, 0 },
ksb_dir = "/Users/grzesiek/.local/share/nvim/lazy/kitty-scrollback.nvim",
lines = 85,
scrolled_by = 0,
window_id = 1,
window_title = "~/.c/fish"
}
kitty-scrollback: Kitty version 0.29+ ~
- OK kitty 0.31.0
kitty-scrollback: clipboard ~
- OK Clipboard tool found: *pbcopy*
kitty-scrollback: Kitty shell integration ~
- WARNING Kitty shell integration is disabled and/or `no-prompt-mark` is set.
Some functionality will not work when Kitty shell integration is disabled or `no-prompt-mark` is set, such as capturing the last command output.
- ADVICE:
- Remove `disabled` and `no-prompt-mark` from *shell_integration* if present in your Kitty configuration.
Current *kitty_get_text* options:
` opts = {`
` kitty_get_text = {`
` extent = 'all',`
` ansi = true,`
` clear_selection = true,`
` },`
` }`
See https://sw.kovidgoyal.net/kitty/remote-control/#cmdoption-kitty-get-text-extent for
more information on *extent* or run `kitty @ get-text --help`
Current *shell_integration* options:
` KITTY_SHELL_INTEGRATION='disabled'`
See https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.shell_integration for more information
on *shell_integration*
kitty-scrollback: sed ~
- OK `sed -E -e s/$/[0m/g -e s/\[\?25.\[.*;.*H\[.*//g` exited with code *0* and stdout `expected`
`sed: /usr/bin/sed`
kitty-scrollback: Kitty debug config ~
- OK kitty 0.31.0 (b247fda672) created by Kovid Goyal
Darwin Grzegorzs-MBP.home 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:32:11 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T6030 arm64
ProductName: macOS ProductVersion: 14.1.1 BuildVersion: 23B2082
`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:` /opt/homebrew/bin/fish
`Loaded config files:`
/Users/grzesiek/.config/kitty/kitty.conf
Config options different from defaults:
allow_remote_control yes
editor /opt/homebrew/bin/nvim
enabled_layouts ['splits', 'stack', 'fat', 'tall']
font_family DejaVuSansM Nerd Font Mono
font_size 14.0
hide_window_decorations 2
listen_on unix:/tmp/kitty
macos_option_as_alt 2
shell /opt/homebrew/bin/fish
shell_integration frozenset({'disabled'})
tab_bar_edge 1
tab_bar_min_tabs 1
tab_bar_style slant
tab_title_template {title}{'(x)' if layout_name == 'stack' else ''}
`Changed mouse actions:`
ctrl+shift+right press ungrabbed → combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_visited_cmd_output
`Added shortcuts:`
ctrl+shift+/ → load_config_file
ctrl+shift+; > f → goto_layout fat
ctrl+shift+; > h → move_window left
ctrl+shift+; > j → move_window down
ctrl+shift+; > k → move_window up
ctrl+shift+; > l → move_window right
ctrl+shift+; > s → goto_layout splits
ctrl+shift+; > t → goto_layout tall
ctrl+shift+; > x → goto_layout stack
ctrl+shift+f > c → kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
ctrl+shift+f > g → show_last_command_output
ctrl+shift+f > h → kitty_scrollback_nvim
ctrl+shift+f > s → kitten kitty_grab/grab.py
ctrl+shift+g > f → kitten hints --type path --program @
ctrl+shift+g > h → kitten hints --type hash --program @
ctrl+shift+g > i → kitten hints --type ip --program @
ctrl+shift+g > l → kitten hints --type line --program @
ctrl+shift+g > u → kitten hints --type url --program @
ctrl+shift+g > w → kitten hints --type word --program @
ctrl+shift+p → previous_tab
ctrl+shift+w > c → focus_visible_window
ctrl+shift+w > f → toggle_fullscreen
ctrl+shift+w > q → close_window
ctrl+shift+w > x → swap_with_window
`Removed shortcuts:`
kitty_mod+f → move_window_forward
kitty_mod+g → show_last_command_output
kitty_mod+p > f → kitten hints --type path --program -
kitty_mod+p > h → kitten hints --type hash --program -
kitty_mod+p > l → kitten hints --type line --program -
kitty_mod+p > n → kitten hints --type linenum
kitty_mod+p > shift+f → kitten hints --type path
kitty_mod+p > w → kitten hints --type word --program -
kitty_mod+p > y → kitten hints --type hyperlink
kitty_mod+w → close_window
`Changed shortcuts:`
kitty_mod+enter → launch --location=vsplit --cwd=current
kitty_mod+h → neighboring_window left
kitty_mod+j → neighboring_window down
kitty_mod+k → neighboring_window up
kitty_mod+l → neighboring_window right
kitty_mod+n → next_tab
kitty_mod+o → new_os_window
kitty_mod+s → launch --location=hsplit --cwd=current
kitty_mod+t → launch --type=tab --cwd=current --location=after
kitty_mod+x → toggle_layout stack
`Colors`:
active_border_color #2e7de9
active_tab_background #2e7de9
active_tab_foreground #e9e9ec
background #e1e2e7
color0 #e9e9ed
color1 #f52a65
color10 #587539
color11 #8c6c3e
color12 #2e7de9
color13 #9854f1
color14 #007197
color15 #3760bf
color16 #b15c00
color17 #c64343
color2 #587539
color3 #8c6c3e
color4 #2e7de9
color5 #9854f1
color6 #007197
color7 #6172b0
color8 #a1a6c5
color9 #f52a65
cursor #3760bf
cursor_text_color #e1e2e7
foreground #3760bf
inactive_border_color #c4c8da
inactive_tab_background #c4c8da
inactive_tab_foreground #8990b3
selection_background #99a7df
selection_foreground #3760bf
url_color #387068
`Important environment variables seen by the kitty process:`
PATH `/Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin`
LANG `en_US.UTF-8`
SHELL `/opt/homebrew/bin/fish`
USER `grzesiek`
:tada: This issue has been resolved in version 2.3.1 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Hey @gregorias, thanks for reporting I went ahead and removed the validation. It is too complicated to worry about trying to check for all conditions and since it is documented as a requirement, I think this is safe 👍
is_valid_extent_keyword
incorrectly marks a manual shell integration setup as invalid.I configured my setup as instructed in the README, and when I tried to get a scrollback of the last commandm, I got
'ERROR: Kitty shell integration is disabled and/or no-prompt-mark is set',
fromvalidate_extent
. I suspected that the validation check was a false positive and it only checked for the automated shell integration, so I disabled the check and everything worked fine. I was able to get a scrollback of the last command.I suspect that
is_valid_extent_keyword
should also check for signs of manual shell integration although I don't yet how to do this.KITTY_SHELL_INTEGRATION
environment variable gets cleared, for instance.Thank you for this plugin. It's an amazing achievement to integrate the scrollback with Neovim so well. I'm looking forward to continued development of this plugin to make it even more seemless and flexible.