← Back to Upcase

Tmux Part 2: Configuration


(Upcase ) #1
Configuration Configuration Interfaces Tmux has 3 interfaces for running commands and making configurations: Tmux executable - This is the tmux command available in your shell. All commands can be run directly against this, but note that any c...
This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/tmux-configuration

(Anthony) #2

we configure tmux to let let the window index start at 1

set -g base-index 1

but the panes still start there index at 0.

I found out that the panes can also start their index at one by adding

setw -g pane-base-index 1

to the .tmux.conf file


(TLuu) #3

Hi! I’m having trouble to get two of the bindings to work.

  • ‘bind-key C-s send-prefix’ nor ‘bind-key -r C-s send-prefix’ will let me go forward when I do ‘C-s C-s’ or just ‘C-s’ respectively.
  • 'set-option -g status-keys “emacs” allows me to go to the end of the line when I do ‘C-e’ but not when I do ‘C-a’

How should I go about troubleshooting this?


(Chris Toomey) #4

Hello @theresaluu As a start, you can check the output of the tmux list-keys command for the various modes. Below is the output for my configuration which is largely as shown in the screencasts. Yours should match:

$ tmux list-keys | grep -E '(C-s|C-a)'
#=> bind-key -r     C-s send-prefix

$ tmux list-keys -t emacs-edit | grep -E '(C-s|C-a)'                                                                                     [2.2.2p95]
#=> bind-key -t emacs-edit    C-a start-of-line

(Arbaaz) #6

Sometime you get disconnected from internet. It would be useful to use the is-online package
set-option -g status-right " #(battery -t) #(is-online) #(date '+%a, %b %d - %I:%M') "


(Chris Toomey) #7

@arbaaz thanks for sharing! I’ve actually been looking for something like this for a while. For anyone else looking to add this, you’ll want to install the is-online-cli globally with npm install -g is-online-cli.


(Christian Sakai) #8

@christoomey hey great video! btw I still don’t understand what is the benefit of using repeat C-s? can you elaborate more


(Chris Toomey) #9

Hey @christiansakai, thanks for the kinds words!

By default, in a shell with readline support, C-s is already bound to an action, specifically forward-incremental-history-search (the oposite of C-r).

Since we configure tmux to use C-s, we lose the ability to do forward-incremental-history-search. The configuration I demonstrate allows us to get the behavior back by pressing C-s twice.

Hope that helps, but please let me know if you have any additional questions.


(Christian Sakai) #10

@christoomey gotcha! thanks for replying. Really great video! I’ve been looking for this kind of content for a while. There are a lot of article about tmux vim workflow but there’s no tutorial on it. Please continue to add more content along this topic!


(thedanotto) #11

Just because I’m a doperino…to get the battery indicator to work… I first had to run the following terminal commands…

$ brew tap Goles/battery
$ brew install battery
$ brew install spark

It’s all documented on the github page https://github.com/Goles/Battery


(Tomas Henriquez) #12

for anyone having issues with setting the default-terminal to 256 colors, this post helped me fixed it.

In the end, because I use bash, I had to add to my bash profile export TERM=xterm-256color and everything started to work.


(Ralin) #13

Hi,

I have C-h,j,k,l mapped in Vim to move between panes. Now that I’ve setup the same for tmux, I can no longer move between panes in vim. The tmux is taking somehow those mappings over vim. I thought it should be the other way around. Let me know how to fix this. The desired behavior is: when in vim all keybinds go to vim, when in tmux (without vim) same keybinds go to tmux.

Thank you.


(Chris Toomey) #14

In the fourth video on Tmux and Vim Integration I cover the vim-tmux-navigator plugin which handles this. Enjoy!