I installed tmux (3.1c) with Homebrew and when I type C-b ? I get the message
-bash: C-b: command not found
but when I press ctrl + b and ? it works. I also ran
tmux show-options -g | grep prefix
which displays
prefix C-b
prefix2 Invalid#1fff00000000
what am I doing wrong?
It sounds like you literally typing Shiftc-bShift/
C-b is another way of writing ctrl + b - they both mean the Ctrlb keys. Typing Shiftc-b will not trigger any tmux commands; this is by design.
but when I press ctrl + b and ? it works
That is the expected behavior. If that is not your goal, you should edit your question.
Related
I thought this was a no brainer. I am using tmux with iterm2 (latest version) on maxOs on a MacBook.
Using ctrl-b as prefix is a terrible key combination for a MacBook, since the MacBook has only one control key, which is placed on the left hand side. So pressing these two buttons at the same time is almost painful for me. But tmux is awesome, so it lets you remap the prefix.
So, quite naively, I entered this line into my ~/.tmux.conf in order to set the prefix to option/alt-a:
set-option -g prefix M-a
However, that line didn't change a thing.
Entering tmux show-options -g still outputs
prefix C-b
Has anyone ever solved this?
BTW: I know I could use iterm2's tmux integration. But I don't want that. I want a plain text mode solution.
Yeah, so I found a solution:
1 # change ctrl-a to alt-a
2 unbind C-b
3 set-option -g prefix M-a
4 bind C-a send-prefix
And then in iterm2 -> profiles -> [your profile] > Keys
for Right Option/Alt Key
click Esc+
I'm sorry. I found this solution, after having posted the question.
When using tmux within Mobaxterm, Ctrl + Left/Right just moves the cursor forward/back one character, not one word.
In the following cases, Ctrl + Left/Right does behave as expected:
in bash within Mobaxterm
in screen within Mobaxterm
in tmux within Cygwin
in screen or bash within Cygwin
So it seems to be an issue only when combining tmux with Mobaxterm.
In all cases, I am ssh-ing to a remote linux machine, within either Cygwin or Mobaxterm. My /etc/inputrc is set as it should for the shortcuts to work.
Any clue?
Old question. But in case someone find his way here. This is sgzmd's answer:
Edit your ~/.tmux.conf and add lines:
set-window-option -g xterm-keys on
If you don’t want to make it permanent just yet, do:
C-b :set-window-option xterm-keys on
Reload your config in tmux by doing:
C-b :source-file ~/.tmux.conf
It worked for me.
original answer here
I'm currently on OS X using iTerm2 and byobu, and I can't figure out how to split my screen vertically on OS X. On Linux, I can split my screen vertically with Ctrl+F2, but on OSX, that doesn't work, thanks to Apple's different keyboard.
I Googled all around for the solution, and I can't figure this out. I can split my screen horizontally with Shift+F2, but I need to be able to split vertically. Has anyone figured out how to get byobu's keyboard bindings to work well with Apple computers?
Thanks in advance.
Looks like there's on open bug on this issue.
I was able to configure iTerm2 to use byobu locally on OS X as well as remotely over ssh on an Ubuntu 14.04 server.
Using:
OS X version: 10.9.5 Build 13F34
iTerm2 version: Build 1.0.0.20140629
First, in your OS X system preferences, edit your keyboard settings and remove or change any shortcut settings that may conflict with byobu (i.e. Ctrl + F1-F12).
Option 1: Workaround using escape sequences
Here's a workaround that will work without adding full functionality to the FN keys. This will allow you to split windows vertically using the byobu escape key:
Start byobu.
Set your desired Ctrl-A behavior by running: byobu-ctrl-a. I chose to go with Emacs-mode.
Run byobu-config and choose or change your escape sequence. I went with the new default Ctrl + S. The F12 key is also an escape sequence
Now you can issue a command with your escape sequence. Try F12 then % or Ctrl + s then % to split a window vertically. For a full list of commands, try Ctrl + s then ? or F12 then ?.
Option 2: Setting iTerm2 key mappings to fully use all FN keys.
You can add some key mappings to your iTerm2 profile to get the CTRL, ALT, SHIFT, and FN keys to work with byobu. This is tedious, but I went through the exercise and it seems to work. I don't think there's an automated way to save these key mappings with iTerm2.
Open iTerm2 preference and select Profiles.
Choose the profile you'd like to use.
Open the Terminal pane and under "Report terminal type" choose "linux".
Open the Keys pane and manually add the following key bindings. Here's an example how to add one key binding:
Click the '+' icon.
Enter the keyboard shortcut being mapped in the first field. Example: CTRL + F2
Select "Send Escape Sequence" in the Action field.
Enter the characters in the third field. Example: [1;5Q
You can determine the control characters for any key sequence not listed here by referring to the tmux source code.
Repeat this for all of these mappings to make the corresponding byobu command work:
CTRL + F2 : [1;5Q
CTRL + SHIFT + F2 : [1;6Q
ALT + LEFT : [1;3D
ALT + RIGHT : [1;3C
ALT + UP : [1;3A
ALT + DOWN : [1;3B
CTRL + F3 : [1;5R
CTRL + F4 : [1;5S
CTRL + SHIFT + F3 : [1;6R
CTRL + SHIFT + F4 : [1;6S
SHIFT + ALT + LEFT : [1;4D
SHIFT + ALT + RIGHT : [1;4C
SHIFT + ALT + UP : [1;4A
SHIFT + ALT + DOWN : [1;4B
CTRL + F5 : [15;5~
CTRL + SHIFT + F5 : [15;6~
ALT + F6 : [17;3~
CTRL + F6 : [17;5~
ALT + PPAGE : [5;3~
ALT + NPAGE : [6;3~
CTRL + F8 : [19;5~
ALT + SHIFT + F8 : [19;4~
CTRL + SHIFT + F8 : [19;6~
CTRL + F9 : [20;5~
ALT + F11 : [23;3~
CTRL + F11 : [23;5~
ALT + F12 : [24;3~
CTRL + F12 : [24;5~
ALT + INS: [2;3~
Summary
To get things to work we needed to:
Remove conflicts with OS X keyboard shortcuts.
Edit the terminal key mappings to send the correct escape sequences when using function keys.
Set the iTerm2 terminal type to "Linux", which sets the TERM environmental variable to be "linux". Byobu and/or Tmux seemed to be sensitive to this.
Some other references on escape sequences: SO link and xterm-keys.c
Default directory for new windows and panes
It looks like there are some difference in tmux window default directory between tmux 1.8 and tmux 1.9 (Src, Src, Src). If you are using byobu with tmux 1.9 you can try adding this to your ~/.byobu/keybindings.tmux file so that when you create new windows or vertical/horizontal splits that they open in the same directory as the current pane:
unbind-key -n F2
bind-key -n F2 display-panes \; new-window -c "#{pane_current_path}" -n -
unbind-key -n C-F2
bind-key -n C-F2 display-panes \; split-window -hc "#{pane_current_path}"
unbind-key -n S-F2
bind-key -n S-F2 display-panes \; split-window -vc "#{pane_current_path}"
unbind-key %
bind-key % display-panes \; split-window -hc "#{pane_current_path}"
unbind-key |
bind-key | display-panes \; split-window -vc "#{pane_current_path}"
Press F5 to reload settings.
I'm trying to bind Ctrl + Tab to cycle to the next tab.
I've added this to my ~/.tmux.conf file:
bind -n C-Tab select-pane -t :.+
But it doesn't work,
however it i change it to Ctrl + a it works fine:
bind -n C-a select-pane -t :.+
Any ideas?
My first thought is my terminal maybe hijacking it but i cant see anywhere, and nothing happends with Ctrl + Tab normally for me in the terminal, just a tab space is inserted.
I'm using xfce4-terminal if that helps, else maybe im doing something wrong in my tmux conf.
Terminal wont sent key. You have the same issues for vim, and so on. The seams to work because the terminal grabs its, but it wont send to your current job inside it. I strongly recommend to use other mappings, ( i know, sounds stupid .... ).
take a look at this post, might help:
vim cant map <C-Tab> to :tabnext
I hate using the mouse. When working in the OS X terminal, sometimes I want to navigate to a line in the bash shell a few rows up, copy a word or two. For this I always end up using the mouse. Any solution for this? Perhaps the terminal supports a key combination that puts it in to navigation/select/copy mode, where I can use the usual C-F, C-B, C-N and C-P keys.
If you feel comfortable with Vi key combinations, you can use this command to switch to vi-mode and use key strokes:
$ set -o vi
Or use C-xC-e to open current line in your $EDITOR.