tmux_copy_last_command_output/README.md

44 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2022-08-17 00:54:58 -05:00
# Tmux Copy Last Command Output
2022-01-30 07:22:24 -06:00
2022-08-17 00:54:58 -05:00
Capture the output of the last terminal command and copy it to clipboard.
2022-01-30 07:22:24 -06:00
## Installation
### Using [TPM](https://github.com/tmux-plugins/tpm):
2022-08-17 00:54:58 -05:00
set -g @plugin 'SinTan1729/tmux_copy_last_command_output'
2022-01-30 07:22:24 -06:00
Hit <kbd>prefix</kbd> + <kbd>I</kbd> to fetch and source the plugin.
### Manual
Clone the repo:
2022-08-17 17:10:19 -05:00
git clone https://github.com/SinTan1729/tmux_copy_last_command_output.git ${XDG_CONFIG_HOME:-$HOME/.config}/tmux/plugins/tmux_copy_last_command_output
2022-01-30 07:22:24 -06:00
2022-08-17 00:54:58 -05:00
Source it in your `.tmux.conf` (or `$XDG_CONFIG_HOME/tmux/tmux.conf`):
2022-01-30 07:22:24 -06:00
2022-08-17 00:54:58 -05:00
run-shell ${XDG_CONFIG_HOME:-$HOME/.config}/tmux/plugins/tmux_copy_last_command_output/tmux_copy_last_command_output.tmux
2022-01-30 07:22:24 -06:00
Reload TMUX conf by running:
2022-08-17 00:54:58 -05:00
tmux source-file $XDG_CONFIG_HOME/tmux/tmux.conf
2022-01-30 07:22:24 -06:00
## Configuration
2022-08-17 00:54:58 -05:00
#### @command-copy-key
2022-01-30 07:22:24 -06:00
2022-08-17 00:54:58 -05:00
Required. Set Prefix + key to trigger the plugin. For example, `prefix+g`:
2022-01-30 07:22:24 -06:00
```
2022-08-17 00:54:58 -05:00
set -g @command-copy-key g
2022-01-30 07:22:24 -06:00
```
2022-08-17 00:54:58 -05:00
#### @command-copy-prompt-pattern
2022-01-30 07:22:24 -06:00
2022-08-17 00:54:58 -05:00
Required. A regexp to identify command separator. Usually a prompt. E.g., if set to ' ) ', the plugin will capture the latest output up until the first line that contains ' ) ':
2022-01-30 07:22:24 -06:00
```
2022-08-17 00:54:58 -05:00
set -g @command-copy-prompt-pattern ' ) '
2022-01-30 07:22:24 -06:00
```