DEV Community

Play Button Pause Button

tmux copy-mode

Waylon Walker
Data Engineering with python, kedro super user.
Originally published at ・2 min read

tmux copy-mode is a tmux mode that lets you scroll, search, copy, and jump your way through a pane. There are a ton of keybindings for copy-mode, the main ones you will need to know are / for searching down ? for searching up, n
for next item, space for starting a selection, and enter to copy the selection. Arrow keys will be used for navigation unless you have specified vi mode, then it will be hjkl.

Default keybinding to get into copy mode is prefix+[.

bind-key          [ copy-mode
Enter fullscreen mode Exit fullscreen mode

If you are a vim user you will likely want to use vi style keys, add this to your ~/.tmux.conf file to enable vi mode.

setw -g mode-keys vi
Enter fullscreen mode Exit fullscreen mode

full list of copy-mode keybindings from the man page.

  Command                                      vi              emacs
           append-selection-and-cancel                  A
           back-to-indentation                          ^               M-m
           begin-selection                              Space           C-Space
           bottom-line                                  L
           cancel                                       q               Escape
           clear-selection                              Escape          C-g
           copy-end-of-line [<prefix>]                  D               C-k
           copy-line [<prefix>]
           copy-pipe [<command>] [<prefix>]
           copy-pipe-no-clear [<command>] [<prefix>]
           copy-pipe-and-cancel [<command>] [<prefix>]
           copy-selection [<prefix>]
           copy-selection-no-clear [<prefix>]
           copy-selection-and-cancel [<prefix>]         Enter           M-w
           cursor-down                                  j               Down
           cursor-left                                  h               Left
           cursor-right                                 l               Right
           cursor-up                                    k               Up
           end-of-line                                  $               C-e
           goto-line <line>                             :               g
           halfpage-down                                C-d             M-Down
           halfpage-up                                  C-u             M-Up
           history-bottom                               G               M->
           history-top                                  g               M-<
           jump-again                                   ;               ;
           jump-backward <to>                           F               F
           jump-forward <to>                            f               f
           jump-reverse                                 ,               ,
           jump-to-backward <to>                        T
           jump-to-forward <to>                         t
           jump-to-mark                                 M-x             M-x
           middle-line                                  M               M-r
           next-matching-bracket                        %               M-C-f
           next-paragraph                               }               M-}
           next-space                                   W
           next-space-end                               E
           next-word                                    w
           next-word-end                                e               M-f
           other-end                                    o
           page-down                                    C-f             PageDown
           page-up                                      C-b             PageUp
           pipe [<command>] [<prefix>]
           pipe-no-clear [<command>] [<prefix>]
           pipe-and-cancel [<command>] [<prefix>]
           previous-matching-bracket                                    M-C-b
           previous-paragraph                           {               M-{
           previous-space                               B
           previous-word                                b               M-b
           rectangle-toggle                             v               R
           refresh-from-pane                            r               r
           scroll-down                                  C-e             C-Down
           scroll-up                                    C-y             C-Up
           search-again                                 n               n
           search-backward <for>                        ?
           search-backward-incremental <for>                            C-r
           search-backward-text <for>
           search-forward <for>                         /
           search-forward-incremental <for>                             C-s
           search-forward-text <for>
           search-reverse                               N               N
           select-line                                  V
           set-mark                                     X               X
           start-of-line                                0               C-a
           top-line                                     H               M-R
Enter fullscreen mode Exit fullscreen mode

Be sure to check out the full youtube playlist and subscribe if you like it.

tmux playlist on youtub

Also check out this long form post for more about how I use tmux.

Discussion (0)