Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
if: ${{ !(inputs.enable_debug_tmate || inputs.enable_debug_vnc) || (inputs.debug_kitty_version == matrix.kitty_version && inputs.debug_nvim_version == matrix.nvim_version) }}
run: |
sudo apt update
sudo apt install -y xfce4 libxcb-xkb1 xsel tmux fish zsh
sudo apt install -y xfce4 libxcb-xkb1 xsel fish zsh
# homebrew is not used but is required to reproduce an issue for a test case
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Expand Down
47 changes: 0 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Navigate your [Kitty](https://sw.kovidgoyal.net/kitty/) scrollback buffer to qui
- ⌨️ [Keymaps](#%EF%B8%8F-keymaps)
- 🪛 [Optional Setup](#-optional-setup)
- [Command-line editing](#command-line-editing)
- [tmux (🧪 experimental )](#tmux--experimental-)
- 👏 [Recommendations](#-recommendations)
- 🤝 [Acknowledgements](#-acknowledgements)
- 🐶 [Alternatives](#-alternatives)
Expand Down Expand Up @@ -187,16 +186,6 @@ This requires extra steps to setup. See optional [Command-line editing setup](#c
- zsh: `<C-x><C-e>`
- Modify the command and do any additional operations that you typically would perform in kitty-scrollback.nvim

</details>
<details>
<summary>😾 tmux support (🧪 experimental )</summary>

<!-- TODO: add demo -->
This requires extra steps to setup. See optional [tmux setup](#tmux--experimental-).

- Open a tmux pane's scrollback history (default mapping `<C-b>[`)
- That's it! You are in Neovim, navigate the scrollback buffer.

</details>

## 🚀 Migrating to v8.0.0
Expand Down Expand Up @@ -1052,42 +1041,6 @@ bindkey '^x^e' kitty_scrollback_edit_command_line

</details>

### tmux (🧪 experimental )

> [!WARNING]\
> 🧪 tmux support is currently experimental
> If you have questions or encounter any issues using tmux, please comment on [#115](https://github.com/mikesmithgh/kitty-scrollback.nvim/issues/115)

Setup instructions to integrate kitty-scrollback.nvim with [tmux](https://github.com/tmux/tmux). These steps are optional and only
necessary if you wish to add tmux support to kitty-scrollback.nvim.

- Generate the tmux kitty-scrollback.nvim mappings and add them to `$HOME/.tmux.conf` or `$XDG_CONFIG_HOME/tmux/tmux.conf`

```sh
nvim --headless +'KittyScrollbackGenerateKittens tmux'
```

- You may need to source your tmux configuration for these changes to be reflected in a current tmux session.

```sh
tmux source $HOME/.tmux.conf
# or
tmux source $XDG_CONFIG_HOME/tmux/tmux.conf
```

- By default, kitty-scrollback.nvim overrides the default key binding `[` for opening `copy-mode`. If you use the default prefix key `<C-b>` and the
default key binding `[`, then test opening a tmux's pane scrollback history with kitty-scrollback.nvim by pressing `<C-b>[`.
- You can still access Kitty's scrollback history (default mapping `<C-S-h>`) in a tmux session. However, this is scoped to Kitty and it will only
show the current screen. When you open the tmux pane's scrollback history (default mapping `<C-b>[`), this is scoped to tmux and will display all
of the scrollback history for that tmux session.

- See example .tmux.conf for reference.

```tmux
# Browse tmux pane in nvim
bind [ run-shell 'kitty @ kitten /path/to/your/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --env "TMUX=$TMUX" --env "TMUX_PANE=#{pane_id}"'
```

## 👏 Recommendations

- Check out my ⚡️ Lightning Talk @ Neovim Conf 2023 [Developing kitty-scrollback.nvim](https://youtu.be/9TINe0J9rNg?si=_ISKqAQVS2NCuSRF)!
Expand Down
47 changes: 0 additions & 47 deletions doc/kitty-scrollback.nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,6 @@ This requires extra steps to setup. See optional
- Modify the command and do any additional operations that you typically would perform in kitty-scrollback.nvim


`-` `😾 tmux support (🧪 experimental )`

This requires extra steps to setup. See optional
|kitty-scrollback.nvim-tmux-setup|.

- Open a tmux pane’s scrollback history (default mapping `<C-b>[`)
- That’s it! You are in Neovim, navigate the scrollback buffer.


MIGRATING TO V8.0.0 *kitty-scrollback.nvim-migrating-to-v8.0.0*


Expand Down Expand Up @@ -1109,44 +1100,6 @@ flexibility in the fish shell!
- Enter a command and press `<C-x><C-e>`, you should now be editing your command line with kitty-scrollback.nvim!


TMUX ( EXPERIMENTAL ) ~


*⚠* *WARNING*
tmux support is currently experimental If you have questions or encounter any
issues using tmux, please comment on #115
<https://github.com/mikesmithgh/kitty-scrollback.nvim/issues/115>
Setup instructions to integrate kitty-scrollback.nvim with tmux
<https://github.com/tmux/tmux>. These steps are optional and only necessary if
you wish to add tmux support to kitty-scrollback.nvim.

- Generate the tmux kitty-scrollback.nvim mappings and add them to `$HOME/.tmux.conf` or `$XDG_CONFIG_HOME/tmux/tmux.conf`

>sh
nvim --headless +'KittyScrollbackGenerateKittens tmux'
<

- You may need to source your tmux configuration for these changes to be reflected in a current tmux session.

>sh
tmux source $HOME/.tmux.conf
# or
tmux source $XDG_CONFIG_HOME/tmux/tmux.conf
<

- By default, kitty-scrollback.nvim overrides the default key binding `[` for opening `copy-mode`. If you use the default prefix key `<C-b>` and the
default key binding `[`, then test opening a tmux’s pane scrollback history with kitty-scrollback.nvim by pressing `<C-b>[`.
- You can still access Kitty’s scrollback history (default mapping `<C-S-h>`) in a tmux session. However, this is scoped to Kitty and it will only
show the current screen. When you open the tmux pane’s scrollback history (default mapping `<C-b>[`), this is scoped to tmux and will display all
of the scrollback history for that tmux session.
- See example .tmux.conf for reference.

>tmux
# Browse tmux pane in nvim
bind [ run-shell 'kitty @ kitten /path/to/your/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --env "TMUX=$TMUX" --env "TMUX_PANE=#{pane_id}"'
<


RECOMMENDATIONS *kitty-scrollback.nvim-recommendations*

- Check out my Lightning Talk @ Neovim Conf 2023 Developing kitty-scrollback.nvim <https://youtu.be/9TINe0J9rNg?si=_ISKqAQVS2NCuSRF>!
Expand Down
39 changes: 14 additions & 25 deletions doc/kitty-scrollback.nvim_spec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,23 @@ KsbKittyOpts *kitty-scrollback.launch.KsbKittyOpts*
{listen_on} (string)


KsbTmuxData *kitty-scrollback.launch.KsbTmuxData*

Fields: ~
{socket_path} (string) server socket path
{pid} (string) server PID
{session_id} (string) unique session ID
{pane_id} (string) unique pane ID


KsbKittyData *kitty-scrollback.launch.KsbKittyData*

Fields: ~
{scrolled_by} (integer) the number of lines currently scrolled in kitty
{cursor_x} (integer) position of the cusor in the column in kitty
{cursor_y} (integer) position of the cursor in the row in kitty
{lines} (integer) the number of rows of the screen in kitty
{columns} (integer) the number of columns of the screen in kitty
{window_id} (integer) the id of the window to get scrollback text
{window_title} (string) the title of the window to get scrollback text
{ksb_dir} (string) the base runtime path of kitty-scrollback.nvim
{kitty_scrollback_config} (string) the config name of user config options
{kitty_opts} (KsbKittyOpts) relevant kitty configuration values
{kitty_config_dir} (string) kitty configuration directory path
{kitty_version} (table) kitty version
{kitty_path} (string) kitty executable path
{tmux} (KsbTmuxData|nil) tmux data
{shell} (string) kitty shell program to execute
{scrolled_by} (integer) the number of lines currently scrolled in kitty
{cursor_x} (integer) position of the cusor in the column in kitty
{cursor_y} (integer) position of the cursor in the row in kitty
{lines} (integer) the number of rows of the screen in kitty
{columns} (integer) the number of columns of the screen in kitty
{window_id} (integer) the id of the window to get scrollback text
{window_title} (string) the title of the window to get scrollback text
{ksb_dir} (string) the base runtime path of kitty-scrollback.nvim
{kitty_scrollback_config} (string) the config name of user config options
{kitty_opts} (KsbKittyOpts) relevant kitty configuration values
{kitty_config_dir} (string) kitty configuration directory path
{kitty_version} (table) kitty version
{kitty_path} (string) kitty executable path
{shell} (string) kitty shell program to execute


KsbPrivate *kitty-scrollback.launch.KsbPrivate*
Expand Down Expand Up @@ -71,7 +61,6 @@ KsbKittyGetTextArguments

Fields: ~
{kitty} (string) kitty args for get-text
{tmux} (string) tmux args for capture-pane


M.launch() *kitty-scrollback.launch.launch*
Expand Down
12 changes: 0 additions & 12 deletions lua/kitty-scrollback/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,6 @@ M.generate_kittens = function(generate_modes)
end, builtin_map_configs)
table.insert(builtin_command_configs, '')

local builtin_tmux_configs = {
'# Browse tmux pane in nvim',
[[bind [ run-shell 'kitty @ kitten ]]
.. kitty_scrollback_kitten
.. [[ --env "TMUX=$TMUX" --env "TMUX_PANE=#{pane_id}"']],
'',
}

local configs = {}
local filetype
if target_gen_modes['maps'] then
Expand All @@ -143,10 +135,6 @@ M.generate_kittens = function(generate_modes)
vim.list_extend(configs, builtin_command_configs)
filetype = 'sh'
end
if target_gen_modes['tmux'] then
vim.list_extend(configs, builtin_tmux_configs)
filetype = 'tmux'
end
if #vim.tbl_values(target_gen_modes) > 1 then
filetype = nil
end
Expand Down
2 changes: 1 addition & 1 deletion lua/kitty-scrollback/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ M.setup = function(configs)
end, {
nargs = '*',
complete = function()
return { 'maps', 'commands', 'tmux' }
return { 'maps', 'commands' }
end,
})

Expand Down
6 changes: 0 additions & 6 deletions lua/kitty-scrollback/kitty_commands.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---@mod kitty-scrollback.kitty_commands
local ksb_tmux = require('kitty-scrollback.tmux_commands')
local ksb_util = require('kitty-scrollback.util')
local M = {}

Expand Down Expand Up @@ -44,11 +43,6 @@ local function get_scrollback_cmd(get_text_args)
.. ' && '
.. start_set_title_cmd

if p.kitty_data.tmux and next(p.kitty_data.tmux) then
scrollback_cmd = ksb_tmux.get_scrollback_cmd(get_text_args)
full_cmd = scrollback_cmd .. ' | ' .. sed_cmd .. ' && ' .. start_set_title_cmd
end

return scrollback_cmd, full_cmd
end

Expand Down
26 changes: 0 additions & 26 deletions lua/kitty-scrollback/launch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ local ksb_api
local ksb_keymaps
---@module 'kitty-scrollback.kitty_commands'
local ksb_kitty_cmds
---@module 'kitty-scrollback.tmux_commands'
local ksb_tmux_cmds
---@module 'kitty-scrollback.util'
local ksb_util
---@module 'kitty-scrollback.autocommands'
Expand All @@ -34,12 +32,6 @@ local M = {}
---@field allow_remote_control string 'password' | 'socket-only' | 'socket' | 'no' | 'n' | 'false' | 'yes' | 'y' | 'true'
---@field listen_on string

---@class KsbTmuxData
---@field socket_path string server socket path
---@field pid string server PID
---@field session_id string unique session ID
---@field pane_id string unique pane ID

---@class KsbKittyData
---@field scrolled_by integer the number of lines currently scrolled in kitty
---@field cursor_x integer position of the cusor in the column in kitty
Expand All @@ -54,7 +46,6 @@ local M = {}
---@field kitty_config_dir string kitty configuration directory path
---@field kitty_version table kitty version
---@field kitty_path string kitty executable path
---@field tmux KsbTmuxData|nil tmux data
---@field shell string kitty shell program to execute

---@class KsbPrivate
Expand Down Expand Up @@ -157,12 +148,6 @@ local set_cursor_position = vim.schedule_wrap(function(d)
local y = d.cursor_y - 1 - tab_offset
local scrolled_by = d.scrolled_by
local lines = d.lines - tab_offset
if p.kitty_data.tmux and next(p.kitty_data.tmux) then
local ok, status_option = ksb_tmux_cmds.show_status_option()
if ok then
lines = lines - status_option
end
end
if y < 0 then
-- adjust when on first line of terminal
lines = lines + math.abs(y)
Expand Down Expand Up @@ -217,7 +202,6 @@ local function load_requires()
ksb_api = require('kitty-scrollback.api')
ksb_keymaps = require('kitty-scrollback.keymaps')
ksb_kitty_cmds = require('kitty-scrollback.kitty_commands')
ksb_tmux_cmds = require('kitty-scrollback.tmux_commands')
ksb_util = require('kitty-scrollback.util')
ksb_autocmds = require('kitty-scrollback.autocommands')
ksb_health = require('kitty-scrollback.health')
Expand Down Expand Up @@ -298,7 +282,6 @@ M.setup = function(kitty_data_str)

ksb_util.setup(p, opts)
ksb_kitty_cmds.setup(p, opts)
ksb_tmux_cmds.setup(p, opts)
ksb_win.setup(p, opts)
ksb_footer_win.setup(p, opts)
ksb_autocmds.setup(p, opts)
Expand Down Expand Up @@ -327,15 +310,12 @@ end

---@class KsbKittyGetTextArguments
---@field kitty string kitty args for get-text
---@field tmux string tmux args for capture-pane

---@return KsbKittyGetTextArguments
local function get_text_opts()
local ansi = '--ansi'
local tmux_ansi = '-e'
if not opts.kitty_get_text.ansi then
ansi = ''
tmux_ansi = ''
end

local clear_selection = '--clear-selection'
Expand All @@ -344,23 +324,17 @@ local function get_text_opts()
end

local extent = '--extent=all'
local tmux_extent = '-S - -E -'
local extent_opt = opts.kitty_get_text.extent
if extent_opt then
extent = '--extent=' .. extent_opt
if extent_opt == 'screen' then
tmux_extent = '-S 0 -E -'
end
end

-- always add wrap markers, wrap markers are important to add blank lines with /r to
-- fill the screen when setting the cursor position
local add_wrap_markers = '--add-wrap-markers'
local tmux_add_wrap_markers = '-J'

return {
kitty = ansi .. ' ' .. clear_selection .. ' ' .. add_wrap_markers .. ' ' .. extent,
tmux = tmux_ansi .. ' ' .. tmux_add_wrap_markers .. ' ' .. tmux_extent,
}
end

Expand Down
Loading