mirror of
https://github.com/tmux-plugins/tmux-sensible.git
synced 2025-09-09 15:47:46 +00:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
2ce7679f9d | |||
e1aabe4b8a | |||
fff9a53723 | |||
2476f3fb23 | |||
3ea5b9f6b9 | |||
9d61936c53 | |||
e725d88256 | |||
ba0b52d999 | |||
b5a1c2ade5 | |||
22d1305cb7 |
13
CHANGELOG.md
13
CHANGELOG.md
@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
### master
|
### master
|
||||||
|
|
||||||
|
### v3.0.0, 2015-06-24
|
||||||
|
- remove 'almost sensible' feature
|
||||||
|
|
||||||
|
### v2.3.0, 2015-06-24
|
||||||
|
- update to support \*THE\* latest tmux version
|
||||||
|
- bugfix for `prefix + R` key binding
|
||||||
|
- fix for tmux 2.0 `default-terminal` option (thanks @kwbr)
|
||||||
|
|
||||||
|
### v2.2.0, 2015-02-10
|
||||||
|
- bugfix in `key_binding_not_set`: the regex is now properly detecting key
|
||||||
|
bindings with `-r` flag.
|
||||||
|
- enable `aggressive-resize`
|
||||||
|
|
||||||
### v2.1.0, 2014-12-12
|
### v2.1.0, 2014-12-12
|
||||||
- check before binding `prefix + prefix` (@m1foley)
|
- check before binding `prefix + prefix` (@m1foley)
|
||||||
- enable `focus-events`
|
- enable `focus-events`
|
||||||
|
31
README.md
31
README.md
@ -51,6 +51,9 @@ Inspired by [vim-sensible](https://github.com/tpope/vim-sensible).
|
|||||||
# focus events enabled for terminals that support them
|
# focus events enabled for terminals that support them
|
||||||
set -g focus-events on
|
set -g focus-events on
|
||||||
|
|
||||||
|
# super useful when using "grouped sessions" and multi-monitor setup
|
||||||
|
setw -g aggressive-resize on
|
||||||
|
|
||||||
### Key bindings
|
### Key bindings
|
||||||
|
|
||||||
# easier and faster switching between next/prev window
|
# easier and faster switching between next/prev window
|
||||||
@ -73,25 +76,6 @@ allowing you to hold `Ctrl` and repeat `a + p`/`a + n` (if your prefix is
|
|||||||
If prefix is `C-b`, above keys will be `C-b` and `b`.<br/>
|
If prefix is `C-b`, above keys will be `C-b` and `b`.<br/>
|
||||||
If prefix is `C-z`, above keys will be `C-z` and `z`... you get the idea.
|
If prefix is `C-z`, above keys will be `C-z` and `z`... you get the idea.
|
||||||
|
|
||||||
### Almost sensible options - deprecated
|
|
||||||
|
|
||||||
**Note**: this feature is deprecated and will be removed from `tmux-sensible`
|
|
||||||
in the next major release. The reason for this is to focus this plugin on doing
|
|
||||||
just one thing (and hopefully doing it well).<br/>
|
|
||||||
If you were using 'almost sensible' the path forward is to move all the
|
|
||||||
below options to your `.tmux.conf`.
|
|
||||||
|
|
||||||
Activate these by putting `set -g @almost-sensible 'on'` in `.tmux.conf`.
|
|
||||||
|
|
||||||
# C-a should be the Tmux default prefix, really
|
|
||||||
set -g prefix C-a
|
|
||||||
set -g mode-keys vi
|
|
||||||
|
|
||||||
# enable mouse features for terminals that support it
|
|
||||||
set -g mouse-resize-pane on
|
|
||||||
set -g mouse-select-pane on
|
|
||||||
set -g mouse-select-window on
|
|
||||||
|
|
||||||
### Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) (recommended)
|
### Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) (recommended)
|
||||||
|
|
||||||
Add plugin to the list of TPM plugins in `.tmux.conf`:
|
Add plugin to the list of TPM plugins in `.tmux.conf`:
|
||||||
@ -115,12 +99,7 @@ Add this line to the bottom of `.tmux.conf`:
|
|||||||
|
|
||||||
run-shell ~/clone/path/sensible.tmux
|
run-shell ~/clone/path/sensible.tmux
|
||||||
|
|
||||||
Reload TMUX environment:
|
Reload TMUX environment with `$ tmux source-file ~/.tmux.conf`, and that's it.
|
||||||
|
|
||||||
# type this in terminal
|
|
||||||
$ tmux source-file ~/.tmux.conf
|
|
||||||
|
|
||||||
You might also want to restart your tmux server, just in case.
|
|
||||||
|
|
||||||
### Other goodies
|
### Other goodies
|
||||||
|
|
||||||
@ -130,6 +109,8 @@ You might also find these useful:
|
|||||||
improve tmux search and reduce mouse usage
|
improve tmux search and reduce mouse usage
|
||||||
- [pain control](https://github.com/tmux-plugins/tmux-pain-control)
|
- [pain control](https://github.com/tmux-plugins/tmux-pain-control)
|
||||||
useful standard bindings for controlling panes
|
useful standard bindings for controlling panes
|
||||||
|
- [resurrect](https://github.com/tmux-plugins/tmux-resurrect)
|
||||||
|
persists tmux environment across system restarts
|
||||||
|
|
||||||
### License
|
### License
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
ALMOST_SENSIBLE_OPTION="@almost-sensible"
|
# used to match output from `tmux list-keys`
|
||||||
|
KEY_BINDING_REGEX="bind-key[[:space:]]\+\(-r[[:space:]]\+\)\?\(-T prefix[[:space:]]\+\)\?"
|
||||||
|
|
||||||
is_osx() {
|
is_osx() {
|
||||||
local platform=$(uname)
|
local platform=$(uname)
|
||||||
@ -41,7 +42,7 @@ server_option_value_not_changed() {
|
|||||||
|
|
||||||
key_binding_not_set() {
|
key_binding_not_set() {
|
||||||
local key="$1"
|
local key="$1"
|
||||||
if $(tmux list-keys | grep -q "bind-key[[:space:]]\+${key}"); then
|
if $(tmux list-keys | grep -q "${KEY_BINDING_REGEX}${key}[[:space:]]"); then
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
@ -51,7 +52,7 @@ key_binding_not_set() {
|
|||||||
key_binding_not_changed() {
|
key_binding_not_changed() {
|
||||||
local key="$1"
|
local key="$1"
|
||||||
local default_value="$2"
|
local default_value="$2"
|
||||||
if $(tmux list-keys | grep -q "bind-key[[:space:]]\+${key}[[:space:]]\+${default_value}"); then
|
if $(tmux list-keys | grep -q "${KEY_BINDING_REGEX}${key}[[:space:]]\+${default_value}"); then
|
||||||
# key still has the default binding
|
# key still has the default binding
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
@ -59,11 +60,6 @@ key_binding_not_changed() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# "almost sensible" is deprecated
|
|
||||||
almost_sensible_on() {
|
|
||||||
[ "$(tmux show-option -gvq "$ALMOST_SENSIBLE_OPTION")" == "on" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
|
||||||
@ -98,10 +94,14 @@ main() {
|
|||||||
tmux set-option -g default-command "reattach-to-user-namespace -l $SHELL"
|
tmux set-option -g default-command "reattach-to-user-namespace -l $SHELL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# upgrade $TERM
|
# upgrade $TERM, tmux 1.9
|
||||||
if option_value_not_changed "default-terminal" "screen"; then
|
if option_value_not_changed "default-terminal" "screen"; then
|
||||||
tmux set-option -g default-terminal "screen-256color"
|
tmux set-option -g default-terminal "screen-256color"
|
||||||
fi
|
fi
|
||||||
|
# upgrade $TERM, tmux 2.0+
|
||||||
|
if server_option_value_not_changed "default-terminal" "screen"; then
|
||||||
|
tmux set-option -s default-terminal "screen-256color"
|
||||||
|
fi
|
||||||
|
|
||||||
# emacs key bindings in tmux command prompt (prefix + :) are better than
|
# emacs key bindings in tmux command prompt (prefix + :) are better than
|
||||||
# vi keys, even for vim users
|
# vi keys, even for vim users
|
||||||
@ -110,18 +110,8 @@ main() {
|
|||||||
# focus events enabled for terminals that support them
|
# focus events enabled for terminals that support them
|
||||||
tmux set-option -g focus-events on
|
tmux set-option -g focus-events on
|
||||||
|
|
||||||
# ALMOST SENSIBLE OPTIONS - DEPRECATED
|
# super useful when using "grouped sessions" and multi-monitor setup
|
||||||
|
tmux set-window-option -g aggressive-resize on
|
||||||
if almost_sensible_on; then
|
|
||||||
# C-a should be the Tmux default prefix, really
|
|
||||||
tmux set-option -g prefix C-a
|
|
||||||
tmux set-option -g mode-keys vi
|
|
||||||
|
|
||||||
# enable mouse features for terminals that support it
|
|
||||||
tmux set-option -g mouse-resize-pane on
|
|
||||||
tmux set-option -g mouse-select-pane on
|
|
||||||
tmux set-option -g mouse-select-window on
|
|
||||||
fi
|
|
||||||
|
|
||||||
# DEFAULT KEY BINDINGS
|
# DEFAULT KEY BINDINGS
|
||||||
|
|
||||||
@ -157,7 +147,7 @@ main() {
|
|||||||
|
|
||||||
# source `.tmux.conf` file - as suggested in `man tmux`
|
# source `.tmux.conf` file - as suggested in `man tmux`
|
||||||
if key_binding_not_set "R"; then
|
if key_binding_not_set "R"; then
|
||||||
tmux bind-key R run-shell -b ' \
|
tmux bind-key R run-shell ' \
|
||||||
tmux source-file ~/.tmux.conf > /dev/null; \
|
tmux source-file ~/.tmux.conf > /dev/null; \
|
||||||
tmux display-message "Sourced .tmux.conf!"'
|
tmux display-message "Sourced .tmux.conf!"'
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user