Zsh for kubernetes okd » Historie » Zyklus 2
Peter Pfläging, 24.06.2021 14:59
1 | 2 | Peter Pfläging | # |
---|---|---|---|
2 |  |
||
3 | Zsh for kubernetes okd |
||
4 | 1 | Peter Pfläging | |
5 | 2 | Peter Pfläging | It's fine to see the actual kube oder oc env, the git status of the actual dir in the prompt: |
6 | |||
7 | * install `zsh` |
||
8 | * MacOS (it's there and OK) |
||
9 | * CentOS, RHEL, fedora: `sudo install -y zsh` |
||
10 | * Debian, Ubuntu, raspbian: `sudo apt install -y zsh` |
||
11 | * Windows? =Y You're kidding, use WSL2 |
||
12 | * change your login shell like: `usermod -s /bin/zsh $USER` |
||
13 | * install ohmyz.sh: `sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
||
14 | * create a `~/.zshrc` with the following content: |
||
15 | |||
16 | ~~~ |
||
17 | ZSH_DISABLE_COMPFIX=true |
||
18 | export ZSH="$HOME/.oh-my-zsh" |
||
19 | ZSH_THEME="agnoster" |
||
20 | export KUBE_PS1_BINARY=oc |
||
21 | export KUBE_PS1_SYMBOL_USE_IMG=true |
||
22 | export KUBE_PS1_BG_COLOR=black |
||
23 | export KUBE_PS1_SYMBOL_COLOR=red |
||
24 | export KUBE_PS1_CTX_COLOR=blue |
||
25 | function get_cluster_short() { |
||
26 | echo "$1" | sed 's&.*/api-\([^-]*\)-.*:6443/\(.*\)&\1/\2&' |
||
27 | } |
||
28 | KUBE_PS1_CLUSTER_FUNCTION=get_cluster_short |
||
29 | if [[ -n $TERM_PROGRAM ]]; then |
||
30 | #we're on a macos |
||
31 | plugins=(ansible bundler django docker docker-compose git iterm2 kubectl oc python ruby tmux rails themes kube-ps1 chezmoi) |
||
32 | else |
||
33 | # we're everywhere else |
||
34 | plugins=(ansible bundler git kubectl oc python ruby tmux themes kube-ps1) |
||
35 | fi |
||
36 | source $ZSH/oh-my-zsh.sh |
||
37 | if [[ -n $SSH_CONNECTION ]]; then |
||
38 | 1 | Peter Pfläging | export EDITOR='emacs -nw' |
39 | 2 | Peter Pfläging | else |
40 | export EDITOR='emacs -nw' |
||
41 | fi |
||
42 | if [[ -d /Library ]]; then |
||
43 | #we're on a macos |
||
44 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home/ |
||
45 | else |
||
46 | # we're everywhere else |
||
47 | export EDITOR=vi |
||
48 | fi |
||
49 | if command -v emacs &> /dev/null |
||
50 | then |
||
51 | export EDITOR='emacs -nw' |
||
52 | 1 | Peter Pfläging | alias emacs='emacs -nw' |
53 | 2 | Peter Pfläging | else |
54 | 1 | Peter Pfläging | export EDITOR='vi' |
55 | 2 | Peter Pfläging | fi |
56 | export PATH=$PATH:$HOME/go/bin |
||
57 | test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" |
||
58 | test -e "${HOME}/.zshrc_local" && source "${HOME}/.zshrc_local" |
||
59 | export PROMPT='$(kube_ps1)'$PROMPT |
||
60 | ~~~ |
||
61 | |||
62 | * for local mods, put them in `$HOME/.zshrc_local` |
||
63 | |||
64 | * install `kubectl` and `oc` |