Tmux Part 3: Navigation

Navigation Panes Splitting / Creating Panes I recommend adding the following mappings for creating panes / splitting windows: bind-key - split-window -v -c '#{pane_current_path}' bind-key \ split-window -h -c '#{pane_current_path}' These m...
This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/tmux-navigation

Iā€™m having trouble when trying to use Ctrl and the arrow keys to resize panes because OSXā€™s shortcuts for dash (Ctrl and Left) and expose (Ctrl and Up) kick in instead. I thought I saw it mentioned in the video at one point, but is there a way to make iTerm2 do the right thing and let other apps allow the shortcut keys to work as normal?

Edit: Hereā€™s my tmux.conf: dotfiles/tmux.conf at main Ā· aaronmcadam/dotfiles Ā· GitHub

Iā€™m not aware of a way to override OS-level keybindings like that.

Any thoughts, @christoomey?

Hello @aaronmcadam, Iā€™m not aware of a way to make OS X bypass system key bindings when certain apps are active.

You can disable the OS X shortcuts if youā€™d prefer to use the tmux key bindings I presented. Go to Preferences ā†’ Keyboard ā†’ Shortcuts (tab) and uncheck them.

Alternately, you can change the tmux key-bindings to something not taken by the system.

Hope that helps!

Loving these series so far! Keeping the current pane when splitting windows is tremendously useful.

If anybody else struggled with making the awesome tat script work on fish, I translated it into a fish function.

Hi,
How do I mark that I watched this video? I usually download video and then watch it.

@izbor I just scroll (fast forward) to the end of the video :smile:

1 Like

Thank you Sajoku

1 Like

For anyone using tmate for pairing, note that pane_current_path wonā€™t work. Iā€™ve described an alternative approach here:

http://blog.andywaite.com/2015/03/01/opening-new-panes-in-tmate/

Iā€™m trying to work with zooming more often but canā€™t really think of a nice prefix key to handle this.(something other than prefix+z). Does anyone have a nice key combo for this feature? I canā€™t find any one using this is any tmux.conf files.
I think @melanie is using this feature in the latest weekly iteration. Are you using some other prefix key for this? I checked your dotfiles but couldnā€™t find anything :smile:

Zooming

If you temporarily want to focus on the contents of a single pane, you can use the zooming functionality added to tmux in version 1.9, which will cause the current pane to temporarily occupy the entire window. When ready, you can unzoom the pane and it will return to the position and size it originally occupied.

Pane zooming is bound by default to <prefix>z, and this acts as a toggle to both zoom a pane and unzoom as needed.

Iā€™m having the same issue as aaronmcadam

when I press shift + Up or shift + Down, I,m moving through the command history, getting a previous or next command.

On the other hand the shift + Left and shift + Right key combination is working and resizes the panes horizontally.

I tried using the arrow keys (on Mac), I had to go into system preferences, keyboard, shortcuts, for mission control and uncheck the ^arrow shortcuts.

I didnā€™t like the setup, so I changed my key combination to keep me on the home row,
in tmux.conf:

bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

@Sajoku
What is your <prefix> combo?
I set my ā€˜caps lockā€™ key to be control key, so my prefix is <^-a>. That makes dropping the ring finger down to the z work out well for me to toggle zoom.

Hi Rory,

No, that didnā€™t work for me. Also, when I,m trying Ctrl + Up or Ctrl + Down, there appears ā€˜use kā€™ and ā€˜use jā€™ in my vim status bar.

Anthony,

Your getting the ā€˜use kā€™ & ā€˜use jā€™ messages because of the following lines in your vimrc file (if you are using the thoughtbot dotfiles):

" Get off my lawn
nnoremap <Left> :echoe "Use h"<cr>
nnoremap <Right> :echoe "Use l"<cr>
nnoremap <Up> :echoe "Use k"<cr>
nnoremap <Down> :echoe "Use j"<cr>

If you want to use the arrow keys you can remove those lines. Iā€™ve havenā€™t been using Vim for very long and I like those there to ā€˜makeā€™ me stay on the home row. Thatā€™s one of the great things I like about Vim, you can configure it the way that works for you!

Iā€™m not sure why the other config didnā€™t work, do you have anything else mapped to capital HJKL? Do you have it up on GitHub?

My prefix is ctrl+s. I do have my caps key set to be ctrl but I never use it. Iā€™ll force myself to use the caps key more often and give your suggestion a try, thanks :smile:

Hi Rory,

no, I don,t want to use the arrow keys. My main problem is that I can,t resize the panels up and down. If I click Ctrl + Up or Ctrl + Down, I move through the command history instead of resizing up or down the panel. However, resizing the panels left or right works.

greetins,

Anthony

I switched to iTerm, and now resizing up and down works : )

Anthony,

Can you push your setup to GitHub?

FYI, Iā€™m traveling the next few days so I could be delayed on any responses.

Thanks Rory

Hi Rory, my problem with up and down resizing of panes is fixed (see my previous post).

greetings,

Anthony

Had the same issue with the resize controls. What Iā€™ve done is moved them to a bind-r, e.g:
bind-r C-h resize-pane -L 5

I donā€™t resize too much once they are set up so I just need to CtrlS then Ctrl h/j/k/l to resize the window. Works reasonably well and helps keep me away from using the arrow keys!