0

In OSX, on iTerm2, I can map Ctrl/Cmd/Opt+, or Ctrl/Cmd/Opt+. to hex codes that go to next or previous tmux windows.

How can I use Super/Meta/Ctrl and comma/dot key presses on Linux to produce the same result, i.e. go to the next or previous tmux window?

3
  • What terminal emulator are you using under Linux? (Or are you using the text mode console?) Jul 24, 2015 at 23:06
  • @Nainita Please stop defacing posts with these edits. Code markup is only for code. Do not use code markup to highlight random words. Jul 24, 2015 at 23:07
  • Yes... I have understood what mistake I have done... It was totally unintentional... I had a look on how to edit answers and questions... in future it will surely not happen... I was totally unaware.... Thank you for pointing out... @Gilles
    – Nainita
    Jul 25, 2015 at 16:39

2 Answers 2

2

In your .tmux.conf file located in your user's home directory you can change or add keyboard shortcuts to your tmux sessions. If this file doesn't exist you can just create it. There are lots of sample .tmux.conf files around the web and several good gists out there.

If all you want to do is make comma or dot cycle to previous or next window add the following to your config file:

unbind n                     # Unbind 'n' and 'p'
unbind p
bind-key , next-window
bind-key . previous-window

As always you can see current key settings in your tux session with CTRL+b (or whatever your bind key is, this is the default) then ? for help. To exit this less style help screen just hit q.

0

I think it is not possible to set Meta/Ctrl solely as a prefix for tmux. As for Super key, you need to set up both your tmux and terminal emulator as Super is X key and tmux works on shell. This answer explains better.

I recommend to set the prefix to something like Ctrl-a or Ctrl-s then simply bind , and . to move through windows.

# remap prefix
unbind C-b                # Unbind default prefix
set-option -g prefix C-a

# bind comma and dot to cycle through window
unbind n p                # Unbind default moving window key
bind , next-window
bind . previous-window

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.