Go back to the main page

Increased Developer Productivity with Tmux, Part 9: Terminal.app

This article is over 2 years old. Proceed with caution.

Regards ♨ – Minimul



Using Tmux and Terminal.app together

In Part 8 I showed how to use copy mode proficiently. In this episode I go over using Tmux within the OSX GUI console tool Terminal.app. Conventional wisdom might be that you don't really need GUI console app now that you are rocking with Tmux. Or perhaps you might just need the GUI console app for a single console window and then Tmux takes over from there handling all your command line needs. That might be the case for other developers but I still use my GUI console tool heavily in conjunction with Tmux. Let me show you how.

.. I still use my GUI console app heavily in conjunction with Tmux

  1. Here is a typical Terminal.app setup on my development box.
  2. Each named tab has a separate Tmux session running.
    This section is at the 0:35 mark in the screencast.
  3. I run Terminal.app in full screen mode, which completely blocks out all other windows, aiding in removing distractions keeping me focussed.
  4. OSX 10.7 and greater support this feature, which is technically called a "workspace".
  5. Let's take a look at the Terminal.app preferences
  6. Terminal.app preferences is at the 1:45 mark.
    Terminal.app Preferences.
  7. I use the "Pro" theme, 18pt Monaco and my usually display resolution is 2560 x 1440 (for screencasts I run the display at a lower resolution).
  8. Key Terminal.app settings.
  9. Within the Keyboard group make sure to check "Use option as meta key".
  10. Terminal.app keyboard settings.
    Minimul says —

    Tmux uses meta keys for adjusting window pane layouts. By default, <prefix> — <meta key> — 1-5 do the following:

    • M-1 select-layout even-horizontal
    • M-2 select-layout even-vertical
    • M-3 select-layout main-horizontal
    • M-4 select-layout main-vertical
    • M-5 select-layout tiled

    In addition I have bond 5 additional layouts:

    • bind-key M-7 resize-pane -t 1 -x 90
    • bind-key M-8 resize-pane -t 1 -x 60
    • bind-key M-9 resize-pane -t 1 -x 30
    • bind-key M-0 resize-pane -t 0 -x 30

    See Part 2 for a demonstration and more discussion.

  11. Back to the Terminal.app/Tmux workflow. To move between tabs use Command - { to move left a tab and Command - } to move right a tab.
  12. Kind of hard to muscle memorize these keys so you may want to remap them, although, I haven't personally rebound them.
  13. Naming a Terminal.app tab is done by typing Command - i.
  14. Tab labeling.
    Tab labeling is at the 4:55 mark.
  15. Copy and pasting between standalone Vim instance in separate tabs is something I do all the time. If you use line numbering make a leader command enabling you to quickly toggle line numbering on and off as when in Tmux copy mode the line numbers will get recorded.
  16. Copy mode with Vim line numbering turned off.
    Use a leader command as well to simplify pasting from the system clipboard.
    Minimul says —

    See episode 8 where I explain Tmux copy mode in depth.

  17. Random tip: Don't use a separate Terminal.app tab for services. Make a Tmux window instead.
  18. Tmux window with 5 panes for running app services.
  19. Random tip. Consider running your development browser in full screen mode as well to aid in preventing distractions.
  20. 1 workspace for Terminal.app and 1 workspace for your development browser.
    To make moving workspaces efficient I bound these actions to the F7 and F8 keys.
    Multiple workspaces is at the 8:00 mark.

That concludes installment 9. Using Tmux within Terminal.app

That will also bring the entire Increase your developer productivity with Tmux series to an end. I vastly enjoyed being able to convey my knowledge on this topic. In the same way, let me know about methods you have employed to increase your output by using Tmux or other tools. As programmers and developers this really comes down to keeping our tools sharp and sharpening is a continual and life-long process. Therefore, let us press on to learn and share our outcomes and techniques with the developer community at large so that we may collectively and immensely increase our productivity.

Regards — Minimul

Comment on this article?

If you like this article and screencast go to the dedicated page for this series at http://minimul.com/teaches/tmux.