summaryrefslogtreecommitdiffstats
path: root/.config/zsh/README.org
blob: fc4b3a63a0d0a67d679bfa63261d327643ed5708 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#+TITLE: ZSH configuration
#+PROPERTY: header-args :tangle .zshrc

* Table of contents :toc:
- [[#about][About]]
- [[#colors-for-the-prompt][Colors for the prompt]]
- [[#history][History]]
  - [[#basic][Basic]]
  - [[#share-history-between-multiple-zsh-instances][Share history between multiple zsh instances]]
- [[#stuff-for-completions][Stuff for completions]]
- [[#key-bindings][Key bindings]]
  - [[#basic-keybindings][Basic keybindings]]
  - [[#command-line-edit][Command line edit]]
- [[#sourcing-alias-and-plugins-files][Sourcing alias and plugins files]]
- [[#prompt-variables][Prompt variables]]

* About
This is my ~.zshrc~ org file. Pretty straight forward.

* Colors for the prompt
  #+BEGIN_SRC shell
autoload -U colors && colors
  #+END_SRC

* History
** Basic
   #+BEGIN_SRC shell
HISTSIZE=5000
SAVEHIST=5000
HISTFILE=$XDG_CONFIG_HOME/zsh/history
autoload -U history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
   #+END_SRC
 
** Share history between multiple zsh instances
   #+BEGIN_SRC shell
setopt inc_append_history
setopt share_history
   #+END_SRC

* Stuff for completions
#+BEGIN_SRC shell
autoload -U compinit
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors 'di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zmodload zsh/complist
compinit
_comp_options+=(globdots)
#+END_SRC

* Key bindings
** Basic keybindings
  These are my ~zsh~ key bindings, enabling vi mode as well
   #+BEGIN_SRC shell
bindkey -v
export KEYTIMEOUT=1
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -v "^?" backward-delete-char
bindkey -v "^[[A" history-beginning-search-backward
bindkey -v "^[[B" history-beginning-search-forward
bindkey -v "^K" history-beginning-search-backward
bindkey -v "^J" history-beginning-search-forward
bindkey -M vicmd "k" history-beginning-search-backward
bindkey -M vicmd "j" history-beginning-search-forward
   #+END_SRC

** Command line edit
   This allows me to edit the current line with ~C-e~
   #+BEGIN_SRC shell
autoload edit-command-line && zle -N edit-command-line
bindkey "^e" edit-command-line
   #+END_SRC

* Sourcing alias and plugins files
  #+BEGIN_SRC shell
[ -f "$XDG_CONFIG_HOME/zsh/alias.zsh" ]		&& source $ZDOTDIR/alias.zsh
[ -f "$XDG_CONFIG_HOME/zsh/plugins.zsh" ]	&& source $ZDOTDIR/plugins.zsh
  #+END_SRC

* Prompt variables
  #+BEGIN_SRC shell
PROMPT="%B%{$fg[red]%}%M %{$fg[blue]%}%c%{$fg[red]%}%%%{$reset_color%} "
RPROMPT="${RPROMPT}"'%{$fg_bold[red]%}%(?..%?)%{$reset_color%} $(gitprompt)'
  #+END_SRC