From 0aa8fdde469a74df76ef422decfff211eeaa5b6e Mon Sep 17 00:00:00 2001 From: psox Date: Thu, 22 Jul 2021 20:27:21 +0100 Subject: [PATCH] Added support for starship and did some cleanup --- etc/tmux-1.conf | 23 ------ etc/vimrc.local | 52 -------------- oh-my-zsh | 2 +- starship.toml | 81 ++++++++++++++++++++++ tmux/plugins/tpm | 2 +- zsh-custom/plugins/zsh-autosuggestions | 2 +- zsh-custom/plugins/zsh-completions | 2 +- zsh-custom/plugins/zsh-syntax-highlighting | 2 +- zshrc | 76 ++++---------------- 9 files changed, 101 insertions(+), 141 deletions(-) delete mode 100644 etc/tmux-1.conf delete mode 100644 etc/vimrc.local create mode 100644 starship.toml diff --git a/etc/tmux-1.conf b/etc/tmux-1.conf deleted file mode 100644 index be2c6f8..0000000 --- a/etc/tmux-1.conf +++ /dev/null @@ -1,23 +0,0 @@ -set-option -g prefix C-a -bind-key C-a last-window -bind-key a send-prefix -#set -g mode-mouse off -#set -g mouse-resize-pane off -#set -g mouse-select-pane off -#set -g mouse-select-window off -set -g base-index 1 -set -s escape-time 0 -setw -g aggressive-resize on -setw -g monitor-activity on -set -g visual-activity on -set -g status-left ' #[fg=blue,bold]#h #S:#I.#P (#D) #[default]' -set -g status-right '#T #[fg=yellow,bold]#(uptime | cut -d, -f4 | cut -d " " -f 4-7)#[default] #[fg=cyan,bold]%Y-%m-%d %H:%M:%S#[default] ' -set -g status-fg '#EEEEEE' -set -g status-bg '#333333' -set -g set-titles on -bind-key e set-window-option synchronize-panes on -bind-key E set-window-option synchronize-panes off -bind m set -g mode-mouse on \; set -g mouse-resize-pane on \; set -g mouse-select-pane on \; set -g mouse-select-window on \; display 'Mouse: ON' -bind M set -g mode-mouse off \; set -g mouse-resize-pane off \; set -g mouse-select-pane off \; set -g mouse-select-window off \; display 'Mouse: OFF' -bind + new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \; swap-pane -s tmux-zoom.0 \; select-window -t tmux-zoom -bind - last-window \; swap-pane -s tmux-zoom.0 \; kill-window -t tmux-zoom diff --git a/etc/vimrc.local b/etc/vimrc.local deleted file mode 100644 index ccbb68c..0000000 --- a/etc/vimrc.local +++ /dev/null @@ -1,52 +0,0 @@ -set guifont=Fira\ Code\ 11 - -set encoding=utf-8 - -set nocompatible -colorscheme murphy -syntax on -set background=dark - -" Uncomment the following to have Vim jump to the last position when -" reopening a file -if has("autocmd") - au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") - \| exe "normal! g'\"" | endif -endif - -" Uncomment the following to have Vim load indentation rules according to the -" detected filetype. Per default Debian Vim only load filetype specific -" plugins. -if has("autocmd") - filetype indent on -endif - -set showcmd " Show (partial) command in status line. -set showmatch " Show matching brackets. -set smartcase " Do smart case matching -set incsearch " Incremental search -set ww=b,s,<,>,[,] -set sta -set visualbell -set mousemodel=popup_setpos - -highlight SpellErrors ctermfg=Red guifg=Red cterm=underline gui=underline term=reverse -let spell_language_list = "americanxlg,american,americanmed+,english" -let spell_insert_mode = 1 -let spell_executable = "ispell" -let spell_auto_type = "" -"let spell_auto_type = "tex,mail,text,html,sgml,otl,cvs,none" - -" other -set shiftwidth=2 -set tabstop=8 -set softtabstop=2 -set expandtab -filetype plugin indent on -autocmd FileType yaml setl indentkeys-=<:> -autocmd FileType yaml setlocal ts=8 sts=2 sw=2 expandtab - -set modeline -set modelines=7 - -" vim: syntax=vim diff --git a/oh-my-zsh b/oh-my-zsh index 48a3c2f..dac3314 160000 --- a/oh-my-zsh +++ b/oh-my-zsh @@ -1 +1 @@ -Subproject commit 48a3c2f32d1a4643db367eed4d6c53768c3847b1 +Subproject commit dac3314c76e799cddbbe5cf63870d31861626059 diff --git a/starship.toml b/starship.toml new file mode 100644 index 0000000..3ab519d --- /dev/null +++ b/starship.toml @@ -0,0 +1,81 @@ + +format = """ +\\[$username@$hostname\\] $directory \ +$git_branch\ +$git_commit\ +$git_state\ +$git_status\ +$kubernetes\ +$docker_context\ +$aws\ +$terraform\ +$package\ +$cmake\ +$golang\ +$helm\ +$java\ +$nodejs\ +$perl\ +$php\ +$python\ +$rust\ +$nix_shell\ +$memory_usage\ +$env_var\ +$cmd_duration\ +$custom\ +$jobs\ +$status +$time $character\ +""" + +[cmd_duration] +min_time = 0 +show_milliseconds = true +format = " [ ⏱ $duration](bold blue)" + +[time] +disabled = false +time_format = "%FT%T" +format = "[$time]($style)" + +[git_status] +disabled = false + +[git_state] +disabled = false + +[directory] +truncation_length = 0 +truncate_to_repo = false +read_only = " 🔒" +format = "\\[[$path]($style)\\][$read_only](bold yellow)" + +[hostname] +disabled = false +ssh_only = false +format = "[$hostname]($style)" + +[username] +disabled = false +show_always = true +format = "[$user]($style)" + +[status] +format = '[ \[$symbol $status\]]($style) ' +map_symbol = true +disabled = false + +[docker_context] +only_with_files = false +disabled = false + +[aws] +disabled = false + +[kubernetes] +disabled = false + +[terraform] +disabled = false + diff --git a/tmux/plugins/tpm b/tmux/plugins/tpm index 2afeff1..108f76b 160000 --- a/tmux/plugins/tpm +++ b/tmux/plugins/tpm @@ -1 +1 @@ -Subproject commit 2afeff1529ec85d0c5ced5ece3714c2220b646a5 +Subproject commit 108f76b628a0df927df142036f1fdec829a5ff00 diff --git a/zsh-custom/plugins/zsh-autosuggestions b/zsh-custom/plugins/zsh-autosuggestions index ae315de..a411ef3 160000 --- a/zsh-custom/plugins/zsh-autosuggestions +++ b/zsh-custom/plugins/zsh-autosuggestions @@ -1 +1 @@ -Subproject commit ae315ded4dba10685dbbafbfa2ff3c1aefeb490d +Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8 diff --git a/zsh-custom/plugins/zsh-completions b/zsh-custom/plugins/zsh-completions index 773ead6..d4511c2 160000 --- a/zsh-custom/plugins/zsh-completions +++ b/zsh-custom/plugins/zsh-completions @@ -1 +1 @@ -Subproject commit 773ead6ea7b579106624851404d4f651acd5e042 +Subproject commit d4511c23659381b56dec8be8c8553b7ff3dc5fd8 diff --git a/zsh-custom/plugins/zsh-syntax-highlighting b/zsh-custom/plugins/zsh-syntax-highlighting index ebef4e5..dffe304 160000 --- a/zsh-custom/plugins/zsh-syntax-highlighting +++ b/zsh-custom/plugins/zsh-syntax-highlighting @@ -1 +1 @@ -Subproject commit ebef4e55691f62e630318d56468e5798367aa81c +Subproject commit dffe304567c86f06bf1be0fce200077504e79783 diff --git a/zshrc b/zshrc index 39fd880..5365cf4 100755 --- a/zshrc +++ b/zshrc @@ -15,10 +15,7 @@ typeset -U PATH path fpath path=( /bin /sbin /usr/bin /usr/sbin $path ) [[ -d ~/bin ]] && path=( ~/bin $path ) -# sdkman support [[ -f ~/.sdkman/bin/sdkman-init.sh ]] && source ~/.sdkman/bin/sdkman-init.sh - -# nvm [[ -f /usr/share/nvm/init-nvm.sh ]] && source /usr/share/nvm/init-nvm.sh # jaesve support @@ -54,59 +51,24 @@ fi path+=( $GOPATH/bin ${GOROOT+${GOROOT}/bin} ) +# check for starship +if which starship &>/dev/null && [[ ! -e ~/.no-starship ]] +then + export _STARSHIP_Y_="yes" +fi + # Path to your oh-my-zsh installation. export ZSH=$PSOXIZSH/oh-my-zsh export ZSH_CACHE_DIR=~/.cache/zsh [[ ! -d $ZSH_CACHE_DIR ]] && mkdir -p $ZSH_CACHE_DIR -# Set name of the theme to load. Optionally, if you set this to "random" -# it'll load a random theme each time that oh-my-zsh is loaded. -# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes -#ZSH_THEME="rkj-repos" -[[ -z $ZSH_THEME ]] && export ZSH_THEME="stemmet" - -# 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 the following line to disable bi-weekly auto-update checks. +[[ -z "$ZSH_THEME" ]] && [[ -z "$_STARSHIP_Y_" ]] && export ZSH_THEME="stemmet" DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to change how often to auto-update (in days). -export UPDATE_ZSH_DAYS=3 - -# 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. 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. -# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" HIST_STAMPS="yyyy-mm-dd" - -# Would you like to use another custom folder than $ZSH/custom? ZSH_CUSTOM=$(dirname $ZSH)/zsh-custom -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. plugins=( $pre_plugins zsh_reload @@ -114,7 +76,7 @@ plugins=( common-aliases colored-man-pages ) -( which git &>/dev/null ) && plugins+=( git git-extras git-flow-avh ) && [[ "$ZSH_THEME" == "stemmet" ]] && [ -z "$STARSHIP_SHELL" ] && plugins+=( git-prompt ) +( which git &>/dev/null ) && plugins+=( git git-extras git-flow-avh ) && [[ "$ZSH_THEME" == "stemmet" ]] && [ -z "$_STARSHIP_Y_" ] && plugins+=( git-prompt ) ( which perl &>/dev/null ) && plugins+=( perl ) ( which go &>/dev/null ) && plugins+=( golang ) ( which oc &>/dev/null ) && plugins+=( oc ) @@ -182,13 +144,6 @@ end source $PSOXIZSH/zsh-custom/zshnip/zshnip.zsh ( which lxc &>/dev/null ) && source $PSOXIZSH/zsh-custom/lxd-completion-zsh/_lxc -# User configuration - -# export MANPATH="/usr/local/man:$MANPATH" - -# You may need to manually set your language environment -# export LANG=en_US.UTF-8 - ( which vi &>/dev/null ) && export EDITOR='vi' ( which vim &>/dev/null ) && export EDITOR='vim' ( which nvim &>/dev/null ) && export EDITOR='nvim' @@ -218,12 +173,6 @@ if which fzf &>/dev/null; then which tmux &> /dev/null && export FZF_TMUX=1 fi -# 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="vim $PSOXIZSH/zshrc" alias ohmyzsh="vim $PSOXIZSH/oh-my-zsh" alias curlj="curl -H 'Content-Type: application/json' " @@ -273,7 +222,7 @@ precmd() { export _DATE_=$(date -u +%Y%m%d) export _TIME_=$(date -u +%H%M%S) export _DTTS_="${_DATE_}T${_TIME_}Z" - if [[ ! -z $KUBECONFIG ]] + if [[ -n "$KUBECONFIG" && -z "$_STARSHIP_Y_" ]] then export KUBE_VARS=$(basename $KUBECONFIG)/$(kubectl config current-context) else @@ -281,8 +230,13 @@ precmd() { fi } -# Remove unwanted aliases +if [[ -n "$_STARSHIP_Y_" ]] +then + [[ ! -e ~/.config/starship.toml ]] && install -v -D $PSOXIZSH/starship.toml ~/.config/starship.toml + source <(starship init zsh --print-full-init) +fi +# Remove unwanted aliases ( where fd | grep -qE '\/s?bin\/fd' ) && alias fd &>/dev/null && unalias fd # Clean up global aliases