~tardypad/dotfiles

ref: 6c6da645bdf106f6cb251579c4eb42cbb0a19e8d dotfiles/files/configs/zsh/config.d/plugins.zsh -rw-r--r-- 2.4 KiB
6c6da645 — Damien Tardy-Panis Remove unused _operands function in _time-tracker completion 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# order of plugins sourcing is important:
# - syntax highlighting at the end
#   because it needs all widgets to be already created
# - history substring search after syntax highlighting
#   as mentioned in their doc
#
# plugin variables need to be defined after sourcing
# because otherwise some get overwritten...

## autosuggestions

source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=fg={color/base03/number}


## syntax highlighting

source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# define all highlighters
ZSH_HIGHLIGHT_HIGHLIGHTERS=(
  main
  brackets
  pattern
  http_env
  influx_env
  mysql_env
  redis_env
)

# highlight potentially dangerous commands that requires extra attention
ZSH_HIGHLIGHT_PATTERNS=('rm -(rf|fr) *' 'bg={color/alert/number},fg={color/base00/number},bold')
ZSH_HIGHLIGHT_PATTERNS+=('rm * -(rf|fr)' 'bg={color/alert/number},fg={color/base00/number},bold')

# brackets matching colors
ZSH_HIGHLIGHT_STYLES[bracket-error]='fg={color/error/number},bold'
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]='fg={color/base05/number},bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg={color/base08/number}'
ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg={color/base09/number}'
ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg={color/base0A/number}'
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg={color/base0B/number}'
ZSH_HIGHLIGHT_STYLES[bracket-level-5]='fg={color/base0C/number}'

# custom highlighters
ZSH_HIGHLIGHT_STYLES[http_env:1]='fg={color/blue/number},bold'
ZSH_HIGHLIGHT_STYLES[http_env:2]='fg={color/blue/number},bold'
ZSH_HIGHLIGHT_STYLES[http_env:3]='fg={color/yellow/number}'
ZSH_HIGHLIGHT_STYLES[http_env:4]='fg={color/magenta/number}'
ZSH_HIGHLIGHT_STYLES[http_env:keywords]='bold'
ZSH_HIGHLIGHT_STYLES[influx_env:1]='fg={color/blue/number},bold'
ZSH_HIGHLIGHT_STYLES[influx_env:keywords]='bold'
ZSH_HIGHLIGHT_STYLES[mysql_env:1]='fg={color/blue/number},bold'
ZSH_HIGHLIGHT_STYLES[mysql_env:keywords]='bold'
ZSH_HIGHLIGHT_STYLES[redis_env:1]='fg={color/blue/number},bold'
ZSH_HIGHLIGHT_STYLES[redis_env:keywords]='bold'


## substring history navigation

source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh

HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg={color/success/number},fg={color/base00/number}'
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg={color/error/number},fg={color/base00/number}'