From 9fb8c8275a3b133a19e602e27b3cf3281302d852 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 11 Apr 2017 08:19:07 -0500 Subject: [PATCH 01/28] tweaks for shell command output --- manuscript/09-status-bar.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/manuscript/09-status-bar.md b/manuscript/09-status-bar.md index 0527679..f0dbcd0 100644 --- a/manuscript/09-status-bar.md +++ b/manuscript/09-status-bar.md @@ -52,16 +52,16 @@ You can also call applications, such as [tmux-mem-cpu-load](https://github.com/t [conky](https://github.com/brndnmtthws/conky), and [powerline](#powerline). For this example, we'll use `tmux-mem-cpu-load`. This works on Unix-like systems -like FreeBSD, Linux distributions as well as macOS. +like FreeBSD, Linux distributions, and macOS. -It requires installing [CMake](https://cmake.org) and `git` through your package -manager. You must have a C++ compiler. On macOS, install Xcode CLI Utilities. -You can do this by going to Applications -> Utilities, launching Terminal.app -and typing `$ xcode-select --install`. macOS can use [Homebrew](https://brew.sh/) -to install the CMake and git package. Linux distributions allow installing -CMake, clang and git via package manager. +To build from source, you must have [CMake](https://cmake.org) and `git`, which +are available through your package manager. You must have a C++ compiler. On +macOS, install Xcode CLI Utilities. You can do this by going to *Applications -> +Utilities*, launching *Terminal.app* and typing `$ xcode-select --install`. +macOS can use [Homebrew](https://brew.sh/) to install the CMake and git package. +Linux distributions allow installing CMake, clang and git via package manager. -Before this step, you can `cd` into any directory you're ok keep code in. +Before this step, you can `cd` into any directory you're ok keeping code in. {language=shell, line-numbers=off} $ git clone https://github.com/thewtex/tmux-mem-cpu-load.git From ad7d2a8d56b3829ebaa4aadd869599630d205ad7 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 11 Apr 2017 08:22:31 -0500 Subject: [PATCH 02/28] tweaks to configuration --- manuscript/08-configuration.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manuscript/08-configuration.md b/manuscript/08-configuration.md index 7ffc64b..a69a0bc 100644 --- a/manuscript/08-configuration.md +++ b/manuscript/08-configuration.md @@ -15,7 +15,7 @@ the server is started. tmux is configured using the same commands as tmux does v shell. For instance, `$ tmux set-window-option -g automatic-rename` in a shell is the same as `set-window-option -g automatic-rename` in your config. -Configuration can be updated later via `source-file`, which is discussed in +Configuration can be reloaded later via `source-file`, which is discussed in this chapter. For a sample config, I maintain a pretty decked out one at @@ -71,6 +71,9 @@ I> `bind r source ~/.tmux.conf\; display "~/.tmux.conf sourced!"` I> I> Now, you can type `Prefix` + `r` to get the config to reload. +Note that reloading the configuration only *re-runs* the configuration file. It +will not reset keybindings or styling you apply to tmux. + ## How configs work The tmux configuration is processed just like [run commands](https://en.wikipedia.org/wiki/Run_commands) From 96aa8419694d00eb18d9dc54ca3a1093ee95d1d9 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 11 Apr 2017 08:27:52 -0500 Subject: [PATCH 03/28] another tweak for configuration --- manuscript/08-configuration.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/manuscript/08-configuration.md b/manuscript/08-configuration.md index a69a0bc..62300bb 100644 --- a/manuscript/08-configuration.md +++ b/manuscript/08-configuration.md @@ -10,13 +10,9 @@ Configuration of tmux is managed through `.tmux.conf` in your `$HOME` directory. The paths `~/.tmux.conf` and `$HOME/.tmux.conf` should work on OS X, Linux, and BSD. -Configuration is done via the file being run upon initially starting tmux, when -the server is started. tmux is configured using the same commands as tmux does via -shell. For instance, `$ tmux set-window-option -g automatic-rename` in a shell -is the same as `set-window-option -g automatic-rename` in your config. - -Configuration can be reloaded later via `source-file`, which is discussed in -this chapter. +Configuration is applied upon initially starting tmux. The contents of the +configuration are tmux commands. The file can be reloaded later via +`source-file`, which is discussed in this chapter. For a sample config, I maintain a pretty decked out one at . It's permissively licensed, and you're From 8ffc6a256cfbbeb0b025df8f2824e0cc9b7d1849 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 11 Apr 2017 08:31:39 -0500 Subject: [PATCH 04/28] more explanation for base index setting --- manuscript/08-configuration.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manuscript/08-configuration.md b/manuscript/08-configuration.md index 62300bb..ac58864 100644 --- a/manuscript/08-configuration.md +++ b/manuscript/08-configuration.md @@ -127,7 +127,9 @@ generic options, and the next section goes into snippets involving keybindings. ### Base index -Set the starting number (base index) for windows: +This was mentioned earlier in the book, but it's a favorite tweak of many tmux +users, who find it more intuitive to start their window counting at *1*, rather +than the default, *0*. To set the starting number (base index) for windows: {line-numbers=off} set -g base-index 1 From b6ec0ef9608de5659c8ea1d0b4119a71b667826e Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 11 Apr 2017 08:39:18 -0500 Subject: [PATCH 05/28] tweak for automatic renaming --- manuscript/08-configuration.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manuscript/08-configuration.md b/manuscript/08-configuration.md index ac58864..3979d6b 100644 --- a/manuscript/08-configuration.md +++ b/manuscript/08-configuration.md @@ -143,11 +143,14 @@ same thing. ### Automatic window naming -Windows can be automatically renamed via setting `automatic-rename`: +Setting `automatic-rename` alters the name of the window based upon its active +pane: {line-numbers=off} set-window-option -g automatic-rename +Automatic renaming will be disabled for the window if you rename it manually. + ## Keybindings ### Prefix key From 671cbcfe3cd7caa6d9ccbc83d38a8c20f8801fd1 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 11 Apr 2017 08:44:13 -0500 Subject: [PATCH 06/28] tweak notice on linux packages --- manuscript/09-status-bar.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/09-status-bar.md b/manuscript/09-status-bar.md index f0dbcd0..7a130c8 100644 --- a/manuscript/09-status-bar.md +++ b/manuscript/09-status-bar.md @@ -59,7 +59,7 @@ are available through your package manager. You must have a C++ compiler. On macOS, install Xcode CLI Utilities. You can do this by going to *Applications -> Utilities*, launching *Terminal.app* and typing `$ xcode-select --install`. macOS can use [Homebrew](https://brew.sh/) to install the CMake and git package. -Linux distributions allow installing CMake, clang and git via package manager. +Major Linux distributions package CMake, clang, and git. Before this step, you can `cd` into any directory you're ok keeping code in. From d8b5ea6ea54f9e0e9069c7353603c8ac63f0cd9c Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 11 Apr 2017 08:45:02 -0500 Subject: [PATCH 07/28] tweak title --- manuscript/08-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/08-configuration.md b/manuscript/08-configuration.md index 3979d6b..3d1c2bb 100644 --- a/manuscript/08-configuration.md +++ b/manuscript/08-configuration.md @@ -164,7 +164,7 @@ it by setting a new prefix and unsetting the default. To set the prefix to unbind-key C-b bind-key a send-prefix -### New window w/ prompt +### New window with prompt Prompt for window name upon creating a new window, `Prefix` + `C` (capital C): From acf547d29842ca29bf127a26f14626be600d4cf6 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 11 Apr 2017 08:46:10 -0500 Subject: [PATCH 08/28] tweak --- manuscript/09-status-bar.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/09-status-bar.md b/manuscript/09-status-bar.md index 7a130c8..61cc440 100644 --- a/manuscript/09-status-bar.md +++ b/manuscript/09-status-bar.md @@ -109,7 +109,7 @@ tmux session via `$ tmux set-option -g status-right`: $ tmux set-option -g status-right '"#{=21:pane_title}" #(tmux-mem-cpu-load) %H:%M %d-%b-%y' Also, note how I switched out the double quotes on either side of the option -with single quotes. This is recommended, since there are double quotes inside. +with single quotes. This is required, since there are double quotes inside. You can do this with anything, for instance, try adding [`uptime`](https://linux.die.net/man/1/uptime). This could be done by adding `#(uptime)` to your status line. Typically the From c20dea61ca4edb2d94672b0951c4fd2de9c1a1a9 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 11 Apr 2017 10:29:17 -0500 Subject: [PATCH 09/28] add mention of Graziano Misuraca --- manuscript/00-foreword.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/manuscript/00-foreword.md b/manuscript/00-foreword.md index 51c917a..1d19848 100644 --- a/manuscript/00-foreword.md +++ b/manuscript/00-foreword.md @@ -172,8 +172,10 @@ I will update digital versions of the book with the changes where applicable. ## Thanks -Thanks to the [contributors](https://github.com/git-pull/tao-of-tmux/graphs/contributors), -who helped me spot errors in this book. +Thanks to the [contributors](https://github.com/git-pull/tao-of-tmux/graphs/contributors) +for spotting errors in this book and submitting errata through GitHub. In +addition, readers like Graziano Misuraca, who looked through the book closely, +providing valuable feedback. Some copy, particularly in [cheatsheets](#appendix-cheatsheets), comes straight out of the manual of tmux, which is [ISC-licensed](https://github.com/tmux/tmux/blob/master/COPYING). From c66a3adf89706da5ee373d90355bf035feb0c060 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 11 Apr 2017 18:06:05 -0500 Subject: [PATCH 10/28] big boat load of fixes --- manuscript/04-server.md | 2 +- manuscript/10-scripting.md | 29 +++++++++++++++-------------- manuscript/11-tips-and-tricks.md | 20 ++++++++++---------- manuscript/12-takeaway.md | 14 +++++++------- 4 files changed, 33 insertions(+), 32 deletions(-) diff --git a/manuscript/04-server.md b/manuscript/04-server.md index a8ec75b..e56d6c7 100644 --- a/manuscript/04-server.md +++ b/manuscript/04-server.md @@ -115,7 +115,7 @@ sessions, windows, and panes. Much like vi, tmux handles copying as a mode in which a pane is temporarily placed. When inside this mode, text can be selected and copied to -the *paste buffer*, tmux' clipboard. +the *paste buffer*, tmux's clipboard. The default key to enter copy mode is `Prefix` + `[`. diff --git a/manuscript/10-scripting.md b/manuscript/10-scripting.md index 01af704..c8f3e56 100644 --- a/manuscript/10-scripting.md +++ b/manuscript/10-scripting.md @@ -10,7 +10,7 @@ people's flows. Full tables are in the [cheatsheets](#appendix-cheatsheets). ## Aliases {#aliases} tmux supports a variety of alias commands. With aliases, instead of typing -`tmux attach-session` to attach a session, `$ tmux attach` could do the trick. +`$ tmux attach-session` to attach a session, `$ tmux attach` could do the trick. Most aliases come to mind via intuition and are a lot friendlier than typing the full hyphenated commands. @@ -69,7 +69,7 @@ patterns. For instance, you need not type `$ tmux attach-session` every time. First, there's the [alias](#aliases) of `$ tmux attach`, but additionally, more concise commands can be used if they partially match the name of the command or -the target. tmux' pattern matching allows `$ tmux attac`, `$ tmux att`, `$ tmux at` +the target. tmux's pattern matching allows `$ tmux attac`, `$ tmux att`, `$ tmux at` and `$ tmux a` to reach `$ tmux attach`. Every tmux command has shorthands; let's try this for `$ tmux new-session`: @@ -253,7 +253,7 @@ Let's try to output it: $ tmux list-windows -F "#{window_id} #{window_name}" > @0 zsh -Here's a cool trick; list all panes with the x and y coordinates of the cursor +Here's a cool trick to list all panes with the x and y coordinates of the cursor position: {language=shell, line-numbers=off} @@ -282,7 +282,7 @@ Pane variables: `cursor_x`, `cursor_y`, `pane_active`, `pane_current_command`, This book focuses on separating the concept of server, sessions, windows, and panes. With the knowledge of targets and formats, this -separation takes shape in tmux' internal attributes. If you `list-panes` all +separation takes shape in tmux's internal attributes. If you `list-panes` all variables up the ladder, including window, session and server variables are available for the panes being listed. Try this: @@ -403,10 +403,10 @@ Output of cal(1).](images/10-scripting/send-keys-cal.png) `$ tmux capture-pane` will copy a panes' contents. -By default, the contents will be saved to tmux' internal clipboard, the *paste +By default, the contents will be saved to tmux's internal clipboard, the *paste buffer*. You can run `capture-pane` within any pane, then navigate to an editor, paste the contents (don't forget to `:set paste` and go into insert mode -with `i` on vim), and save it to a file. To [paste](#clipbpard), use `Prefix` + +with `i` in vim), and save it to a file. To [paste](#clipboard), use `Prefix` + `]` inside the pane you're pasting into. You can also add the `-p` flag to print it to [stdout](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_.28stdout.29). @@ -429,7 +429,7 @@ To check what's inside: $ cat ./test Like with `send-keys`, [targets](#targets) can be specified with `-t`. Let's -copy a pane into tmux' clipboard ("paste buffer") and paste it into a text +copy a pane into tmux's clipboard ("paste buffer") and paste it into a text editor in a third pane: ![Top-left: Listing panes, Bottom-left: Capturing pane output of top-left pane, @@ -446,10 +446,10 @@ a powerful way of retrieving information on its objects between `list-panes`, `list-windows` and `list-sessions` and formats. This makes tmux not only accessible and configurable, but also scriptable. -The ability to target information explicitly and reliably down to the point of -tracking a pane by its ID and collecting its pane contents, even sending in -keys. Used by the skilled programmer, opening the possibility of orchestrating -the terminals in ways that were previously unrealistic; anything from niche +The ability to retrieve explicitly and reliably, from session the sesson down to +a pane. All it takes is a pane's ID to capture its contents or even send it +keys. Used by the skilled programmer, scripting tmux can facilitate orchestrating +terminals in ways previously deemed unrealistic; anything from niche shell scripts to monitor and react to behavior on systems to high-level, intelligent and structured control via object oriented libraries, like [libtmux](https://libtmux.git-pull.com). @@ -458,6 +458,7 @@ In the next chapter, we delve into optimizations that showcase the latest generation of unix tools that build upon old, time-tested concepts, like [man pages](https://en.wikipedia.org/wiki/Man_page) and [piping](https://en.wikipedia.org/wiki/Pipeline_(Unix)), while maintaining portability across differences in platforms and graceful degradation to ensure -development tooling works on machines missing optional tools. In addition, a -class of powerful, high-level applications that leverage tmux' scripting -capabilities to consistently build tmux workspace via declarative configurations. +development tooling works on machines missing optional tools. Also, the chapter +will introduce *session managers*, a powerful, high-level tool leveraging tmux's +scripting capabilities to consistently load workspace via a declarative +configuration. diff --git a/manuscript/11-tips-and-tricks.md b/manuscript/11-tips-and-tricks.md index 8dbc828..f6c8f8c 100644 --- a/manuscript/11-tips-and-tricks.md +++ b/manuscript/11-tips-and-tricks.md @@ -2,9 +2,9 @@ ## Read the tmux manual in style -`$ man tmux` is the command to load up the "[man page](https://en.wikipedia.org/wiki/Man_page)" -for tmux. You can do the same to find instructions for any command or entity -with a manpage entry; here's two fun ones: +`$ man tmux` is the command to load up the man page for tmux. You can do the +same to find instructions for any command or entity with a manpage entry; here +are some fun ones: {language=shell, line-numbers=off} $ man less @@ -127,7 +127,7 @@ snippet in conjunction with a [session manager](#session-manager): entr -c go test ./...; else go test ./...; fi If the project is a team or open source project, where a user never used the -command before and could missing a required software package, we can give +command before and could be missing a required software package, we can give a helpful message. This shows a notice to the user to install entr if not installed on the system: @@ -225,7 +225,7 @@ panes in a certain order. In addition, there's the burden of assuring the shell scripts are portable. A declarative configuration in YAML or JSON configuration abstracts out the -commands, layout, and options of tmux. It'd prevent the mistakes and repetition +commands, layout, and options of tmux. It prevents the mistakes and repetition scripting entails. These applications are called tmux *session managers*, and in different ways, they programmatically create tmux workspaces by running a series of commands based on a config. @@ -237,8 +237,8 @@ Ruby. There's also [tmuxomatic](https://github.com/oxidane/tmuxomatic), where you can "draw" your tmux sessions in text and have tmuxomatic build the layout. I sort of have a home team advantage here, as I'm author of [tmuxp](https://github.com/tony/tmuxp). -I wrote it, already having used teamocil and tmuxinator, but with many more -features. For one, it builds on top of [libtmux](https://github.com/tony/libtmux), +Already having used teamocil and tmuxinator, I wrote my own in python instead of +ruby, with many more features. For one, it builds on top of [libtmux](https://github.com/tony/libtmux), a library which abstracts tmux [server](#server), [sessions](#sessions), [windows](#windows) and [panes](#panes) to build the state of tmux sessions. In addition, it has a naive form of session freezing, support for JSON, more @@ -284,10 +284,10 @@ paths](#troubleshoot-site-paths) in the appendix. I've dusted off a C++ space shooter and a new go webapp I've been playing with. They're licensed under MIT so, you can use them, copy and paste from them, etc: -- c++14 [space shooter minigame](https://github.com/tony/tot-cpp-shmup) - side +- C++14 [space shooter minigame](https://github.com/tony/tot-cpp-shmup) - side scrolling [shmup](https://en.wikipedia.org/wiki/Shoot_'em_up) demo (sdl2, - cmake, json resource manifests, linux/BSD/OS X compatible) -- golang [tmux web frontend](https://github.com/tony/tot-go-webapp) - display + cmake, json resource manifests, Linux/BSD/OS X compatible) +- Go [tmux web frontend](https://github.com/tony/tot-go-webapp) - display current tmux session and window information via browser ([gin](https://github.com/gin-gonic/gin), [bower](https://bower.io/)) diff --git a/manuscript/12-takeaway.md b/manuscript/12-takeaway.md index f0c2d8a..044d844 100644 --- a/manuscript/12-takeaway.md +++ b/manuscript/12-takeaway.md @@ -6,19 +6,19 @@ your brain around concepts. You do not have to understand the intricacies of tmux, let alone the terminal, in a single sitting. Acclimation happens over time. -tmux' userbase varies in skill level. Some readers of this book may have just -learned how to use the Prefix key yesterday. Others are looking to tweak their +tmux's userbase varies in skill level. Some readers of this book may have just +learned how to use the `Prefix` key yesterday. Others are looking to tweak their configurations and host it in their "dot files" on github. There also exists a -very clever hacker, who utilizes the advanced scripting capabilities tmux +very clever hacker who utilizes the advanced scripting capabilities tmux offers to pilot the terminal in ways previously thought impossible. We've covered the [server](#server), [session](#sessions), [window](#windows), -and [pane](#panes) concepts. Panes are shells, aka pseudoterminals or -PTYs. The command system. That [configurations](#config) are basically a file +and [pane](#panes) concepts. Panes are shells, AKA pseudoterminals or +PTYs. The command system. That [configuration](#config) is basically a file filled with commands. An overview of the [target](#targets) system lets you specify objects to interact with tmux commands. A breeze through [formats](#formats), -a template system with variables to retrieve information on tmux' current state. -How to [send keystrokes](#send-keys) and [copy from tmux panes](#capture-pane) +a template system with variables to retrieve information on tmux's current +state. How to [send keystrokes](#send-keys) and [copy from tmux panes](#capture-pane) programmatically. A lot of [terminal tricks](#tips-and-tricks) that work across platforms and well with tmux, including a [file watching workflow](#file-watching) to run linting, testing, and build commands on file changes. [Two permissively licensed open source projects](#example-projects) From 874852a2e4481696f0d851cb76e76fb1a2db6620 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 12 Apr 2017 20:02:38 -0500 Subject: [PATCH 11/28] tweak --- manuscript/01-thinking-tmux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manuscript/01-thinking-tmux.md b/manuscript/01-thinking-tmux.md index 3ef431a..7bd243f 100644 --- a/manuscript/01-thinking-tmux.md +++ b/manuscript/01-thinking-tmux.md @@ -55,7 +55,7 @@ a display server such as [X](https://en.wikipedia.org/wiki/X.Org_Server). Here are a few common scenarios: -- Running `tail -F /var/log/apache2/error.log` in a +- Running `$ tail -F /var/log/apache2/error.log` in a pane to get a live stream of the latest system events. - Running a file watcher, like [watchman](https://github.com/facebook/watchman), [gulp-watch](https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulpwatchglob-opts-tasks), @@ -72,7 +72,7 @@ Here are a few common scenarios: while leaving two others open for CLI commands and building via `make` or `ninja`. -![vim + building a C++ project w/ CMake + Ninja using entr to rebuild on file changes, lldb bottom right](images/01-thinking-tmux/dev-watch.png) +![vim + building a C++ project w/ CMake + Ninja using entr to rebuild on file changes, LLDB bottom right](images/01-thinking-tmux/dev-watch.png) With tmux, you quickly have the makings of an IDE! And on your terms. From 4d57486a42ee8faf467814e8d911ab2d3a126b92 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 12 Apr 2017 20:26:57 -0500 Subject: [PATCH 12/28] tweak --- manuscript/02-terminal-fundamentals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/02-terminal-fundamentals.md b/manuscript/02-terminal-fundamentals.md index deb8d2e..663c6a3 100644 --- a/manuscript/02-terminal-fundamentals.md +++ b/manuscript/02-terminal-fundamentals.md @@ -5,7 +5,7 @@ reviewed. Often, we're so used to using these out of street smarts and muscle memory, a great deal of us never see the relation of where these tools stand next to each other. -Seasoned developers are familiar with zsh, Bash, iTerm2, konsole, /dev/tty, +Seasoned developers are familiar with Zsh, Bash, iTerm2, konsole, /dev/tty, shell scripting, and so on. If you use tmux, you'll be around these all the time, regardless whether you're in a GUI on a local machine or SSH'ing into a remote server. From f88facbd5f69eff52a9f4ebbffd41e64b6caaaaa Mon Sep 17 00:00:00 2001 From: Guido Kraemer Date: Sat, 4 Nov 2017 20:09:46 +0100 Subject: [PATCH 13/28] ctrl+b -> ctrl-b --- manuscript/03-practical-usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/03-practical-usage.md b/manuscript/03-practical-usage.md index a982cd8..af1eed0 100644 --- a/manuscript/03-practical-usage.md +++ b/manuscript/03-practical-usage.md @@ -80,7 +80,7 @@ in one of your panes, on the remote machine, you can attach the client via `tmux attach` as you normally would. To send the prefix key to the machine's tmux client, not your local one, hit the prefix key again. -So, if your prefix key is the default, ``, do `` + `b` again, +So, if your prefix key is the default, ``, do `` + `b` again, *then* hit the shortcut for what you want to do. Example: If you wanted to create a window on the remote machine, which would normally From 703cb3790b3dfe365d9a733bedaca1e3db06f951 Mon Sep 17 00:00:00 2001 From: Guido Kraemer Date: Sat, 4 Nov 2017 20:11:10 +0100 Subject: [PATCH 14/28] ctrl-B -> ctrl-b --- manuscript/03-practical-usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/03-practical-usage.md b/manuscript/03-practical-usage.md index a982cd8..8ad4f75 100644 --- a/manuscript/03-practical-usage.md +++ b/manuscript/03-practical-usage.md @@ -87,7 +87,7 @@ Example: If you wanted to create a window on the remote machine, which would nor be `` + `c` locally, it'd be `` + `b` + `c`. Hereinafter, the book will refer to shortcuts by `Prefix`. Instead -of ` + d`, you will see `Prefix` + `d`. +of ` + d`, you will see `Prefix` + `d`. ## Session persistence and the server model From 7625091cf229bc65691e87ab67eb5608068c3e3c Mon Sep 17 00:00:00 2001 From: Pierre-Luc Perrier Date: Thu, 25 Jan 2018 21:42:56 +0100 Subject: [PATCH 15/28] ctrl+b -> ctrl-b --- manuscript/00-foreword.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/00-foreword.md b/manuscript/00-foreword.md index 1d19848..5d9e2bc 100644 --- a/manuscript/00-foreword.md +++ b/manuscript/00-foreword.md @@ -81,7 +81,7 @@ on Super User. In tmux, shortcuts require a [prefix key](#prefix-key) to be sent beforehand. For instance, `Prefix` + `d` will detach a tmux client from its session. This -prefix, by default, is `Ctrl-B`, but users can override it. This is discussed in +prefix, by default, is ``, but users can override it. This is discussed in greater detail in *the prefix key* section and [*configuration*](#config). ## How this book is structured From 0e47b7b49fc492caf4778a3223e96637dfecb053 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Perrier Date: Thu, 25 Jan 2018 22:03:30 +0100 Subject: [PATCH 16/28] Fix image captions --- manuscript/05-session.md | 8 ++++---- manuscript/06-window.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/manuscript/05-session.md b/manuscript/05-session.md index d808b6a..4d8175d 100644 --- a/manuscript/05-session.md +++ b/manuscript/05-session.md @@ -5,7 +5,7 @@ instance. Server instances are forked to the background upon starting a fresh instance and reconnected to when reattaching sessions. Your interaction with tmux will have *at least* one session running. -A session holds one or more [windows](#windows). +A session holds one or more [windows](#windows). ![](images/info/session.png) @@ -66,12 +66,12 @@ You can name it whatever you want. Typically, if I'm working on multiple web projects in one session, I'll name it "web". If I'm assigning one software project to a single session, I'll name it after the software project. You'll likely develop your own naming conventions, but anything is more descriptive -than the default. +than the default. -![Renaming a session 'zsh' to 'renamed'](images/05-session/rename.png) +![Renaming a session '0' to 'react web'](images/05-session/rename.png) If you don't name your sessions, it'll be difficult to keep track of what the -session contains. Sometimes, you may forget you have a project opened, +session contains. Sometimes, you may forget you have a project opened, especially if your machine has been running for a few days, weeks, or months. You can save time by reattaching your session and avoid creating a duplicate. diff --git a/manuscript/06-window.md b/manuscript/06-window.md index 6b7859f..a5b0384 100644 --- a/manuscript/06-window.md +++ b/manuscript/06-window.md @@ -35,7 +35,7 @@ the eighth. Just like with sessions, windows can have names. Labelling them helps keep track of what you're doing inside them. -![Renaming](images/06-window/rename.png) +![Renaming a window 'zsh' to 'renamed'](images/06-window/rename.png) When inside tmux, the shortcut `Prefix` + `,` is most commonly used. It opens a prompt in the tmux status line, where you can alter the name of the @@ -60,7 +60,7 @@ Prompt for a window index (useful for indexes greater than 9) with `Prefix` + `'`. If the window index is 10 or above, this will help you a lot. I> ### Tip: Search + Traverse Windows for Text -I> +I> I> You can forward to a window with a match of a text string by doing `Prefix` + I> `f`. From 486c5434cc7655c7ddb6d3b9690ca0248c9c5575 Mon Sep 17 00:00:00 2001 From: pjlangley Date: Sun, 9 Dec 2018 11:26:10 +0000 Subject: [PATCH 17/28] Scripting summary typo fix --- manuscript/10-scripting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/10-scripting.md b/manuscript/10-scripting.md index c8f3e56..13260ca 100644 --- a/manuscript/10-scripting.md +++ b/manuscript/10-scripting.md @@ -446,7 +446,7 @@ a powerful way of retrieving information on its objects between `list-panes`, `list-windows` and `list-sessions` and formats. This makes tmux not only accessible and configurable, but also scriptable. -The ability to retrieve explicitly and reliably, from session the sesson down to +The ability to retrieve explicitly and reliably, from a session down to a pane. All it takes is a pane's ID to capture its contents or even send it keys. Used by the skilled programmer, scripting tmux can facilitate orchestrating terminals in ways previously deemed unrealistic; anything from niche From a8f79503b042291d488fe7d82ac0b4b391ee3902 Mon Sep 17 00:00:00 2001 From: Jean Jordaan Date: Sun, 5 Jan 2020 10:17:36 +0200 Subject: [PATCH 18/28] Surely tmux lives in the text realm? --- manuscript/01-thinking-tmux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/01-thinking-tmux.md b/manuscript/01-thinking-tmux.md index 7bd243f..b2d0d16 100644 --- a/manuscript/01-thinking-tmux.md +++ b/manuscript/01-thinking-tmux.md @@ -8,7 +8,7 @@ In the world of modern computing, user interaction has 2 realms: 1. The text realm 2. The graphical realm -tmux lives in the graphical realm in which fixed-width fonts appear in +tmux lives in the text realm in which fixed-width fonts appear in a rectangular grid in a window, like in a terminal from the 1980s. ![](images/info/server-with-laptop.png) From 081c1905d00fd3a111047e286297a57c0a7024e4 Mon Sep 17 00:00:00 2001 From: Georg Federmann Date: Thu, 24 Jan 2019 13:08:04 +0100 Subject: [PATCH 19/28] Update configuration for tmux version 2.6 --- manuscript/04-server.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manuscript/04-server.md b/manuscript/04-server.md index e56d6c7..c242901 100644 --- a/manuscript/04-server.md +++ b/manuscript/04-server.md @@ -134,6 +134,9 @@ I> # Vi copypaste mode I> set-window-option -g mode-keys vi I> bind-key -t vi-copy 'v' begin-selection I> bind-key -t vi-copy 'y' copy-selection +I> # starting with tmux version 2.6 this changes to: +I> bind-key -Tcopy-mode-vi 'C-v' send -X begin-selection +I> bind-key -Tcopy-mode-vi 'C-y' send -X copy-selection In addition to the "copy mode", tmux has advanced functionality to programmatically copy and paste. Later in the book, the [Capturing pane content](#capture-pane) From cb65484c1304ac562b1126569d662cdf0f6aef6d Mon Sep 17 00:00:00 2001 From: Henning Phan Date: Sat, 11 Apr 2020 20:15:23 +0000 Subject: [PATCH 20/28] Fix example using wrong command --- manuscript/10-scripting.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manuscript/10-scripting.md b/manuscript/10-scripting.md index 13260ca..d8a9b49 100644 --- a/manuscript/10-scripting.md +++ b/manuscript/10-scripting.md @@ -222,10 +222,10 @@ client at `/dev/ttys004`: ### `$ tmux switch-client [-c target-client] [-t target-session]` {language=shell, line-numbers=off} - $ tmux suspend-client -c /dev/ttys004 -t othersession + $ tmux switch-client -c /dev/ttys004 -t othersession # Within current client, -c is assumed - $ tmux suspend-client -t othersession + $ tmux switch-client -t othersession ## Formats {#formats} From c68ca728ec9c2db810517553152103ce829f8920 Mon Sep 17 00:00:00 2001 From: William Date: Thu, 26 Sep 2019 04:49:10 +0000 Subject: [PATCH 21/28] Use awk instead of grep|cut --- manuscript/06-window.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manuscript/06-window.md b/manuscript/06-window.md index a5b0384..027612d 100644 --- a/manuscript/06-window.md +++ b/manuscript/06-window.md @@ -141,12 +141,12 @@ Layouts can also be custom. To get the custom layout snippet for your current window, try this: {language=shell, line-numbers=off} - $ tmux lsw -F "#{window_active} #{window_layout}" | grep "^1" | cut -d " " -f2 + $ tmux lsw -F "#{window_active} #{window_layout}" | awk '$1{print $2}' To apply this layout: {language=shell, line-numbers=off} - $ tmux lsw -F "#{window_active} #{window_layout}" | grep "^1" | cut -d " " -f2 + $ tmux lsw -F "#{window_active} #{window_layout}" | awk '$1{print $2}' > 5aed,176x79,0,0[176x59,0,0,0,176x19,0,60{87x19,0,60,1,88x19,88,60,2}] # resize your panes or try doing this in another window to see the outcome From bfe3a8007260a1667a0a9467de9e019e87e61302 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 6 Mar 2021 15:15:58 -0600 Subject: [PATCH 22/28] window: Keep grep/cut as a backup in case (and to show variety) c68ca728ec9c2db810517553152103ce829f8920 --- manuscript/06-window.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manuscript/06-window.md b/manuscript/06-window.md index 027612d..1547e10 100644 --- a/manuscript/06-window.md +++ b/manuscript/06-window.md @@ -141,14 +141,21 @@ Layouts can also be custom. To get the custom layout snippet for your current window, try this: {language=shell, line-numbers=off} + # awk(1) $ tmux lsw -F "#{window_active} #{window_layout}" | awk '$1{print $2}' + # grep(1) + cut(1) + $ tmux lsw -F "#{window_active} #{window_layout}" | grep "^1" | cut -d " " -f2 + To apply this layout: {language=shell, line-numbers=off} $ tmux lsw -F "#{window_active} #{window_layout}" | awk '$1{print $2}' > 5aed,176x79,0,0[176x59,0,0,0,176x19,0,60{87x19,0,60,1,88x19,88,60,2}] + # Alternant to above: + $ tmux lsw -F "#{window_active} #{window_layout}" | grep "^1" | cut -d " " -f2 + # resize your panes or try doing this in another window to see the outcome $ tmux select-layout "5aed,176x79,0,0[176x59,0,0,0,176x19,0,60{87x19,0,60,1,88x19,88,60,2}]" From 8e652baeba0bc0114d409c7c8cb1c2ae77845f61 Mon Sep 17 00:00:00 2001 From: P M <10617122+pylipp@users.noreply.github.com> Date: Sat, 23 Jul 2022 14:41:07 +0200 Subject: [PATCH 23/28] Update link to GitHub CI --- manuscript/00-foreword.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/00-foreword.md b/manuscript/00-foreword.md index 5d9e2bc..2b8db09 100644 --- a/manuscript/00-foreword.md +++ b/manuscript/00-foreword.md @@ -188,7 +188,7 @@ As of January 2017, it's trivial to push out minor changes to Leanpub. Kindle is harder. tmux does intermittently receive updates. I've accommodated many over the past 5 -years on my personal configurations and software libraries set with [continuous integration tests against multiple tmux versions](https://github.com/tony/libtmux/blob/master/.travis.yml). +years on my personal configurations and software libraries set with [continuous integration tests against multiple tmux versions](https://github.com/tmux-python/libtmux/blob/master/.github/workflows/tests.yml). Sometimes, publishers overplay version numbers to make it seem as if it's worth striking a new edition of a book over it. It's effective for them, but I'd rather be honest to my readership. From 2cf8436051ca8b6a07fe3f6601b4a71179becefb Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Fri, 2 Dec 2022 10:52:22 -0600 Subject: [PATCH 24/28] prettier: Ignore all files for now --- .prettierignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +* From 9d2d4bedd23cb022b0ae39fb5cc1a3cca49b6565 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Fri, 2 Dec 2022 10:52:50 -0600 Subject: [PATCH 25/28] Fix entrproject links --- manuscript/01-thinking-tmux.md | 2 +- manuscript/11-tips-and-tricks.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manuscript/01-thinking-tmux.md b/manuscript/01-thinking-tmux.md index b2d0d16..e9e1279 100644 --- a/manuscript/01-thinking-tmux.md +++ b/manuscript/01-thinking-tmux.md @@ -60,7 +60,7 @@ Here are a few common scenarios: - Running a file watcher, like [watchman](https://github.com/facebook/watchman), [gulp-watch](https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulpwatchglob-opts-tasks), [grunt-watch](https://github.com/gruntjs/grunt-contrib-watch), [guard](https://github.com/guard/guard), - or [entr](http://entrproject.org/). On file change, you could do stuff like: + or [entr](https://eradman.com/entrproject/). On file change, you could do stuff like: - rebuild LESS or SASS files, minimize CSS and/or assets and static files - lint with linters, like [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [Cppcheck](http://cppcheck.sourceforge.net/), [rubocop](https://github.com/bbatsov/rubocop), diff --git a/manuscript/11-tips-and-tricks.md b/manuscript/11-tips-and-tricks.md index f6c8f8c..04f3a16 100644 --- a/manuscript/11-tips-and-tricks.md +++ b/manuscript/11-tips-and-tricks.md @@ -89,7 +89,7 @@ linters, and so on. It gives you, as a developer, instant feedback in the terminal, empowering a tmux workspace to have IDE-like features, without the bloat, memory, and CPU fans roaring. -I eventually settled on [`entr(1)`](http://entrproject.org/), which works +I eventually settled on [`entr(1)`](https://eradman.com/entrproject/), which works superbly across Linux distros, BSDs and OS X / macOS. The trick to make entr work is to [pipe](https://en.wikipedia.org/wiki/Pipeline_(Unix)) @@ -134,7 +134,7 @@ installed on the system: {language=shell, line-numbers=off} $ if command -v entr > /dev/null; then find . -print | grep -i '.*[.]go' | \ entr -c go test ./...; else go test ./...; echo "\nInstall entr(1) to \" - echo "run tasks when files change. \nSee http://entrproject.org/"; fi + echo "run tasks when files change. \nSee https://eradman.com/entrproject/"; fi Here's why you want patterns like above: You can put it into a [`Makefile`](https://en.wikipedia.org/wiki/Makefile) and commit it to your project's [VCS](https://en.wikipedia.org/wiki/Version_control), @@ -148,7 +148,7 @@ Let's see what a `Makefile` with this looks like: {language=makefile, line-numbers=off} watch_test: - if command -v entr > /dev/null; then find . -print | grep -i '.*[.]go' | entr -c go test ./...; else go test ./...; echo "\nInstall entr(1) to run tasks when files change. \nSee http://entrproject.org/"; fi + if command -v entr > /dev/null; then find . -print | grep -i '.*[.]go' | entr -c go test ./...; else go test ./...; echo "\nInstall entr(1) to run tasks when files change. \nSee https://eradman.com/entrproject/"; fi To run this, do `$ make watch_test` in the same directory as the `Makefile`. @@ -162,7 +162,7 @@ backslash (`\`): grep -i '.*[.]go' | entr -c go test ./...; \ else go test ./...; \ echo "\nInstall entr(1) to run tasks on file change. \n"; \ - echo "See http://entrproject.org/"; fi + echo "See https://eradman.com/entrproject/"; fi Another would be to break the command into variables and `make` subcommands. So: @@ -178,7 +178,7 @@ Another would be to break the command into variables and `make` subcommands. So: @echo " ! File watching functionality non-operational ! " @echo " " @echo " Install entr(1) to run tasks on file change. " - @echo " See http://entrproject.org/ " + @echo " See https://eradman.com/entrproject/ " @echo "-------------------------------------------------" watch_test: @@ -293,7 +293,7 @@ They're licensed under MIT so, you can use them, copy and paste from them, etc: Both support `tmuxp load .` within the project directory to load up the project. -Make sure to install [`entr(1)`](http://entrproject.org/) beforehand! +Make sure to install [`entr(1)`](https://eradman.com/entrproject/) beforehand! ## tmux-plugins and tpm From f94bf9d8a90c84350173db9c172252457ec7ee4e Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Fri, 2 Dec 2022 10:54:53 -0600 Subject: [PATCH 26/28] Improve sentence about layout freezing --- manuscript/11-tips-and-tricks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/11-tips-and-tricks.md b/manuscript/11-tips-and-tricks.md index 04f3a16..8113703 100644 --- a/manuscript/11-tips-and-tricks.md +++ b/manuscript/11-tips-and-tricks.md @@ -241,7 +241,7 @@ Already having used teamocil and tmuxinator, I wrote my own in python instead of ruby, with many more features. For one, it builds on top of [libtmux](https://github.com/tony/libtmux), a library which abstracts tmux [server](#server), [sessions](#sessions), [windows](#windows) and [panes](#panes) to build the state of tmux sessions. In -addition, it has a naive form of session freezing, support for JSON, more +addition, it can save active tmux sessions fo a layout file (JSON or yaml), more flexible configuration options, and it will even offer to attach exiting sessions, instead of redundantly running script commands against the session if it's already running. From 3a63ea30e3e516619f0b17ecee381006bc650926 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Fri, 2 Dec 2022 10:55:57 -0600 Subject: [PATCH 27/28] Add dnf(1) installation command --- manuscript/99-installation.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manuscript/99-installation.md b/manuscript/99-installation.md index 981e700..a86e8bf 100644 --- a/manuscript/99-installation.md +++ b/manuscript/99-installation.md @@ -26,6 +26,13 @@ ### CentOS / Fedora / Redhat, etc. +dnf: + +{language=shell, line-numbers=off} + $ sudo dnf install tmux + +yum: + {language=shell, line-numbers=off} $ sudo yum install tmux From 0986c9a3c283749d4f07ce4ec45bb4d9a6cf3669 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Fri, 2 Dec 2022 10:58:56 -0600 Subject: [PATCH 28/28] Fix spacing --- manuscript/11-tips-and-tricks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/11-tips-and-tricks.md b/manuscript/11-tips-and-tricks.md index 8113703..3509570 100644 --- a/manuscript/11-tips-and-tricks.md +++ b/manuscript/11-tips-and-tricks.md @@ -178,7 +178,7 @@ Another would be to break the command into variables and `make` subcommands. So: @echo " ! File watching functionality non-operational ! " @echo " " @echo " Install entr(1) to run tasks on file change. " - @echo " See https://eradman.com/entrproject/ " + @echo " See https://eradman.com/entrproject/ " @echo "-------------------------------------------------" watch_test: