forked from tmux-plugins/tmux-logging
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…to automatically turn on logging for new panes
- Loading branch information
Showing
6 changed files
with
108 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# Custom configuration | ||
|
||
The default logging path is `$HOME` To change that, add `set -g @logging-path "path"` to `.tmux.conf` file | ||
The default logging path is `$HOME` | ||
To change that, add `set -g @logging-path "path"` to `.tmux.conf` file. | ||
|
||
The default behaviour is to not start logging with any new session. | ||
You can control this behaviour by adding | ||
`set -g @toggle-logging-at-startup "true"` to `.tmux.conf` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
# path to log file - global variable | ||
FILE="$1" | ||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
ansifilter_installed() { | ||
type ansifilter >/dev/null 2>&1 || return 1 | ||
} | ||
|
||
system_osx() { | ||
[ $(uname) == "Darwin" ] | ||
} | ||
|
||
pipe_pane_ansifilter() { | ||
tmux pipe-pane "exec cat - | ansifilter >> $FILE" | ||
} | ||
|
||
pipe_pane_sed_osx() { | ||
# Warning, very complex regex ahead. | ||
# Some characters below might not be visible from github web view. | ||
local ansi_codes_osx="(\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]||]0;[^]+|[[:space:]]+$)" | ||
tmux pipe-pane "exec cat - | sed -E \"s/$ansi_codes_osx//g\" >> $FILE" | ||
} | ||
|
||
pipe_pane_sed() { | ||
local ansi_codes="(\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]|)" | ||
tmux pipe-pane "exec cat - | sed -r 's/$ansi_codes//g' >> $FILE" | ||
} | ||
|
||
start_pipe_pane() { | ||
if ansifilter_installed; then | ||
pipe_pane_ansifilter | ||
elif system_osx; then | ||
# OSX uses sed '-E' flag and a slightly different regex | ||
pipe_pane_sed_osx | ||
else | ||
pipe_pane_sed | ||
fi | ||
} | ||
source "$CURRENT_DIR/variables.sh" | ||
source "$CURRENT_DIR/shared.sh" | ||
|
||
main() { | ||
start_pipe_pane | ||
if supported_tmux_version_ok; then | ||
start_pipe_pane | ||
fi | ||
} | ||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters