You can send literal escape (and newline) with ANSI-C quoting (there's more about that here), e.g. to send escape to 0:0
:
tmux send-keys -t 0:0 $'\e'
For your mapping, assuming I understand it correctly, you could do something like this:
map <F5> :silent !tmux send-keys -t 0:0 $'\e'"python"$'\n'<CR>
Note that the escape will always be sent, so to work around the issue of the shell receiving the escape, you could send an extra newline:
map <F5> :silent !tmux send-keys -t 0:0 $'\e'$'\n'"python"$'\n'<CR>
I'm not entirely sure I understand the first part of the question:
If you want to scroll faster than one page up at a time, you can add a repeat count to page-up: in copy mode do M-10 PageUp
(with emacs key bindings) or 10C-b
(with vi key bindings) to scroll up 10 pages at a time. However, I'd rather use the search functionality C-s
and C-r
for emacs keys and /
and ?
with vi keys.
To capture the entire history of the pane I would do (needs tmux 2.0 or later):
$ tmux capture-pane -S - -E - # save the history in a paste buffer
In case you have an older version of tmux, give something like -S -400000
as an argument to tmux capture-pane
.
You can then paste the history wherever you want with prefix-]
. To save the history to a file, do:
$ tmux save-buffer /tmp/myhistory # save the history in /tmp/myhistory
I have the line
bind-key C command-prompt -p 'save history to:' \
-I '/tmp/tmux-%F_%H_%M.log \
capture-pane -S -; save-buffer %1'
in my $HOME/.tmux.conf
(which I adapted from this answer). This prompts me where I want to save the entire history with a reasonable default.
If you wish to save some memory, delete it using $ tmux delete-buffer
.
Best Answer
Keyboard shortcut
ctrl+b [ This will allow you to scroll up with arrow keys while your application continues. Press q to exit this mode.
Mouse shortcut
In your
~./tmux.config
file add the lineset-option -g mouse on
. Now you can scroll with the mouse. Press q to exit this mode.Note
Adding
set -g history 65000
to~./tmux.config
will help keep more data in the history buffer