Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify tmux conf #45

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f9161cf
update read me
howhow Nov 23, 2017
f6c429e
update config
Jun 13, 2018
62a0814
change config file name
Jun 13, 2018
4a1a66f
remove submodule
Jun 13, 2018
a353201
remove submodule
Jun 13, 2018
9464fb1
remove useless config
Jun 13, 2018
ea93cc7
Update README.md
howhow Jun 14, 2018
f40a004
Update README.md
howhow Jun 14, 2018
87d4f57
Update README.md
howhow Jun 14, 2018
3d9dd05
Update README.md
howhow Jun 14, 2018
0343368
update key mapping
Jun 14, 2018
adb958d
Update README.md
howhow Jun 14, 2018
39b3ecd
Merge branch 'master' of https://github.com/howhow/tmux-config
Jun 14, 2018
e6d0f93
Update README.md
howhow Jun 19, 2018
6134951
Update README.md
howhow Jun 19, 2018
1f57be6
Update README.md
howhow Jun 19, 2018
149a2c3
Update README.md
howhow Jun 19, 2018
dc543cb
update install script
Jun 19, 2018
599cfe1
update conf file name
Jul 9, 2018
fdb91cb
Update README.md
howhow Jul 9, 2018
eb301be
Update install.sh
howhow Jul 9, 2018
86ac515
Update README.md
howhow Jul 13, 2018
f52acf5
Update install.sh
howhow Jul 13, 2018
0e26679
update install step
howhow Jul 13, 2018
6cdfee4
Update README.md
howhow Jul 15, 2018
0626055
Update README.md
howhow Jul 15, 2018
914f79b
change color
Jul 16, 2018
25222b0
change color
Jul 16, 2018
d93a551
update color
Jul 16, 2018
ed729d3
update status bar
Jul 16, 2018
6db91d0
update install script
howhow Mar 3, 2020
9100920
update tmux theme after v3.2
howhow Mar 3, 2020
61cffdd
add prefix in status line
howhow Mar 3, 2020
4925db9
disable tmux theme plugin
howhow Mar 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

7 changes: 0 additions & 7 deletions .tmux-osx.conf

This file was deleted.

108 changes: 0 additions & 108 deletions .tmux.conf

This file was deleted.

