even more generic
This commit is contained in:
parent
2ec1534e42
commit
c31f8d2e4f
9 changed files with 32 additions and 88 deletions
12
README.md
12
README.md
|
|
@ -3,11 +3,19 @@ zsh
|
|||
|
||||
Zsh configuration using zgen.
|
||||
|
||||
How to use:
|
||||
- fork
|
||||
- add branch named as your user
|
||||
- copy `USER.zsh`, `USER.plugins`, `USER.theme` and `USER.completions` as `${USER}.zsh`, `${USER}.plugins`, `${USER}.theme` and `${USER}.completions`, customize and push
|
||||
- change {{{zsh_config_repo}}} in {{{zshrc}}} and set it in your current shell
|
||||
- run:
|
||||
|
||||
```
|
||||
$ zsh_config_repo=https://forgejo.audin.me/maudin/zsh.git
|
||||
$ git clone https://github.com/tarjoilija/zgen.git "${HOME}/.zgen"
|
||||
$ source ${HOME}/.zgen/zgen.zsh
|
||||
$ zgen clone https://forgejo.audin.me/hybris/zsh.git main
|
||||
$ ln -s ${HOME}/.zgen/https-COLON--SLASH--SLASH-forgejo.audin.me-SLASH-maudin/zsh.git-main/zshrc $HOME/.zshrc
|
||||
$ zgen clone ${zsh_config_repo:-https://forgejo.audin.me/maudin/zsh.git} ${USER}
|
||||
$ ln -sf ${HOME}/.zgen/https-COLON--SLASH--SLASH-forgejo.audin.me-SLASH-maudin/zsh.git-${USER}/zshrc $HOME/.zshrc
|
||||
$ zgen reset
|
||||
$ source ${HOME}/.zshrc
|
||||
```
|
||||
|
|
|
|||
1
USER.completions
Normal file
1
USER.completions
Normal file
|
|
@ -0,0 +1 @@
|
|||
# ZSH custom completions here
|
||||
3
USER.plugins
Normal file
3
USER.plugins
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Zgen plugins here
|
||||
zgen oh-my-zsh
|
||||
zgen oh-my-zsh plugins/colored-man-pages
|
||||
2
USER.theme
Normal file
2
USER.theme
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# ZSH custom theme here
|
||||
PROMPT='%{${fg_bold[blue]}%}%n%{$reset_color%}%{${fg[blue]}%}@%m $%{$reset_color%} '
|
||||
16
USER.zsh
Normal file
16
USER.zsh
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# bip at command end
|
||||
function precmd() {
|
||||
echo -n -e "\a"
|
||||
}
|
||||
|
||||
# history file
|
||||
unsetopt share_history
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt HIST_EXPIRE_DUPS_FIRST
|
||||
HISTSIZE=500000
|
||||
SAVEHIST=500000
|
||||
|
||||
# Fix for compdef, taken from https://github.com/seletskiy/zsh-zgen-compinit-tweak
|
||||
autoload -Uz compinit && compinit -C
|
||||
alias compinit='compinit-zgen'
|
||||
function compinit-zgen() { grep -q ".zgen" <<< "${@}" && \compinit "${@}" }
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# Bookmarks completion using jump plugin
|
||||
compctl -K _completemarks j
|
||||
|
||||
# Hostname completion on various ssh commands
|
||||
function _myssh() {compadd $(ls $INFRA/host)}
|
||||
compdef _myssh r
|
||||
compdef _myssh ra
|
||||
compdef _myssh tramp
|
||||
|
||||
_complete_bt-host() {reply=($(ls $INFRA/host))}
|
||||
compctl -K _complete_bt-host infra host
|
||||
compctl -K _complete_bt-host debian-release
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# specify plugins here
|
||||
zgen oh-my-zsh
|
||||
zgen oh-my-zsh plugins/colored-man-pages
|
||||
zgen oh-my-zsh plugins/colorize
|
||||
zgen oh-my-zsh plugins/extract
|
||||
zgen oh-my-zsh plugins/git
|
||||
zgen oh-my-zsh plugins/jump
|
||||
zgen oh-my-zsh plugins/keychain
|
||||
zgen oh-my-zsh plugins/rsync
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
PROMPT='%{${fg_bold[blue]}%}%n%{$reset_color%}%{${fg[blue]}%}@%m $%{$reset_color%} '
|
||||
RPROMPT='%{$fg[white]%}%~$(git_prompt_info)%{$reset_color%}%(?,,%{${fg_bold[red]}%} [%?]%{$reset_color%})'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[green]%}("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[green]%})%{$fg_bold[red]%}!%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%})"
|
||||
58
maudin.zsh
58
maudin.zsh
|
|
@ -1,58 +0,0 @@
|
|||
# keychain
|
||||
zstyle :omz:plugins:keychain agents gpg,ssh
|
||||
zstyle :omz:plugins:keychain identities id_rsa id_bearstech D79CA887
|
||||
zstyle :omz:plugins:keychain options --quiet
|
||||
|
||||
# bip at command end, ensure correct window title
|
||||
function precmd() {
|
||||
echo -n -e "\a"
|
||||
}
|
||||
|
||||
# history file
|
||||
unsetopt share_history
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt HIST_EXPIRE_DUPS_FIRST
|
||||
HISTSIZE=500000
|
||||
SAVEHIST=500000
|
||||
|
||||
# Disable reserved word foreach
|
||||
disable -r foreach
|
||||
|
||||
# Everyday aliases
|
||||
bt-alerts() {ssh root@${1:-pidou} monshow | grep -v "none$"}
|
||||
debian-release() {ssh root@$1 cat /etc/debian_version}
|
||||
dontknow() {echo -n "¯\\_(ツ)_/¯" | xclip}
|
||||
e() {emacsclient -n $@ > /dev/null 2>&1}
|
||||
tramp() {emacsclient -n $(for x in $@; do echo /root@$x:README; done) > /dev/null 2>&1}
|
||||
j() {if [ $# -eq 0 ]; then marks; else jump $@; fi}
|
||||
noprompt() {if [ "$PROMPT" != '$ ' ]; then export PROMPT='$ '; export RPROMPT=''; else source ~/.zgen/https-COLON--SLASH--SLASH-gitea.audin.me-SLASH-hybris/zsh-master/hybris.theme; fi}
|
||||
open_ports() {if [ $# -eq 1 ] && [ $1 = "public" ]; then sudo netstat -tulpen 2> /dev/null | grep "LISTEN" | grep -v "127.0.0.1"; else sudo netstat -tulpen 2> /dev/null | grep "LISTEN"; fi}
|
||||
r() {if [ $# -gt 0 ]; then for h in $@; do ssh root@$h; done; else sudo su -; fi}
|
||||
ra() {if [ $# -gt 0 ]; then for h in $@; do ssh -A root@$h; done; else sudo su -; fi}
|
||||
|
||||
# Usefull bindings
|
||||
bindkey "^[Od" backward-word
|
||||
bindkey "^[Oc" forward-word
|
||||
|
||||
# Some exports
|
||||
export DISABLE_AUTO_TITLE=true
|
||||
export EDITOR=emacsclient
|
||||
export INFRA=/home/${USER}/dev/bearstech/infra
|
||||
export LESS=-cex2MRX
|
||||
export LESSOPEN='|~/.lessfilter %s'
|
||||
export LOGCHECK=60
|
||||
export READNULLCMD=${PAGER:-/usr/bin/pager}
|
||||
export WATCH=all
|
||||
export WATCHFMT="%n has %a %l from %M"
|
||||
export PATH=$HOME/.scripts:$INFRA/bin:$INFRA/service/xen:$PATH
|
||||
|
||||
# Some completion functions
|
||||
_complete_bt-host() {reply=($(ls $INFRA/host))}
|
||||
compctl -K _complete_bt-host bt-dom0
|
||||
compctl -K _complete_bt-host infra host
|
||||
compctl -K _complete_bt-host bt-release
|
||||
|
||||
# Fix for compdef, taken from https://github.com/seletskiy/zsh-zgen-compinit-tweak
|
||||
autoload -Uz compinit && compinit -C
|
||||
alias compinit='compinit-zgen'
|
||||
function compinit-zgen() { grep -q ".zgen" <<< "${@}" && \compinit "${@}" }
|
||||
Loading…
Reference in a new issue