Almost sensible options

pull/13/head v2.0.0
Bruno Sutic 2014-10-03 18:40:53 +02:00
parent 13f58a8870
commit bbff707eaa
No known key found for this signature in database
GPG Key ID: 66D96E4F2F7EF26C
3 changed files with 44 additions and 4 deletions

View File

@ -1,8 +1,11 @@
# Changelog
### master
### 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
- bugfix: determine the default shell from the $SHELL env var on OS X

View File

@ -4,9 +4,9 @@ A set of tmux options that should be acceptable for everyone.
Inspired by [vim-sensible](https://github.com/tpope/vim-sensible).
### Principles
### Core principles
- `tmux-sensible` options should be acceptable to **every** tmux user!<br/>
- core `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
updated (or removed).
- if you think a new option should be added, feel free to open a pull request.
@ -14,13 +14,18 @@ Inspired by [vim-sensible](https://github.com/tpope/vim-sensible).
Your existing `.tmux.conf` settings are respected and they won't be changed.
That way you can use `tmux-sensible` if you have a few specific options.
### Almost sensible principles
- widely used settings that do not make it into the 'core'
- explicitly enabled with `set -g @almost-sensible 'on'`
### Goals
- group standard tmux community options in one place
- remove clutter from your `.tmux.conf`
- educate new tmux users about basic options
### Options
### Core options
# utf8 is on
set -g utf8 on
@ -48,7 +53,7 @@ Inspired by [vim-sensible](https://github.com/tpope/vim-sensible).
# vi keys, even for vim users
set -g status-keys emacs
### Key bindings
### Core key bindings
# easier and faster switching between next/prev window
bind C-p previous-window
@ -70,6 +75,19 @@ 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-z`, above keys will be `C-z` and `z`... you get the idea.
### Almost sensible options
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)
Add plugin to the list of TPM plugins in `.tmux.conf`:

View File

@ -2,6 +2,8 @@
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ALMOST_SENSIBLE_OPTION="@almost-sensible"
is_osx() {
local platform=$(uname)
[ "$platform" == "Darwin" ]
@ -57,6 +59,10 @@ key_binding_not_changed() {
fi
}
almost_sensible_on() {
[ "$(tmux show-option -gvq "$ALMOST_SENSIBLE_OPTION")" == "on" ]
}
main() {
# OPTIONS
@ -100,6 +106,19 @@ main() {
# vi keys, even for vim users
tmux set-option -g status-keys emacs
# ALMOST SENSIBLE OPTIONS
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
local prefix="$(prefix)"