Skip to content

Commit 80caa06

Browse files
committed
feat!: remove experimental support for tmux
closes #115 BREAKING CHANGE: remove experimental support for tmux
1 parent a517979 commit 80caa06

File tree

10 files changed

+4
-408
lines changed

10 files changed

+4
-408
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
if: ${{ !(inputs.enable_debug_tmate || inputs.enable_debug_vnc) || (inputs.debug_kitty_version == matrix.kitty_version && inputs.debug_nvim_version == matrix.nvim_version) }}
7878
run: |
7979
sudo apt update
80-
sudo apt install -y xfce4 libxcb-xkb1 xsel tmux fish zsh
80+
sudo apt install -y xfce4 libxcb-xkb1 xsel fish zsh
8181
# homebrew is not used but is required to reproduce an issue for a test case
8282
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
8383

README.md

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Navigate your [Kitty](https://sw.kovidgoyal.net/kitty/) scrollback buffer to qui
5454
- ⌨️ [Keymaps](#%EF%B8%8F-keymaps)
5555
- 🪛 [Optional Setup](#-optional-setup)
5656
- [Command-line editing](#command-line-editing)
57-
- [tmux (🧪 experimental )](#tmux--experimental-)
5857
- 👏 [Recommendations](#-recommendations)
5958
- 🤝 [Acknowledgements](#-acknowledgements)
6059
- 🐶 [Alternatives](#-alternatives)
@@ -189,15 +188,6 @@ This requires extra steps to setup. See optional [Command-line editing setup](#c
189188

190189
</details>
191190
<details>
192-
<summary>😾 tmux support (🧪 experimental )</summary>
193-
194-
<!-- TODO: add demo -->
195-
This requires extra steps to setup. See optional [tmux setup](#tmux--experimental-).
196-
197-
- Open a tmux pane's scrollback history (default mapping `<C-b>[`)
198-
- That's it! You are in Neovim, navigate the scrollback buffer.
199-
200-
</details>
201191

202192
## 🚀 Migrating to v8.0.0
203193
> [!IMPORTANT]\
@@ -1052,42 +1042,6 @@ bindkey '^x^e' kitty_scrollback_edit_command_line
10521042

10531043
</details>
10541044

1055-
### tmux (🧪 experimental )
1056-
1057-
> [!WARNING]\
1058-
> 🧪 tmux support is currently experimental
1059-
> If you have questions or encounter any issues using tmux, please comment on [#115](https://github.com/mikesmithgh/kitty-scrollback.nvim/issues/115)
1060-
1061-
Setup instructions to integrate kitty-scrollback.nvim with [tmux](https://github.com/tmux/tmux). These steps are optional and only
1062-
necessary if you wish to add tmux support to kitty-scrollback.nvim.
1063-
1064-
- Generate the tmux kitty-scrollback.nvim mappings and add them to `$HOME/.tmux.conf` or `$XDG_CONFIG_HOME/tmux/tmux.conf`
1065-
1066-
```sh
1067-
nvim --headless +'KittyScrollbackGenerateKittens tmux'
1068-
```
1069-
1070-
- You may need to source your tmux configuration for these changes to be reflected in a current tmux session.
1071-
1072-
```sh
1073-
tmux source $HOME/.tmux.conf
1074-
# or
1075-
tmux source $XDG_CONFIG_HOME/tmux/tmux.conf
1076-
```
1077-
1078-
- 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
1079-
default key binding `[`, then test opening a tmux's pane scrollback history with kitty-scrollback.nvim by pressing `<C-b>[`.
1080-
- 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
1081-
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
1082-
of the scrollback history for that tmux session.
1083-
1084-
- See example .tmux.conf for reference.
1085-
1086-
```tmux
1087-
# Browse tmux pane in nvim
1088-
bind [ run-shell 'kitty @ kitten /path/to/your/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --env "TMUX=$TMUX" --env "TMUX_PANE=#{pane_id}"'
1089-
```
1090-
10911045
## 👏 Recommendations
10921046

10931047
- Check out my ⚡️ Lightning Talk @ Neovim Conf 2023 [Developing kitty-scrollback.nvim](https://youtu.be/9TINe0J9rNg?si=_ISKqAQVS2NCuSRF)!

lua/kitty-scrollback/api.lua

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,6 @@ M.generate_kittens = function(generate_modes)
123123
end, builtin_map_configs)
124124
table.insert(builtin_command_configs, '')
125125

126-
local builtin_tmux_configs = {
127-
'# Browse tmux pane in nvim',
128-
[[bind [ run-shell 'kitty @ kitten ]]
129-
.. kitty_scrollback_kitten
130-
.. [[ --env "TMUX=$TMUX" --env "TMUX_PANE=#{pane_id}"']],
131-
'',
132-
}
133-
134126
local configs = {}
135127
local filetype
136128
if target_gen_modes['maps'] then
@@ -143,10 +135,6 @@ M.generate_kittens = function(generate_modes)
143135
vim.list_extend(configs, builtin_command_configs)
144136
filetype = 'sh'
145137
end
146-
if target_gen_modes['tmux'] then
147-
vim.list_extend(configs, builtin_tmux_configs)
148-
filetype = 'tmux'
149-
end
150138
if #vim.tbl_values(target_gen_modes) > 1 then
151139
filetype = nil
152140
end

lua/kitty-scrollback/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ M.setup = function(configs)
2020
end, {
2121
nargs = '*',
2222
complete = function()
23-
return { 'maps', 'commands', 'tmux' }
23+
return { 'maps', 'commands' }
2424
end,
2525
})
2626

lua/kitty-scrollback/kitty_commands.lua

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---@mod kitty-scrollback.kitty_commands
2-
local ksb_tmux = require('kitty-scrollback.tmux_commands')
32
local ksb_util = require('kitty-scrollback.util')
43
local M = {}
54

@@ -44,11 +43,6 @@ local function get_scrollback_cmd(get_text_args)
4443
.. ' && '
4544
.. start_set_title_cmd
4645

47-
if p.kitty_data.tmux and next(p.kitty_data.tmux) then
48-
scrollback_cmd = ksb_tmux.get_scrollback_cmd(get_text_args)
49-
full_cmd = scrollback_cmd .. ' | ' .. sed_cmd .. ' && ' .. start_set_title_cmd
50-
end
51-
5246
return scrollback_cmd, full_cmd
5347
end
5448

lua/kitty-scrollback/launch.lua

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ local ksb_api
1212
local ksb_keymaps
1313
---@module 'kitty-scrollback.kitty_commands'
1414
local ksb_kitty_cmds
15-
---@module 'kitty-scrollback.tmux_commands'
16-
local ksb_tmux_cmds
1715
---@module 'kitty-scrollback.util'
1816
local ksb_util
1917
---@module 'kitty-scrollback.autocommands'
@@ -34,12 +32,6 @@ local M = {}
3432
---@field allow_remote_control string 'password' | 'socket-only' | 'socket' | 'no' | 'n' | 'false' | 'yes' | 'y' | 'true'
3533
---@field listen_on string
3634

37-
---@class KsbTmuxData
38-
---@field socket_path string server socket path
39-
---@field pid string server PID
40-
---@field session_id string unique session ID
41-
---@field pane_id string unique pane ID
42-
4335
---@class KsbKittyData
4436
---@field scrolled_by integer the number of lines currently scrolled in kitty
4537
---@field cursor_x integer position of the cusor in the column in kitty
@@ -54,7 +46,6 @@ local M = {}
5446
---@field kitty_config_dir string kitty configuration directory path
5547
---@field kitty_version table kitty version
5648
---@field kitty_path string kitty executable path
57-
---@field tmux KsbTmuxData|nil tmux data
5849
---@field shell string kitty shell program to execute
5950

6051
---@class KsbPrivate
@@ -157,12 +148,6 @@ local set_cursor_position = vim.schedule_wrap(function(d)
157148
local y = d.cursor_y - 1 - tab_offset
158149
local scrolled_by = d.scrolled_by
159150
local lines = d.lines - tab_offset
160-
if p.kitty_data.tmux and next(p.kitty_data.tmux) then
161-
local ok, status_option = ksb_tmux_cmds.show_status_option()
162-
if ok then
163-
lines = lines - status_option
164-
end
165-
end
166151
if y < 0 then
167152
-- adjust when on first line of terminal
168153
lines = lines + math.abs(y)
@@ -217,7 +202,6 @@ local function load_requires()
217202
ksb_api = require('kitty-scrollback.api')
218203
ksb_keymaps = require('kitty-scrollback.keymaps')
219204
ksb_kitty_cmds = require('kitty-scrollback.kitty_commands')
220-
ksb_tmux_cmds = require('kitty-scrollback.tmux_commands')
221205
ksb_util = require('kitty-scrollback.util')
222206
ksb_autocmds = require('kitty-scrollback.autocommands')
223207
ksb_health = require('kitty-scrollback.health')
@@ -298,7 +282,6 @@ M.setup = function(kitty_data_str)
298282

299283
ksb_util.setup(p, opts)
300284
ksb_kitty_cmds.setup(p, opts)
301-
ksb_tmux_cmds.setup(p, opts)
302285
ksb_win.setup(p, opts)
303286
ksb_footer_win.setup(p, opts)
304287
ksb_autocmds.setup(p, opts)
@@ -327,15 +310,12 @@ end
327310

328311
---@class KsbKittyGetTextArguments
329312
---@field kitty string kitty args for get-text
330-
---@field tmux string tmux args for capture-pane
331313

332314
---@return KsbKittyGetTextArguments
333315
local function get_text_opts()
334316
local ansi = '--ansi'
335-
local tmux_ansi = '-e'
336317
if not opts.kitty_get_text.ansi then
337318
ansi = ''
338-
tmux_ansi = ''
339319
end
340320

341321
local clear_selection = '--clear-selection'
@@ -344,23 +324,17 @@ local function get_text_opts()
344324
end
345325

346326
local extent = '--extent=all'
347-
local tmux_extent = '-S - -E -'
348327
local extent_opt = opts.kitty_get_text.extent
349328
if extent_opt then
350329
extent = '--extent=' .. extent_opt
351-
if extent_opt == 'screen' then
352-
tmux_extent = '-S 0 -E -'
353-
end
354330
end
355331

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

361336
return {
362337
kitty = ansi .. ' ' .. clear_selection .. ' ' .. add_wrap_markers .. ' ' .. extent,
363-
tmux = tmux_ansi .. ' ' .. tmux_add_wrap_markers .. ' ' .. tmux_extent,
364338
}
365339
end
366340

lua/kitty-scrollback/tmux_commands.lua

Lines changed: 0 additions & 54 deletions
This file was deleted.

python/kitty_scrollback_nvim.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,8 @@ def main():
5959
raise SystemExit('Must be run as kitten kitty_scrollback_nvim')
6060

6161

62-
def parse_tmux_env(env):
63-
tmux_data = {}
64-
tmux = None
65-
tmux_pane = None
66-
for e in env:
67-
env_kv = e.split('=')
68-
if len(env_kv) == 2:
69-
key = env_kv[0]
70-
value = env_kv[1]
71-
if key == 'TMUX':
72-
tmux = value
73-
if key == 'TMUX_PANE':
74-
tmux_pane = value
75-
if tmux:
76-
tmux_parts = tmux.split(',')
77-
if len(tmux_parts) == 3 and tmux_pane:
78-
tmux_data['socket_path'] = tmux_parts[0]
79-
tmux_data['pid'] = tmux_parts[1]
80-
tmux_data['session_id'] = tmux_parts[2]
81-
tmux_data['pane_id'] = tmux_pane
82-
return tmux_data
83-
84-
8562
# based on kitty source window.py
86-
def pipe_data(w, target_window_id, config, kitty_path, tmux_data):
63+
def pipe_data(w, target_window_id, config, kitty_path):
8764
kitty_opts = get_options()
8865
kitty_shell_integration = get_effective_ksi_env_var(kitty_opts)
8966
return {
@@ -116,7 +93,6 @@ def pipe_data(w, target_window_id, config, kitty_path, tmux_data):
11693
},
11794
'kitty_config_dir': config_dir,
11895
'kitty_version': version,
119-
'tmux': tmux_data,
12096
'shell': resolved_shell(kitty_opts)[0]
12197
}
12298

@@ -180,12 +156,10 @@ def handle_result(args: List[str],
180156
config = parse_config(args)
181157
cwd = parse_cwd(args, w.child.foreground_cwd)
182158
env = parse_env(args)
183-
tmux_data = parse_tmux_env(env)
184159
kitty_data_str = pipe_data(w,
185160
target_window_id,
186161
config,
187-
kitty_path,
188-
tmux_data)
162+
kitty_path)
189163
kitty_data = json.dumps(kitty_data_str)
190164

191165
if w.title.startswith('kitty-scrollback.nvim'):

0 commit comments

Comments
 (0)