← Back to Upcase

Tmux Part 3: Navigation


(Upcase ) #1
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

(Aaron Mc Adam) #2

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: https://github.com/aaronmcadam/dotfiles/blob/master/tmux.conf#L63-L71


(Ben Orenstein) #3

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

Any thoughts, @christoomey?


(Chris Toomey) #4

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!


(Gus) #5

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.


(Oleh Novosad) #6

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


(Sander Kuijper) #7

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


(Oleh Novosad) #8

Thank you Sajoku


(Andy Waite) #9

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/


(Sander Kuijper) #10

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.

(Anthony) #11

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.


(Rory Pasley) #12

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.


(Anthony) #13

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.


(Rory Pasley) #14

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?


(Sander Kuijper) #15

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:


(Anthony) #16

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


(Anthony) #17

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


(Rory Pasley) #18

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


(Anthony) #19

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

greetings,

Anthony


(Chris Legg) #20

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!