mirror of
https://github.com/tmux-plugins/tmux-sensible.git
synced 2025-09-09 15:47:46 +00:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
e725d88256 | |||
ba0b52d999 | |||
b5a1c2ade5 | |||
22d1305cb7 | |||
c20bc5c4e2 | |||
294e607f83 | |||
d2565e5f10 | |||
babfd71d08 | |||
c95eb0d88d | |||
df5b537d21 | |||
bbff707eaa | |||
13f58a8870 | |||
c908b42f2b | |||
9beab4784c | |||
4a584b0799 |
16
CHANGELOG.md
16
CHANGELOG.md
@ -2,6 +2,22 @@
|
|||||||
|
|
||||||
### master
|
### master
|
||||||
|
|
||||||
|
### 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
|
||||||
|
- check before binding `prefix + prefix` (@m1foley)
|
||||||
|
- enable `focus-events`
|
||||||
|
- deprecate 'almost sensible' feature. The reason for this is to focus the
|
||||||
|
plugin on doing just one thing.
|
||||||
|
|
||||||
|
### v2.0.0, 2014-10-03
|
||||||
|
- bugfix: prevent exiting tmux if 'reattach-to-user-namespace' is not installed
|
||||||
|
- remove all mouse-related options
|
||||||
|
- introduce 'almost sensible' setting and options
|
||||||
|
|
||||||
### v1.1.0, 2014-08-30
|
### v1.1.0, 2014-08-30
|
||||||
- bugfix: determine the default shell from the $SHELL env var on OS X
|
- bugfix: determine the default shell from the $SHELL env var on OS X
|
||||||
- set `mode-mouse on` by default
|
- set `mode-mouse on` by default
|
||||||
|
46
README.md
46
README.md
@ -1,14 +1,14 @@
|
|||||||
# Tmux sensible
|
# Tmux sensible
|
||||||
|
|
||||||
A set of tmux options that should be acceptable for everyone.
|
A set of tmux options that should be acceptable to everyone.
|
||||||
|
|
||||||
Inspired by [vim-sensible](https://github.com/tpope/vim-sensible).
|
Inspired by [vim-sensible](https://github.com/tpope/vim-sensible).
|
||||||
|
|
||||||
### Principles
|
### Principles
|
||||||
|
|
||||||
- `tmux-sensible` options should be acceptable to **every** tmux user!<br/>
|
- `tmux-sensible` options should be acceptable to **every** tmux user!<br/>
|
||||||
If any option bothers you, please open an issue and it will probably be
|
If any of the options bothers you, please open an issue and it will probably
|
||||||
updated (or removed).
|
be updated (or removed).
|
||||||
- if you think a new option should be added, feel free to open a pull request.
|
- if you think a new option should be added, feel free to open a pull request.
|
||||||
- **no overriding** of user defined settings.<br/>
|
- **no overriding** of user defined settings.<br/>
|
||||||
Your existing `.tmux.conf` settings are respected and they won't be changed.
|
Your existing `.tmux.conf` settings are respected and they won't be changed.
|
||||||
@ -44,21 +44,26 @@ Inspired by [vim-sensible](https://github.com/tpope/vim-sensible).
|
|||||||
# upgrade $TERM
|
# upgrade $TERM
|
||||||
set -g default-terminal "screen-256color"
|
set -g default-terminal "screen-256color"
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# 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
|
||||||
set -g status-keys emacs
|
set -g status-keys emacs
|
||||||
|
|
||||||
|
# focus events enabled for terminals that support them
|
||||||
|
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
|
||||||
bind C-p previous-window
|
bind C-p previous-window
|
||||||
bind C-n next-window
|
bind C-n next-window
|
||||||
|
|
||||||
|
Above bindings enhance the default `prefix + p` and `prefix + n` bindings by
|
||||||
|
allowing you to hold `Ctrl` and repeat `a + p`/`a + n` (if your prefix is
|
||||||
|
`C-a`), which is a lot quicker.
|
||||||
|
|
||||||
# source .tmux.conf as suggested in `man tmux`
|
# source .tmux.conf as suggested in `man tmux`
|
||||||
bind R source-file '~/.tmux.conf'
|
bind R source-file '~/.tmux.conf'
|
||||||
|
|
||||||
@ -71,14 +76,33 @@ Inspired by [vim-sensible](https://github.com/tpope/vim-sensible).
|
|||||||
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`:
|
||||||
|
|
||||||
set -g @tpm_plugins " \
|
set -g @tpm_plugins ' \
|
||||||
tmux-plugins/tpm \
|
tmux-plugins/tpm \
|
||||||
tmux-plugins/tmux-sensible \
|
tmux-plugins/tmux-sensible \
|
||||||
"
|
'
|
||||||
|
|
||||||
Hit `prefix + I` to fetch the plugin and source it. That's it!
|
Hit `prefix + I` to fetch the plugin and source it. That's it!
|
||||||
|
|
||||||
@ -109,6 +133,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,11 +2,18 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
ALMOST_SENSIBLE_OPTION="@almost-sensible"
|
||||||
|
|
||||||
is_osx() {
|
is_osx() {
|
||||||
local platform=$(uname)
|
local platform=$(uname)
|
||||||
[ "$platform" == "Darwin" ]
|
[ "$platform" == "Darwin" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
command_exists() {
|
||||||
|
local command="$1"
|
||||||
|
type "$command" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
# returns prefix key, e.g. 'C-a'
|
# returns prefix key, e.g. 'C-a'
|
||||||
prefix() {
|
prefix() {
|
||||||
tmux show-option -gv prefix
|
tmux show-option -gv prefix
|
||||||
@ -34,7 +41,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 "bind-key[[:space:]]\+\(-r[[:space:]]\+\)\?${key}"); then
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
@ -52,6 +59,11 @@ 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
|
||||||
|
|
||||||
@ -82,7 +94,7 @@ main() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# required (only) on OS X
|
# required (only) on OS X
|
||||||
if is_osx && option_value_not_changed "default-command" ""; then
|
if is_osx && command_exists "reattach-to-user-namespace" && option_value_not_changed "default-command" ""; then
|
||||||
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
|
||||||
|
|
||||||
@ -91,15 +103,29 @@ main() {
|
|||||||
tmux set-option -g default-terminal "screen-256color"
|
tmux set-option -g default-terminal "screen-256color"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# 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
|
||||||
tmux set-option -g status-keys emacs
|
tmux set-option -g status-keys emacs
|
||||||
|
|
||||||
|
# focus events enabled for terminals that support them
|
||||||
|
tmux set-option -g focus-events on
|
||||||
|
|
||||||
|
# super useful when using "grouped sessions" and multi-monitor setup
|
||||||
|
tmux set-window-option -g aggressive-resize on
|
||||||
|
|
||||||
|
# ALMOST SENSIBLE OPTIONS - DEPRECATED
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
local prefix="$(prefix)"
|
local prefix="$(prefix)"
|
||||||
@ -113,7 +139,9 @@ main() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# pressing `prefix + prefix` sends <prefix> to the shell
|
# pressing `prefix + prefix` sends <prefix> to the shell
|
||||||
tmux bind-key "$prefix" send-prefix
|
if key_binding_not_set "$prefix"; then
|
||||||
|
tmux bind-key "$prefix" send-prefix
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If Ctrl-a is prefix then `Ctrl-a + a` switches between alternate windows.
|
# If Ctrl-a is prefix then `Ctrl-a + a` switches between alternate windows.
|
||||||
|
Reference in New Issue
Block a user