diff options
Diffstat (limited to 'zsh/.zshrc')
-rw-r--r-- | zsh/.zshrc | 78 |
1 files changed, 51 insertions, 27 deletions
@@ -11,32 +11,7 @@ export BROWSER=firefox | |||
11 | export PATH=$PATH:$HOME/.local/bin:$HOME/bin | 11 | export PATH=$PATH:$HOME/.local/bin:$HOME/bin |
12 | export XDG_CURRENT_DESKTOP=spectrwm | 12 | export XDG_CURRENT_DESKTOP=spectrwm |
13 | 13 | ||
14 | setopt autocd extendedglob nomatch globdots correctall | 14 | #aliases |
15 | unsetopt beep | ||
16 | bindkey -v | ||
17 | |||
18 | # completions | ||
19 | zstyle :compinstall filename '/home/x/.zshrc' | ||
20 | autoload -U colors && colors | ||
21 | autoload -Uz compinit && compinit | ||
22 | zstyle ':completion:*' menu select | ||
23 | zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' | ||
24 | #zstyle ':completion:*:descriptions' format '%U%B%d%b%u' | ||
25 | #zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b' | ||
26 | |||
27 | # sources | ||
28 | source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | ||
29 | source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh | ||
30 | |||
31 | # prompt | ||
32 | PROMPT=$'\n'"%B%F{240}%m "$'\n'"%(?.%F{248}▲.%F{red}?%?)%f " | ||
33 | git_branch() { | ||
34 | git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | ||
35 | } | ||
36 | setopt PROMPT_SUBST | ||
37 | RPROMPT='%9c%{%F{green}%}$(git_branch)%{%F{none}%} $ ' | ||
38 | |||
39 | # aliases | ||
40 | alias ls='ls --color=auto' | 15 | alias ls='ls --color=auto' |
41 | alias ll='ls --color=auto -al' | 16 | alias ll='ls --color=auto -al' |
42 | alias key="vim $HOME/.config/spectrwm/keybindings.conf" | 17 | alias key="vim $HOME/.config/spectrwm/keybindings.conf" |
@@ -52,7 +27,6 @@ alias vimrc="vim $HOME/.config/nvim/init.vim" | |||
52 | alias v="nvim" | 27 | alias v="nvim" |
53 | alias vim="nvim" | 28 | alias vim="nvim" |
54 | alias sudo="sudo " | 29 | alias sudo="sudo " |
55 | alias parrot="VBoxManage startvm Parrot" | ||
56 | 30 | ||
57 | up() { | 31 | up() { |
58 | curl -F "file=@$*" https://0x0.st | xclip -selection clipboard | 32 | curl -F "file=@$*" https://0x0.st | xclip -selection clipboard |
@@ -62,3 +36,53 @@ dict() { | |||
62 | curl dict://dict.org/d:$* | 36 | curl dict://dict.org/d:$* |
63 | } | 37 | } |
64 | 38 | ||
39 | # Enable colors and change prompt: | ||
40 | autoload -U colors && colors | ||
41 | fpath+=$HOME/.zsh/pure | ||
42 | autoload -U promptinit; promptinit | ||
43 | prompt pure | ||
44 | PURE_PROMPT_SYMBOL=$ | ||
45 | #PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " | ||
46 | |||
47 | # Basic auto/tab complete: | ||
48 | autoload -U compinit | ||
49 | zstyle ':completion:*' menu select | ||
50 | zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' | ||
51 | zmodload zsh/complist | ||
52 | compinit | ||
53 | _comp_options+=(globdots) # Include hidden files. | ||
54 | |||
55 | # vi mode | ||
56 | bindkey -v | ||
57 | export KEYTIMEOUT=1 | ||
58 | |||
59 | # Use vim keys in tab complete menu: | ||
60 | bindkey -M menuselect 'h' vi-backward-char | ||
61 | bindkey -M menuselect 'k' vi-up-line-or-history | ||
62 | bindkey -M menuselect 'l' vi-forward-char | ||
63 | bindkey -M menuselect 'j' vi-down-line-or-history | ||
64 | bindkey -v '^?' backward-delete-char | ||
65 | |||
66 | # Change cursor shape for different vi modes. | ||
67 | function zle-keymap-select { | ||
68 | if [[ ${KEYMAP} == vicmd ]] || | ||
69 | [[ $1 = 'block' ]]; then | ||
70 | echo -ne '\e[1 q' | ||
71 | elif [[ ${KEYMAP} == main ]] || | ||
72 | [[ ${KEYMAP} == viins ]] || | ||
73 | [[ ${KEYMAP} = '' ]] || | ||
74 | [[ $1 = 'beam' ]]; then | ||
75 | echo -ne '\e[5 q' | ||
76 | fi | ||
77 | } | ||
78 | zle -N zle-keymap-select | ||
79 | zle-line-init() { | ||
80 | zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) | ||
81 | echo -ne "\e[5 q" | ||
82 | } | ||
83 | zle -N zle-line-init | ||
84 | echo -ne '\e[5 q' # Use beam shape cursor on startup. | ||
85 | preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. | ||
86 | |||
87 | # Load zsh-syntax-highlighting; should be last. | ||
88 | source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null | ||