1
- # Tmux Proper Pipe Pane
1
+ # Tmux Logging
2
2
3
- Tmux enables easy command logging with ` pipe-pane ` .
3
+ Features:
4
+ 1 . Logging of all output in the current pane<br />
5
+ After you start logging, everything that's typed and all the output will be
6
+ saved to a file.
7
+ 2 . Enables "screen capture" of the current pane<br />
8
+ All the text visible in the current pane is saved to a file. Like a
9
+ screenshot, but textual.
10
+ 3 . Enables saving a complete history of the current pane<br />
11
+ All that has been typed and all the output since the creation of the current
12
+ pane is saved to a file.
4
13
5
- Using "raw" ` pipe-pane ` has some downsides. This plugin improves the vanilla
6
- Tmux ` pipe-pane ` functionality.
14
+ ### 1. Logging
7
15
8
- ### About
16
+ Key binding: ` prefix + shift + p ` <br />
17
+ Toggles (start/stop) logging in the current pane.
9
18
10
- This plugin brings the following improvements to the Tmux logging
11
- functionality:
12
-
13
- ** 1. removes ANSI codes from the log**
19
+ Logging improves the default ` pipe-pane ` logging mechanism by stripping ANSI
20
+ codes.
14
21
15
22
This is how the plain ` pipe-pane ` log output looks like if you're using
16
23
terminal with coloring:
@@ -21,56 +28,63 @@ Garbled characters are called ANSI codes. They enable colors in terminal, but
21
28
are just making 'noise' in the textual log output.
22
29
23
30
A user will probably want to filter ANSI codes out of the log. Here's the same
24
- log as above when using ` tmux_ppp ` :
31
+ log as above when using this plugin:
32
+
33
+ ![ proper log output] ( /screenshots/proper_log_output.png )
34
+
35
+ ### 2. "Screen capture"
36
+
37
+ Key binding: ` prefix + alt + p ` <br />
38
+ Visible text in the current pane is saved to a file. Equivalent of a "texual
39
+ screenshot".
40
+
41
+ File path: ` $HOME ` <br />
42
+ File name: ` $HOME ` <br />
25
43
26
- ![ tmux_ppp log output ] ( /screenshots/tmux_ppp_log_output.png )
44
+ ### 3. Capture complete pane history
27
45
28
- ** 2. single key binding toggles logging start/stop**
46
+ Key binding: ` prefix + alt + shift + p ` <br />
47
+ Saves complete pane scrollback to a file. Convenient if you remember you need
48
+ the log of all the work retroactively.
29
49
30
- [ This post on stackexchange] ( http://unix.stackexchange.com/a/10259 ) describes
31
- how to setup key bindings for logging with ` pipe-pane ` . There are 2 options:
32
- - setup a single key binding that toggles logging.<br />
33
- Downside: a user doesn't know if the toggle key started or stopped logging.
34
- There's just the message ` Logging is toggled ` .
35
- - in order to properly setup messages for ` Starting ` and ` Ending ` logging, 2
36
- key bindings have to be used.<br />
37
- Downside: with so many Tmux key bindings, it is easily forgotten which key
38
- starts and which one ends logging.
50
+ NOTE: this functionality depends on the value of ` history-limit ` - it
51
+ determines the number of lines Tmux keeps in the scrollback buffer. Everything
52
+ that Tmux kept will also be saved to a file.
39
53
40
- ` tmux_ppp ` solves above inconveniences by enabling :
41
- - a single key binding that toggles ` pipe-pane ` logging.
42
- - proper notifications, so it's clear whether the logging was started or
43
- stopped when a key was pressed.
54
+ With modern computers it is safe to set this option to a high number :
55
+
56
+ # in .tmux.conf
57
+ set -g history-limit 50000
44
58
45
59
### Installation with [ Tmux Plugin Manager] ( https://github.com/bruno-/tpm ) (recommended)
46
60
47
61
Add plugin to the list of TPM plugins in ` .tmux.conf ` :
48
62
49
- set -g @tpm_plugins " \
50
- bruno-/tpm \
51
- bruno-/tmux_ppp \
63
+ set -g @tpm_plugins " \
64
+ bruno-/tpm \
65
+ bruno-/tmux_logging \
52
66
"
53
67
54
68
Hit ` prefix + I ` to fetch the plugin and source it.
55
69
56
- You should now have ` tmux_ppp ` key binding defined.
70
+ You should now have all ` tmux_logging ` key bindings defined.
57
71
58
72
### Manual Installation
59
73
60
74
Clone the repo:
61
75
62
- $ git clone https://github.com/bruno-/tmux_ppp ~/clone/path
76
+ $ git clone https://github.com/bruno-/tmux_logging ~/clone/path
63
77
64
78
Add this line to the bottom of ` .tmux.conf ` :
65
79
66
- run-shell ~/clone/path/proper_pipe_pane .tmux
80
+ run-shell ~/clone/path/logging .tmux
67
81
68
82
Reload TMUX environment:
69
83
70
84
# type this in terminal
71
85
$ tmux source-file ~/.tmux.conf
72
86
73
- You should now have ` tmux_ppp ` key binding defined.
87
+ You should now have all ` tmux_logging ` key bindings defined.
74
88
75
89
### Installing ` ansifilter ` (recommended for OSX users)
76
90
@@ -80,39 +94,14 @@ is a program specialized for removing (or working with) ANSI codes.
80
94
If you're on OSX, it is recommened to install ` ansifilter ` :
81
95
` $ brew install ansifilter `
82
96
83
- If you're on Linux (or don't have ` ansifilter ` installed), ` tmux_ppp ` removes
84
- ANSI codes with ` sed ` regexes. That should work fine, but please
85
- [ open an issue] ( https://github.com/bruno-/tmux_ppp/issues ) if you find a
86
- problem.
87
-
88
- ### Usage
89
-
90
- This plugin defines ` prefix + P ` key binding (note, that is uppercase ` P ` ).
91
-
92
- Press ` prefix + P ` to start logging. Message is show with the path to log file:
93
-
94
- Started logging to /Users/bruno/tmux-ppp-0-1-20140526T141437.log
95
-
96
- To end logging, also press ` prefix + P ` . You'll get a notification:
97
-
98
- Ended logging to /Users/bruno/tmux-ppp-0-1-20140526T141608.log
99
-
100
- ### Log file name
101
-
102
- New logs are created in ` $HOME ` directory by default.
103
-
104
- Log file name tries hard to be 'unique'. A user can log all panes in all
105
- sessions in tmux simultaneously without having log file conflicts.
106
-
107
- For better understanding, here's the file name "template":
108
-
109
- "tmux-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log"
97
+ It helps with removing ANSI codes from the log. If ` ansifilter ` is not present,
98
+ ANSI codes are removed with ` sed ` .
110
99
111
100
### Credits
112
101
113
102
Thanks to Chris Johnsen for providing
114
103
[ this answer on stackexchange] ( http://unix.stackexchange.com/a/10259 ) .
115
- ` tmux_ppp ` is based on insights from that post .
104
+ This plugin started as an improvement of bindings from that answer .
116
105
117
106
### License
118
107
0 commit comments