From 131d10321c0686125e10aec4020aae842d571d8f Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Sat, 25 Mar 2023 23:07:13 +0100 Subject: [PATCH] zsh configuration --- oh-my-zsh/themes/lsambuc.zsh-theme | 30 ++++++++ zshrc | 115 +++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 oh-my-zsh/themes/lsambuc.zsh-theme create mode 100644 zshrc diff --git a/oh-my-zsh/themes/lsambuc.zsh-theme b/oh-my-zsh/themes/lsambuc.zsh-theme new file mode 100644 index 0000000..068f511 --- /dev/null +++ b/oh-my-zsh/themes/lsambuc.zsh-theme @@ -0,0 +1,30 @@ +if [ "$(whoami)" = "root" ]; then USERCOLOR="red"; else USERCOLOR="green"; fi + +local return_code="%(?.. %{$fg[red]%}%?%{$reset_color%})" +local time_field="%{$fg_bold[blue]%}%D{%H:%M}" +local user_field="%{$fg_bold[$USERCOLOR]%}%n" +local path_field="%{$reset_color%}%20<..<%~%<<" + +# With Git status +PROMPT='${time_field} %{$fg_bold[white]%}[${user_field}%{${reset_color}%}@%m%{$fg_bold[blue]%}:${path_field}%{$fg_bold[white]%}]$(git_prompt_info)${return_code} %{${fg_bold[yellow]}%}»%{${reset_color}%} ' + +# Without Git status +#PROMPT='${time_field} $fg_bold[white][${user_field}%{${reset_color}%}@%m%{$fg_bold[blue]%}:${path_field}$fg_bold[white]] %{${fg_bold[yellow]}%}»%{${reset_color}%} ' + +# GIT Status theming +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✗" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +#export LSCOLORS="Gxfxcxdxbxegedabagacad" +#export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:' + + +# Redefine git_prompt_info +function git_prompt_info () { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + diff --git a/zshrc b/zshrc new file mode 100644 index 0000000..25900c1 --- /dev/null +++ b/zshrc @@ -0,0 +1,115 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="$HOME/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="robbyrussell" +ZSH_THEME="clean" #all info, nice color, time on the right +ZSH_THEME="gnzh" # two liner, nice arrow +ZSH_THEME="lsambuc" # one liner, fixed path, time, hostname + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment one of the following lines to change the auto-update behavior +# zstyle ':omz:update' mode disabled # disable automatic updates +# zstyle ':omz:update' mode auto # update automatically without asking +# zstyle ':omz:update' mode reminder # just remind me to update when it's time + +# Uncomment the following line to change how often to auto-update (in days). +# zstyle ':omz:update' frequency 13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# You can also set it to another string to have that shown instead of the default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) +COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +HIST_STAMPS="yyyy-mm-dd" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +unsetopt correct_all + +# Default editor: VI/VIM +export VISUAL=vi +export EDITOR=vi + +# Alias definitions. +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi