summaryrefslogtreecommitdiff
path: root/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.zshrc78
1 files changed, 51 insertions, 27 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc
index eb0636d..34f59ae 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -11,32 +11,7 @@ export BROWSER=firefox
11export PATH=$PATH:$HOME/.local/bin:$HOME/bin 11export PATH=$PATH:$HOME/.local/bin:$HOME/bin
12export XDG_CURRENT_DESKTOP=spectrwm 12export XDG_CURRENT_DESKTOP=spectrwm
13 13
14setopt autocd extendedglob nomatch globdots correctall 14#aliases
15unsetopt beep
16bindkey -v
17
18# completions
19zstyle :compinstall filename '/home/x/.zshrc'
20autoload -U colors && colors
21autoload -Uz compinit && compinit
22zstyle ':completion:*' menu select
23zstyle ':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
28source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
29source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
30
31# prompt
32PROMPT=$'\n'"%B%F{240}%m "$'\n'"%(?.%F{248}▲.%F{red}?%?)%f "
33git_branch() {
34 git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
35}
36setopt PROMPT_SUBST
37RPROMPT='%9c%{%F{green}%}$(git_branch)%{%F{none}%} $ '
38
39# aliases
40alias ls='ls --color=auto' 15alias ls='ls --color=auto'
41alias ll='ls --color=auto -al' 16alias ll='ls --color=auto -al'
42alias key="vim $HOME/.config/spectrwm/keybindings.conf" 17alias key="vim $HOME/.config/spectrwm/keybindings.conf"
@@ -52,7 +27,6 @@ alias vimrc="vim $HOME/.config/nvim/init.vim"
52alias v="nvim" 27alias v="nvim"
53alias vim="nvim" 28alias vim="nvim"
54alias sudo="sudo " 29alias sudo="sudo "
55alias parrot="VBoxManage startvm Parrot"
56 30
57up() { 31up() {
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:
40autoload -U colors && colors
41fpath+=$HOME/.zsh/pure
42autoload -U promptinit; promptinit
43prompt pure
44PURE_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:
48autoload -U compinit
49zstyle ':completion:*' menu select
50zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
51zmodload zsh/complist
52compinit
53_comp_options+=(globdots) # Include hidden files.
54
55# vi mode
56bindkey -v
57export KEYTIMEOUT=1
58
59# Use vim keys in tab complete menu:
60bindkey -M menuselect 'h' vi-backward-char
61bindkey -M menuselect 'k' vi-up-line-or-history
62bindkey -M menuselect 'l' vi-forward-char
63bindkey -M menuselect 'j' vi-down-line-or-history
64bindkey -v '^?' backward-delete-char
65
66# Change cursor shape for different vi modes.
67function 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}
78zle -N zle-keymap-select
79zle-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}
83zle -N zle-line-init
84echo -ne '\e[5 q' # Use beam shape cursor on startup.
85preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
86
87# Load zsh-syntax-highlighting; should be last.
88source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null