diff --git a/README.md b/README.md index 2292363..d58b485 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,29 @@ # Tmux Logging Features: -1. Logging of all output in the current pane
+ +1. Enables logging of all output in the current pane
After you start logging, everything that's typed and all the output will be - saved to a file. + saved to a file. Convenient for keeping track of your work. 2. Enables "screen capture" of the current pane
All the text visible in the current pane is saved to a file. Like a screenshot, but textual. 3. Enables saving a complete history of the current pane
- All that has been typed and all the output since the creation of the current - pane is saved to a file. + Everything that has been typed and all the output since the creation of the + current pane can be saved to a file. ### 1. Logging Key binding: `prefix + shift + p`
+File path: `$HOME` (user home dir)
+File name template: + + tmux-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log + Toggles (start/stop) logging in the current pane. -Logging improves the default `pipe-pane` logging mechanism by stripping ANSI -codes. +This feature improves the default `pipe-pane` logging mechanism by stripping +ANSI codes. This is how the plain `pipe-pane` log output looks like if you're using terminal with coloring: @@ -35,23 +41,30 @@ log as above when using this plugin: ### 2. "Screen capture" Key binding: `prefix + alt + p`
+File path: `$HOME` (user home dir)
+File name template: + + tmux-screen-capture-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log + Visible text in the current pane is saved to a file. Equivalent of a "texual screenshot". -File path: `$HOME`
-File name: `$HOME`
- -### 3. Capture complete pane history +### 3. Save complete history Key binding: `prefix + alt + shift + p`
-Saves complete pane scrollback to a file. Convenient if you remember you need -the log of all the work retroactively. +File path: `$HOME` (user home dir)
+File name template: -NOTE: this functionality depends on the value of `history-limit` - it + tmux-history-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log + +Saves complete pane history to a file. Convenient if you retroactively remember +you need to log/save all the work. + +**NOTE**: this functionality depends on the value of `history-limit` - it determines the number of lines Tmux keeps in the scrollback buffer. Everything -that Tmux kept will also be saved to a file. +Tmux kept will also be saved to a file. -With modern computers it is safe to set this option to a high number: +With modern computers it is ok to set this option to a high number: # in .tmux.conf set -g history-limit 50000 @@ -97,12 +110,6 @@ If you're on OSX, it is recommened to install `ansifilter`: It helps with removing ANSI codes from the log. If `ansifilter` is not present, ANSI codes are removed with `sed`. -### Credits - -Thanks to Chris Johnsen for providing -[this answer on stackexchange](http://unix.stackexchange.com/a/10259). -This plugin started as an improvement of bindings from that answer. - ### License [MIT](LICENSE.md) diff --git a/scripts/capture_pane_helpers.sh b/scripts/capture_pane_helpers.sh index a58f0c3..985f867 100644 --- a/scripts/capture_pane_helpers.sh +++ b/scripts/capture_pane_helpers.sh @@ -17,10 +17,10 @@ get_filename() { capture_pane() { local file="$(get_path)/$(get_filename)" local capture_scope=$1 - if [ $capture_scope == "Scrollback" ]; then + if [ $capture_scope == "History" ]; then # copying 9M lines back will hopefully fetch the whole scrollback tmux capture-pane -S -9000000 - elif [ $capture_scope == "Screenshot" ]; then + elif [[ $capture_scope == "Screen capture" ]]; then tmux capture-pane else # error diff --git a/scripts/tmux_pane_screenshot.sh b/scripts/tmux_pane_screenshot.sh index ef64cce..5393095 100755 --- a/scripts/tmux_pane_screenshot.sh +++ b/scripts/tmux_pane_screenshot.sh @@ -4,7 +4,7 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Functions defined in capture_pane_helpers are customized via below variables. default_path="$HOME" -default_name="tmux-screenshot-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log" +default_name="tmux-screen-capture-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log" path_option="@screenshot_path" name_option="@screenshot_filename" @@ -13,6 +13,6 @@ source $CURRENT_DIR/shared.sh source $CURRENT_DIR/capture_pane_helpers.sh main() { - capture_pane "Screenshot" + capture_pane "Screen capture" } main diff --git a/scripts/tmux_scrollback_dump.sh b/scripts/tmux_scrollback_dump.sh index 04bb3fb..ed15f85 100755 --- a/scripts/tmux_scrollback_dump.sh +++ b/scripts/tmux_scrollback_dump.sh @@ -4,7 +4,7 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Functions defined in capture_pane_helpers are customized via below variables. default_path="$HOME" -default_name="tmux-scrollback-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log" +default_name="tmux-history-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log" path_option="@scrollback_dump_path" name_option="@scrollback_dump_filename" @@ -13,6 +13,6 @@ source $CURRENT_DIR/shared.sh source $CURRENT_DIR/capture_pane_helpers.sh main() { - capture_pane "Scrollback" + capture_pane "History" } main