gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.99k stars 3.37k forks source link

Question: remapping the default for prev and next pane #612

Closed woss closed 1 year ago

woss commented 1 year ago

I find the current mapping for pane navigation not intuitive, how can i return it to be <prefix> n and <prefix> p for next and previous, respectively?

Apart from this is really love and enjoy this project!

gpakosz commented 1 year ago

Hello @woss 👋

You can edit your ~/.tmux.conf.local copy to add your overrides.

bind n swap-pane -D       # swap current pane with the next one
bind p swap-pane -U       # swap current pane with the previous one
woss commented 1 year ago

Hi, thanks for the reply.

I've added that at the end and reload the config then tried but it didn't work. i guess i just need to remap it in my brain to use the prefix c-l{h}

gpakosz commented 1 year ago

Try to put them in the user customizations section

# -- user customizations -------------------------------------------------------
# this is the place to override or undo settings

bind n swap-pane -D       # swap current pane with the next one
bind p swap-pane -U       # swap current pane with the previous one

...

Reload the configuration then you should see

$ tmux lsk | grep swap-pane
bind-key    -T prefix       <                    swap-pane -U
bind-key    -T prefix       >                    swap-pane -D
bind-key    -T prefix       n                    swap-pane -D
bind-key    -T prefix       p                    swap-pane -U
bind-key    -T prefix       \{                   swap-pane -U
bind-key    -T prefix       \}                   swap-pane -D
...

Make sure you have ~/.tmux.conf.local, that is your own copy, do not edit ~/.tmux/.tmux.conf.local

woss commented 1 year ago

Hi, there is something i am doing wrong, here is the .tmux.conf.local and here is how i am setting it up.

I'm not sure how can i demo that it doesn't work.

Here is the output of the cmd you posted above: image

Tmux version is : tmux 3.0a

gpakosz commented 1 year ago

Then I don't know what you mean when you say

I find the current mapping for pane navigation not intuitive, how can i return it to be n and p for next and previous, respectively?

If you split a window into 4 panes, and focus is on one of the 4 panes, what's the next one and what's the previous one?

Or are you asking about navigating windows?

woss commented 1 year ago

uh so it seems i always mix them, the ones that are created by prefix c. if they are called windows then yes i mean windows not panes.

i am truly sorry for the confusion :)

C-h and C-l let you navigate windows (default n and p are unbound) This is what i wanted to remap, but after few days of using i got used to the combinations provided.

Maybe would be nice to write how a person can return that specific mapping to original.

gpakosz commented 1 year ago

Then you want

unbind C-h
unbind C-l
bind -r p previous-window # select previous window
bind -r n next-window     # select next window
woss commented 1 year ago

thank you so much. I hope this helps more people!