Добавлены конфиги tmux и zsh

This commit is contained in:
eKa
2019-09-18 00:17:47 +05:00
commit 7d0a7691c6
882 changed files with 67305 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Erick Pintor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,111 @@
# Tmux prefix highlight
Plugin that highlights when you press tmux prefix key. Inspired by
[this](http://stackoverflow.com/questions/12003726/give-a-hint-when-press-prefix-key-in-tmux)
thread on stackoverflow.
Many thanks to [@obxhdx](https://github.com/obxhdx) for showing me this trick.
Prefix off:
![prefix_off](screenshots/prefix_off.png)
Prefix on:
![prefix_on](screenshots/prefix_on.png)
### Usage
Just add `#{prefix_highlight}` to your left/right status bar.
```tmux.conf
set -g status-right '#{prefix_highlight} | %a %Y-%m-%d %H:%M'
```
The plugin can also be configured to show when copy mode is active; see the
**Configurations** section for details.
### Installation with Tmux Plugin Manager (recommended)
Add plugin to the list of TPM plugins:
```tmux.conf
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
```
Press prefix + I to install it.
### Manual Installation
Clone the repo:
```bash
$ git clone https://github.com/tmux-plugins/tmux-prefix-highlight.git ~/clone/path
```
Add this line to your .tmux.conf:
```tmux.conf
run-shell ~/clone/path/prefix_highlight.tmux
```
Reload TMUX environment with:
```bash
$ tmux source-file ~/.tmux.conf
```
### Configurations
The colors used for the prefix highlight can be configured:
```tmux.conf
set -g @prefix_highlight_fg 'white' # default is 'colour231'
set -g @prefix_highlight_bg 'blue' # default is 'colour04'
```
The plugin can also be configured to show when copy mode is active. If enabled,
the `#{prefix_highlight}` token will be replaced with the string `Copy` when
copy mode is enabled. The style for copy mode can be configured as a
comma-separated list of colors and attributes:
```tmux.conf
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold' # default is 'fg=default,bg=yellow'
```
The `prefix` prompt and `copy` prompt can also be configured:
```tmux.conf
set -g @prefix_highlight_prefix_prompt 'Wait'
set -g @prefix_highlight_copy_prompt 'Copy'
```
Additionally, the plugin can be configured to attach optional affixes to the
value contained in `#{prefix_highlight}`.
(e.g. `< ^B >`)
```tmux.conf
set -g @prefix_highlight_output_prefix '< '
set -g @prefix_highlight_output_suffix ' >'
```
The empty (shown when prefix is off) prompt and attribute can be configured,
It is useful for aligning segments.
```tmux.conf
set -g @prefix_highlight_empty_prompt ' ' # default is '' (empty char)
set -g @prefix_highlight_empty_attr 'fg=default,bg=green' # default is 'fg=default,bg=default'
```
Defaultly, empty prompt can't be attached optional affixes.
If you want attach affixes on empty prompt, config `@prefix_highlight_empty_has_affixes` to `on`.
```tmux.conf
set -g @prefix_highlight_empty_has_affixes 'on' # default is 'off'
set -g @prefix_highlight_empty_prompt 'Tmux'
set -g @prefix_highlight_output_prefix '< '
set -g @prefix_highlight_output_suffix ' >'
```
### License
[MIT](LICENSE)

View File

@@ -0,0 +1,117 @@
#!/usr/bin/env bash
set -e
# Place holder for status left/right
place_holder="\#{prefix_highlight}"
# Possible configurations
fg_color_config='@prefix_highlight_fg'
bg_color_config='@prefix_highlight_bg'
output_prefix='@prefix_highlight_output_prefix'
output_suffix='@prefix_highlight_output_suffix'
show_copy_config='@prefix_highlight_show_copy_mode'
copy_attr_config='@prefix_highlight_copy_mode_attr'
prefix_prompt='@prefix_highlight_prefix_prompt'
copy_prompt='@prefix_highlight_copy_prompt'
empty_prompt='@prefix_highlight_empty_prompt'
empty_attr_config='@prefix_highlight_empty_attr'
empty_has_affixes='@prefix_highlight_empty_has_affixes'
tmux_option() {
local -r value=$(tmux show-option -gqv "$1")
local -r default="$2"
if [ ! -z "$value" ]; then
echo "$value"
else
echo "$default"
fi
}
# Defaults
default_fg='colour231'
default_bg='colour04'
default_copy_attr='fg=default,bg=yellow'
default_empty_attr='fg=default,bg=default'
default_prefix_prompt=$(tmux_option prefix | tr "[:lower:]" "[:upper:]" | sed 's/C-/\^/')
default_copy_prompt='Copy'
default_empty_prompt=''
highlight() {
local -r \
status="$1" \
prefix="$2" \
prefix_highlight="$3" \
show_copy_mode="$4" \
copy_highlight="$5" \
output_prefix="$6" \
output_suffix="$7" \
copy="$8" \
empty="$9"
local -r status_value="$(tmux_option "$status")"
local -r prefix_with_optional_affixes="$output_prefix$prefix$output_suffix"
local -r copy_with_optional_affixes="$output_prefix$copy$output_suffix"
if [[ "on" = "$empty_has_affixes" ]]; then
local -r empty_with_optional_affixes="$output_prefix$empty$output_suffix"
else
local -r empty_with_optional_affixes="$empty"
fi
if [[ "on" = "$show_copy_mode" ]]; then
local -r fallback="${copy_highlight}#{?pane_in_mode,$copy_with_optional_affixes,${empty_highlight}$empty_with_optional_affixes}"
else
local -r fallback="${empty_highlight}$empty_with_optional_affixes"
fi
local -r highlight_on_prefix="${prefix_highlight}#{?client_prefix,$prefix_with_optional_affixes,$fallback}#[default]"
tmux set-option -gq "$status" "${status_value/$place_holder/$highlight_on_prefix}"
}
main() {
local -r \
fg_color=$(tmux_option "$fg_color_config" "$default_fg") \
bg_color=$(tmux_option "$bg_color_config" "$default_bg") \
show_copy_mode=$(tmux_option "$show_copy_config" "off") \
output_prefix=$(tmux_option "$output_prefix" " ") \
output_suffix=$(tmux_option "$output_suffix" " ") \
copy_attr=$(tmux_option "$copy_attr_config" "$default_copy_attr") \
prefix_prompt=$(tmux_option "$prefix_prompt" "$default_prefix_prompt") \
copy_prompt=$(tmux_option "$copy_prompt" "$default_copy_prompt") \
empty_prompt=$(tmux_option "$empty_prompt" "$default_empty_prompt") \
empty_attr=$(tmux_option "$empty_attr_config" "$default_empty_attr") \
empty_has_affixes=$(tmux_option "$empty_has_affixes" "off")
local -r \
prefix_highlight="#[fg=$fg_color,bg=$bg_color]" \
copy_highlight="${copy_attr:+#[default,$copy_attr]}" \
empty_highlight="${empty_attr:+#[default,$empty_attr]}"
highlight "status-right" \
"$prefix_prompt" \
"$prefix_highlight" \
"$show_copy_mode" \
"$copy_highlight" \
"$output_prefix" \
"$output_suffix" \
"$copy_prompt" \
"$empty_prompt" \
"$empty_highlight" \
"$empty_has_affixes"
highlight "status-left" \
"$prefix_prompt" \
"$prefix_highlight" \
"$show_copy_mode" \
"$copy_highlight" \
"$output_prefix" \
"$output_suffix" \
"$copy_prompt" \
"$empty_prompt" \
"$empty_highlight" \
"$empty_has_affixes"
}
main