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

feat: capture from start of tmux pane history #28

Merged
merged 13 commits into from Sep 2, 2023

Conversation

pbnj
Copy link
Contributor

@pbnj pbnj commented Aug 31, 2023

By default, tmux capture-pane only captures what is visible on the pane. This means that any output that has scrolled off the pane is no longer being suggested by cmp-tmux. For example, on a MBP Pro 13" with terminal font of Menlo and font size of 11, with 2 vertical panes in tmux, the maximum number of visible lines is ~32 ±2.

My use-case: aws iam list-policies | jq -rc .Policies[] produces more than 4,000 lines of output. I would like to be able to start typing an IAM Policy Name or IAM Policy ARN and have cmp fuzzily suggest completions from the entire pane history (via tmux capture-pane -S-).

I have tested this change on my tmux history-limit of 20000 and there were no noticeable performance issues.

Screenshot

Screenshot 2023-08-31 at 12 18 13 AM
  • Pane 1 (top): neovim with cmp + cmp-tmux suggestions
  • Pane 2 (bottom): output from cat /dev/random exceeding 20,000 lines

@andersevenrud

This comment was marked as resolved.

andersevenrud

This comment was marked as resolved.

@andersevenrud andersevenrud added the enhancement New feature or request label Sep 1, 2023
Valid values:

- `0`: start of visible pane (default value)
- `-`: start of pane history

See `:Man tmux` for details.
andersevenrud

This comment was marked as resolved.

@pbnj

This comment was marked as outdated.

lua/cmp_tmux/tmux.lua Outdated Show resolved Hide resolved
lua/cmp_tmux/tmux.lua Outdated Show resolved Hide resolved
lua/cmp_tmux/tmux.lua Outdated Show resolved Hide resolved
andersevenrud

This comment was marked as resolved.

@pbnj

This comment was marked as resolved.

@andersevenrud

This comment was marked as outdated.

@pbnj

This comment was marked as resolved.

@pbnj

This comment was marked as resolved.

Copy link
Owner

@andersevenrud andersevenrud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Thanks for your contribution!

@andersevenrud

This comment was marked as outdated.

@andersevenrud andersevenrud merged commit 97ec06b into andersevenrud:main Sep 2, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants