• Stars
    star
    1,034
  • Rank 44,573 (Top 0.9 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 10 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easy logging and screen capturing for Tmux.

Tmux Logging

Features:

  1. 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. Convenient for keeping track of your work.
  2. Current pane "Screen Capture"
    All the text visible in the current pane is saved to a file. Like a screenshot, but textual.
  3. Save a complete history of current pane
    Everything that has been typed and all the output since the creation of the current pane can be saved to a file.
  4. Clear pane history with prefix + alt + c

Tested and working on Linux, OSX and Cygwin.

1. Logging

Toggle (start/stop) logging in the current pane.

  • Key binding: prefix + shift + p
  • File name format: tmux-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log
  • File path: $HOME (user home dir)
    • Example file: ~/tmux-my-session-0-1-20140527T165614.log

2. "Screen Capture"

Save visible text, in the current pane. Equivalent of a "textual screenshot".

  • Key binding: prefix + alt + p
  • File name format: tmux-screen-capture-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log
  • File path: $HOME (user home dir)
    • Example file: tmux-screen-capture-my-session-0-1-20140527T165614.log

3. Save complete history

Save complete pane history to a file. Convenient if you retroactively remember you need to log/save all the work.

  • Key binding: prefix + alt + shift + p
  • File name format: tmux-history-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log
  • File path: $HOME (user home dir)
    • Example file: tmux-history-my-session-0-1-20140527T165614.log

NOTE: this functionality depends on the value of history-limit - the number of lines Tmux keeps in the scrollback buffer. Only what Tmux kept will also be saved, to a file.

Use set -g history-limit 50000 in .tmux.conf, with modern computers it is ok to set this option to a high number.

4. Clear pane history

Key binding: prefix + alt + c

This is just a convenience key binding.

Installation with Tmux Plugin Manager (recommended)

Add plugin to the list of TPM plugins in .tmux.conf:

set -g @plugin 'tmux-plugins/tmux-logging'

Hit prefix + I to fetch the plugin and source it.

You should now have all tmux-logging key bindings defined.

Manual Installation

Clone the repo:

$ git clone https://github.com/tmux-plugins/tmux-logging ~/clone/path

Add this line to the bottom of .tmux.conf:

run-shell ~/clone/path/logging.tmux

Reload TMUX environment:

# type this in terminal
$ tmux source-file ~/.tmux.conf

You should now have all tmux-logging key bindings defined.

Installing ansifilter (recommended for OSX users)

If you're on OSX, it is recommended to install ansifilter: $ brew install ansifilter

ansifilter is a program specialized for removing (or working with) ANSI codes.

It helps with removing ANSI codes from the log. If ansifilter is not present, ANSI codes are removed with sed.

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:

garbled log output

Garbled characters are called ANSI codes. They enable colors in terminal, but are just making 'noise' in the textual log output.

A user will probably want to filter ANSI codes out of the log. Here's the same log as above when this plugin is used:

proper log output

Configuration Docs

Other plugins

You might also find these useful:

  • resurrect - restore tmux environment after system restart
  • pain control - useful standard bindings for controlling panes
  • sessionist - lightweight tmux utils for switching and creating sessions

License

MIT

More Repositories

1

tpm

Tmux Plugin Manager
Shell
12,082
star
2

tmux-resurrect

Persists tmux environment across system restarts.
Shell
11,249
star
3

tmux-continuum

Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on.
Shell
3,263
star
4

tmux-yank

Tmux plugin for copying to system clipboard. Works on OSX, Linux and Cygwin.
Shell
2,682
star
5

tmux-sensible

basic tmux settings everyone can agree on
Shell
1,756
star
6

list

A list of tmux plugins.
1,201
star
7

tmux-copycat

A plugin that enhances tmux search
Shell
1,103
star
8

tmux-pain-control

standard pane key-bindings for tmux
Shell
755
star
9

tmux-open

Tmux key bindings for quick opening of a highlighted file or url
Shell
631
star
10

tmux-prefix-highlight

Plugin that highlights when you press tmux prefix key
Shell
571
star
11

tmux-sidebar

A sidebar with the directory tree for the current path. Tries to make tmux more IDE like.
Shell
536
star
12

tmux-battery

Plug and play battery percentage and icon indicator for Tmux.
Shell
499
star
13

tmux-cpu

Plug and play cpu percentage and icon indicator for Tmux.
Shell
433
star
14

tmux-sessionist

Lightweight tmux utils for manipulating sessions
Shell
412
star
15

vim-tmux-focus-events

Make terminal vim and tmux work better together.
Vim Script
348
star
16

vim-tmux

vim plugin for tmux.conf
Vim Script
333
star
17

tmux-fpp

Quickly open any path on your terminal window in your $EDITOR of choice!
Shell
308
star
18

tmux-urlview

Quickly open any url on your terminal window!
Shell
266
star
19

tmux-online-status

Tmux plugin that displays online status of your computer.
Shell
169
star
20

tmux-example-plugin

Example Tmux plugin that actually demonstrates how to build plugins for Tmux. The accompanying tutorial is here: https://github.com/tmux-plugins/tpm/blob/master/HOW_TO_PLUGIN.md
Shell
45
star
21

tmux-cowboy

Kill hanging processes fast
Shell
37
star
22

tmux-maildir-counter

Plugin that counts files on a specific mail directory
Shell
32
star
23

tmux-test

A small framework for isolated testing of tmux plugins.
Shell
16
star
24

language-tmux

Atom language support for Tmux config file
CoffeeScript
10
star
25

tmux-newsboat

Display newsboat counters in tmux status line.
Shell
10
star