251 changes: 83 additions & 168 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,193 +1,108 @@
[Tmux](http://tmux.sourceforge.net/) is a terminal multiplexer. Tested with tmux 1.5+.

This config has support for [tmux-mem-cpu-load](http://github.com/thewtex/tmux-mem-cpu-load).

Prefix mapped to Ctrl-A for `screen` users.

New to tmux? Order a copy of my book [*The Tao of tmux*](https://leanpub.com/the-tao-of-tmux) on Leanpub, [Amazon Kindle](http://amzn.to/2gPfRhC) or for free [on the web](https://leanpub.com/the-tao-of-tmux/read).

Want more tmux? Check out the [libtmux](https://github.com/tony/libtmux) python library for controlling tmux, and load your code projects via YAML/JSON with [tmuxp](https://github.com/tony/tmuxp).

Installation
------------

Download:

```bash
git clone https://github.com/tony/tmux-config.git ~/.tmux
```

Copy tmux config to home:

# Use github to sync tmux config
**NOTE**: This repo was forked from [tony/tmux-config](https://github.com/tony/tmux-config) and I made adaptation
- [Tmux](https://github.com/tmux/tmux) version should be higher than **2.5**
- `<prefix>` changed to <kbd>Ctrl</kbd> + <kbd>a</kbd> (because vim use <kbd>Ctrl</kbd> + <kbd>b</kbd>)
- Use [tpm](https://github.com/tmux-plugins/tpm) to manage tmux plug-in, already integrated:
- [tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect):
Restore `tmux` environment after system restart
- [tmux-continuum](https://github.com/tmux-plugins/tmux-continuum):
`tmux` environment will be saved at the interval of 15 minutes. All the saving happens in the background without the impact to your workflow
- [tmux-mem-cpu-load](https://github.com/thewtex/tmux-mem-cpu-load):
A simple, lightweight program provided for system monitoring in the status line of `tmux`

## Download & Installation
Download:
```bash
ln -s ~/.tmux/.tmux.conf ~/.tmux.conf
git clone https://github.com/howhow/tmux-config ~/.my_config/tmux
```

Go to config dir:

Download tpm:
```bash
cd ~/.tmux
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
```

Stats
-----

### tmux-mem-cpu-load

Works on Linux and OS X.

Prep ourself to download submodule:

Link tmux config to home:
```bash
git submodule init
ln -s ~/.my_config/tmux/tmux.conf ~/.tmux.conf
```

Download submodule:

```bash
git submodule update
```
## Start tmux
1. type `tmux` in terminal
2. Press `<prefix>` + <kbd>I</kbd> (**capital** <kbd>I</kbd>, as in **I**nstall) to fetch the plugin.

Change dir to tmux-mem-cpu-load:
You're good to go! The plugin was cloned to `~/.tmux/plugins/` dir and sourced.

## Basic usage
0. pass color option to xterm, set tmux in `alias`
```bash
cd ~/.tmux/vendor/tmux-mem-cpu-load
tmux='TERM=xterm-256color /usr/local/bin'
```

General make file:

1. list all session
```bash
cmake .
tmux ls
```

Compile our binary:

2. create a new session
```bash
make
tmux new -s <session_name>
```

Install our binary to `/usr/local/bin/tmux-mem-cpu-load`:

3. attach to a session
```bash
sudo make install
tmux attch -t <session_name>
```

Go home:

4. kill a session
```bash
cd ~
```

Launch tmux:
tmux kill-session -t <session_name>
```
tmux
```
And press `Control + a` then `d` to go back to the terminal.

Update config:

5. kill all session
```bash
tmux source-file ~/.tmux.conf
```

### basic-cpu-and-memory.tmux

(Cross platform, tested with python 2.7+)

Update March 19, 2014. Works with psutil 2.0 now.

Install ``psutil``:

```bash
sudo pip install psutil
```

copy ``~/.tmux/vendor/basic-cpu-and-memory.tmux`` to bin:

```bash
sudo cp ~/.tmux/vendor/basic-cpu-and-memory.tmux /usr/local/bin/tmux-mem-cpu-load
```

make executable:
```bash
sudo chmod +x /usr/local/bin/tmux-mem-cpu-load
```

### Powerline (Advanced)

You can add suport for [powerline](https://github.com/powerline/powerline) by adding these
to your ``~/.tmux.conf``. Be sure to grab and install [powerline-fonts](https://github.com/powerline/fonts)
for your system.

See [Powerline on ReadTheDocs.org](https://powerline.readthedocs.org/en/master/) for more info.

```
# pip install --user git+git://github.com/powerline/powerline
if-shell 'test -f ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf' 'source-file ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf'

# [sudo] pip install git+git://github.com/powerline/powerline
if-shell 'test -f /usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf' 'source-file /usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf'

# [sudo] pip install git+git://github.com/powerline/powerline
if-shell 'test -f /usr/local/lib/python2.7/dist-packages/powerline/bindings/tmux/powerline.conf' 'source-file /usr/local/lib/python2.7/dist-packages/powerline/bindings/tmux/powerline.conf'
# using python3.3
if-shell 'test -f /usr/local/lib/python3.3/dist-packages/powerline/bindings/tmux/powerline.conf' 'source-file /usr/local/lib/python3.3/dist-packages/powerline/bindings/tmux/powerline.conf'
# python 3.4?
# if-shell 'test -f /usr/local/lib/python3.4/dist-packages/powerline/bindings/tmux/powerline.conf' 'source-file /usr/local/lib/python3.4/dist-packages/powerline/bindings/tmux/powerline.conf'
```

Start tmux
----------

To start a session:

`tmux`

To reattach a previous session:

`tmux attach`

To reload config file

`<Control + b>:` (which could Ctrl-B or Ctrl-A if you overidden it) then `source-file ~/.tmux.conf`

Commands
--------

Our prefix/leader key is `Control + a` now (just like the `screen` multiplexer). This sequence must be typed before any tmux shortcut.

* `Control + a` before any command
* `Control + a` then `?` to bring up list of keyboard shortcuts
* `Control + a` then `"` to split window
* `Control + a` then `<Space>` to change pane arrangement
* `Control + a` then `o` to rotate panes
* `Control + a` then `h`, `j`, `k`, `l` to move left, down, up, right. Respectively. (vim hjkl)
* `Control + a` then `;` to go to last panel

Beyond your first window:

* `Control + a` then `c` to create a new window
* `Control + a` then `n` to next window
* `Control + a` then `p` to previous window
* `Control + a` then `[0-9]` move to window number
* `Control + a` then `&` to kill window

Custom:

* `Control + a` then `m` to switch to ``main-horizontal`` layout with the main window at 60% height.

More configs / Tools
--------------------

* *Save / Load your tmux workspaces through JSON or YAML* with [tmuxp](https://github.com/tony/tmuxp).
* *Clone + Synchronize your git / hg / svn projects through JSON / YAML* with [vcspull](https://github.com/tony/vcspull).
* *Modular, Lazy-loading vim configuration* with support for C, C++, Python, Go and Javascript with [tony/vim-config](https://github.com/tony/vim-config)
* *Modular dot-config example* [tony/.dot-config](https://github.com/tony/.dot-config)

Other
-----

* Github: http://www.github.com/tony
* Website: http://www.git-pull.com
tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill
```

## Keymaps in this `tmux.config`
Our prefix/leader key is <kbd>Ctrl</kbd> + <kbd>a</kbd> now (just like the [screen](https://www.gnu.org/software/screen/) multiplexer). This sequence must be typed before any tmux shortcut. Some keymaps are customized, use `<prefix>` + <kbd>?</kbd> to bring up list of keyboard shortcuts

### For session
| keymap | desc |
|--------|------|
| `<prefix>` + <kbd>:</kbd> + type `new` + <kbd>enter</kbd> | new session |
| `<prefix>` + <kbd>s</kbd> | list sessions |
| `<prefix>` + <kbd>$</kbd> | name session |
| `<prefix>` + <kbd>d</kbd> | de-attach from session |

### For window
| keymap | desc |
|--------|------|
| `<prefix>` + <kbd>w</kbd> | list window |
| `<prefix>` + <kbd>c</kbd> | create a new window |
| `<prefix>` + <kbd>,</kbd> | rename current window |
| `<prefix>` + <kbd>n</kbd> | next window |
| `<prefix>` + <kbd>p</kbd> | previous window |
| `<prefix>` + <kbd>f</kbd> | find window |
| `<prefix>` + <kbd>0</kbd> ~ <kbd>9</kbd> | move to window number `0` ~ `9` |
| `<prefix>` + <kbd>&</kbd> | kill window |

### For panel
| keymap | desc |
|--------|------|
| `<prefix>` + <kbd>-</kbd> | split current window horizontally |
| `<prefix>` + <kbd>\|</kbd> | split current window vertically |
| `<prefix>` + <kbd>q</kbd> | show panel number |
| `<prefix>` + <kbd>x</kbd> | kill a panel |
| `<prefix>` + <kbd>Space></kbd> | to change pane arrangement |
| `<prefix>` + <kbd>o</kbd> | to rotate panes |
| `<prefix>` + <kbd>h</kbd>/<kbd>j</kbd>/<kbd>k</kbd>/<kbd>l</kbd> | to move left/down/up/right. Respectively. (vim hjkl)
| `<prefix>` + <kbd>;</kbd> | to go to last panel |

### Copy-paste mode work flow
1. enter copy mode by `<prefix>` + <kbd>[</kbd> or scroll the mouse
2. move around text via <kbd>h</kbd>/<kbd>j</kbd>/<kbd>k</kbd>/<kbd>l</kbd>
3. press <kbd>v</kbd> to start select word
4. <kbd>h</kbd>/<kbd>j</kbd>/<kbd>k</kbd>/<kbd>l</kbd> or other `vi` key-bind to select, like <kbd>e</kbd>
5. <kbd>y</kbd> to yank
6. exit copy mode by press <kbd>q</kbd>
7. `<prefix>` + <kbd>P</kbd> to paste (**capital** <kbd>P</kbd>)

## Other
* LICENSE: MIT
* Author: Tony Narlock ([email protected])
Loading