Giter VIP home page Giter VIP logo

tmux-pain-control's Introduction

Tmux Pain Control

Tmux plugin for controlling panes. Adds standard pane navigation bindings.

So far, you had to google around and comb other people's dotfiles to find these. This plugin hopefully makes them more available and "more standard".

Thanks to the Tmux community for "inventing" these bindings. I've merely just copied them here.

Tested and working on Linux, OSX and Cygwin.

Bindings

Notice most of the bindings emulate vim cursor movements.

pane navigation

Navigation

  • prefix + h and prefix + C-h
    select pane on the left
  • prefix + j and prefix + C-j
    select pane below the current one
  • prefix + k and prefix + C-k
    select pane above
  • prefix + l and prefix + C-l
    select pane on the right

Note: This overrides tmux's default binding for toggling between last active windows, prefix + l. tmux-sensible gives you a better binding for that, prefix + a (if your prefix is C-a).



pane resizing

Resizing panes

  • prefix + shift + h
    resize current pane 5 cells to the left
  • prefix + shift + j
    resize 5 cells in the down direction
  • prefix + shift + k
    resize 5 cells in the up direction
  • prefix + shift + l
    resize 5 cells to the right

These mappings are repeatable.

The amount of cells to resize can be configured with @pane_resize option. See configuration section for the details.



pane splitting

Splitting panes

  • prefix + |
    split the current pane into two, left and right.
  • prefix + -
    split the current pane into two, top and bottom.
  • prefix + \
    split current pane full width into two, left and right.
  • prefix + _
    split current pane full height into two, top and bottom.

Newly created pane always has the same path as the original pane.






Swapping windows

  • prefix + < - moves current window one position to the left
  • prefix + > - moves current window one position to the right

Installation with Tmux Plugin Manager (recommended)

Add plugin to the list of TPM plugins in .tmux.conf:

set -g @plugin 'tmux-plugins/tmux-pain-control'

Hit prefix + I to fetch the plugin and source it.

You should now have all pain-control bindings defined.

Manual Installation

Clone the repo:

$ git clone https://github.com/tmux-plugins/tmux-pain-control ~/clone/path

Add this line to the bottom of .tmux.conf:

run-shell ~/clone/path/pain_control.tmux

Reload TMUX environment:

# type this in terminal
$ tmux source-file ~/.tmux.conf

You should now have all pain-control bindings defined.

Configuration

You can set @pane_resize Tmux option to choose number of resize cells for the resize bindings. "5" is the default.

Example:

set-option -g @pane_resize "10"

Other plugins

You might also find these useful:

  • sessionist - lightweight tmux utils for switching and creating sessions
  • logging - easy logging and screen capturing

License

MIT

tmux-pain-control's People

Contributors

bruno- avatar janko avatar kaykayehnn avatar m1sports20 avatar sreevardhanreddi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tmux-pain-control's Issues

Idea: Swap panes

Hi!

I found this (and TPM) today and I'm loving it!

There's one thing I'd really like to have; being able to swap panes within a window. Is this possible?

gr,

Tom

Suggestion for refactoring of scripts/save.sh and scripts/restore.sh.

First off, this is an absolutely awesome project and I'm already using it to great success.

While looking through the code I noticed that scripts/save.sh is writing a tab-delimited file of all of the session, window, and pane settings. Later on, scripts/restore.sh reads and parses that file, executing TMUX commands as it goes.

I think it would be much simpler to have the file that scripts/save.sh writes be valid, parseable tmux commands. This would help with reading and debugging of the saved session files and would make scripts/restore.sh much simpler.

I'm happy to put up a PR to refactor this, but I wanted to get your thoughts first.

Add "kill-pane" bindings

How would you feel about adding a key-binding for closing the current pane? For example, in vim you can type <C-w>q. I'm not even sure how to accomplish this in tmux.

prefix + - conflict

On my tmux, prefix+- is set by default to delete last copied buffer (i.e. delete-buffer).
My version of tmux is off git (pulled not so long ago) so I can't tell if it isn't like that in older versions...
I think this conflict should be specified in README.md hopefully along with an alternative binding...

Cheers

Repeatable?

You say Resizing panes is repeatable, what does that mean here? I can repeat on Navigation commands, but that's because I can keep ctrl pressed since my prefix is ctrl + a.

send-keys not working for C-l

Hi there,

I have this setting:

# allow clearing of screen in a shell
bind C-l send-keys 'C-l'

Which allows me to hit C-a-l which is prefix, then hold down control and press lower case L. It's supposed to do the default thing that ctrl-l does and clear the screen. I'm not sure exactly what in tmux-sensible is blocking that, but I get navigated to the right pane instead of it doing the intended thing.

Before I had tmux-sensible installed I did have the same settings it has to navigate splits by prefix h,j,k,l so I know there is a way to have the two co-exist.

If you have any ideas that'd be much appreciated. Thanks!

Split Keys seem inconsistent

The documentation says:

prefix + |
split current pane horizontally
prefix + -
split current pane vertically
prefix + \
split current pane full width horizontally
prefix + _
split current pane full width vertically

I have two problems:

  • The vertical split documentation seems backwards to what actually works:
    For me pressing _ gets a vertical split, and - gets a full-width vertical split. This actually makes more sense to me than the way it is described in the documentation.

  • The horizontal split is inconsistent from the vertical split:
    For full vertical splits you press shift, but for full horizontal splits you don't press shift.
    For in-pane vertical splits you do not press shift, but for in-pane horizontal splits you do press shift.

I suppose this depends on your keyboard (mine is standard US layout), but this seems inconsistent.

I tried changing the bindings in my tmux.conf file, but it doesn't work - is it possible to change the plugin so it doesn't overwrite customizations? I've seen that other plugins work that way.

Thanks!

Compatibility check?

Hey there,

Is this compatible with tmux version 2.6?

It seems to work on 3.2a on Utuntu 22.04.
However, on an 18.04 server with tmux 2.6, none of remapped keys are available.

Unsure how to go about debugging further, but more than happy to help if pointed in the right direction.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.