lytefast configs

This commit is contained in:
Sam S 2022-08-18 12:44:58 -07:00
parent 51c4ff6de4
commit 1fb18abc1b
6 changed files with 211 additions and 6 deletions

View file

@ -20,7 +20,7 @@ version is **4.3.11**.
02. Clone the repository:
```console
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
git clone --recursive https://github.com/lytefast/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
```
<details>

View file

@ -0,0 +1,154 @@
#
# A two-line, Powerline-inspired theme that displays contextual information.
#
# This theme requires a patched Powerline font, get them from
# https://github.com/Lokaltog/powerline-fonts.
#
# Authors:
# Isaac Wolkerstorfer <i@agnoster.net>
# Jeff Sandberg <paradox460@gmail.com>
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Screenshots:
# http://i.imgur.com/0XIWX.png
#
# Load dependencies.
pmodload 'helper'
# Define variables.
_prompt_paradox_current_bg='NONE'
_prompt_paradox_segment_separator=''
_prompt_paradox_start_time=$SECONDS
function prompt_paradox_start_segment {
local bg fg
[[ -n "$1" ]] && bg="%K{$1}" || bg="%k"
[[ -n "$2" ]] && fg="%F{$2}" || fg="%f"
if [[ "$_prompt_paradox_current_bg" != 'NONE' && "$1" != "$_prompt_paradox_current_bg" ]]; then
print -n " $bg%F{$_prompt_paradox_current_bg}$_prompt_paradox_segment_separator$fg "
else
print -n "$bg$fg "
fi
_prompt_paradox_current_bg="$1"
[[ -n "$3" ]] && print -n "$3"
}
function prompt_paradox_end_segment {
if [[ -n "$_prompt_paradox_current_bg" ]]; then
print -n " %k%F{$_prompt_paradox_current_bg}$_prompt_paradox_segment_separator"
else
print -n "%k"
fi
print -n "%f"
_prompt_paradox_current_bg=''
}
function prompt_paradox_build_prompt {
prompt_paradox_start_segment black default '%(?::%F{red}✘ )%(!:%F{yellow}⚡ :)%(1j:%F{cyan}⚙ :)%F{blue}%n%F{magenta}@%F{green}%m%f'
prompt_paradox_start_segment blue grey '$_prompt_paradox_pwd'
if [[ -n "$git_info" ]]; then
prompt_paradox_start_segment yellow black '${(e)git_info[ref]}${(e)git_info[status]}'
fi
prompt_paradox_end_segment
}
function prompt_paradox_pwd {
local pwd="${PWD/#$HOME/~}"
if [[ "$pwd" == (#m)[/~] ]]; then
_prompt_paradox_pwd="$MATCH"
unset MATCH
else
_prompt_paradox_pwd="${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}"
fi
}
function prompt_paradox_print_elapsed_time {
local end_time=$(( SECONDS - _prompt_paradox_start_time ))
local hours minutes seconds remainder
if (( end_time >= 3600 )); then
hours=$(( end_time / 3600 ))
remainder=$(( end_time % 3600 ))
minutes=$(( remainder / 60 ))
seconds=$(( remainder % 60 ))
print -P "%B%F{red}>>> elapsed time ${hours}h${minutes}m${seconds}s%b"
elif (( end_time >= 60 )); then
minutes=$(( end_time / 60 ))
seconds=$(( end_time % 60 ))
print -P "%B%F{yellow}>>> elapsed time ${minutes}m${seconds}s%b"
elif (( end_time > 10 )); then
print -P "%B%F{green}>>> elapsed time ${end_time}s%b"
fi
}
function prompt_paradox_precmd {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
# Format PWD.
prompt_paradox_pwd
# Get Git repository information.
if (( $+functions[git-info] )); then
git-info
fi
# Calculate and print the elapsed time.
prompt_paradox_print_elapsed_time
}
function prompt_paradox_preexec {
_prompt_paradox_start_time="$SECONDS"
}
function prompt_paradox_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
# Load required functions.
autoload -Uz add-zsh-hook
# Add hook for calling git-info before each command.
add-zsh-hook preexec prompt_paradox_preexec
add-zsh-hook precmd prompt_paradox_precmd
# Set editor-info parameters.
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
zstyle ':prezto:module:editor:info:keymap:primary' format '%B%F{blue}%f%b'
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format '%F{red}♺%f'
zstyle ':prezto:module:editor:info:keymap:alternate' format '%B%F{red}%f%b'
# Set git-info parameters.
zstyle ':prezto:module:git:info' verbose 'yes'
zstyle ':prezto:module:git:info:action' format ' ⁝ %s'
zstyle ':prezto:module:git:info:added' format ' ✚'
zstyle ':prezto:module:git:info:ahead' format ' ⬆'
zstyle ':prezto:module:git:info:behind' format ' ⬇'
zstyle ':prezto:module:git:info:branch' format ' %b'
zstyle ':prezto:module:git:info:commit' format '➦ %.7c'
zstyle ':prezto:module:git:info:deleted' format ' ✖'
zstyle ':prezto:module:git:info:dirty' format ' ⁝'
zstyle ':prezto:module:git:info:modified' format ' ✱'
zstyle ':prezto:module:git:info:position' format '%p'
zstyle ':prezto:module:git:info:renamed' format ' ➙'
zstyle ':prezto:module:git:info:stashed' format ' S'
zstyle ':prezto:module:git:info:unmerged' format ' ═'
zstyle ':prezto:module:git:info:untracked' format ' ?'
zstyle ':prezto:module:git:info:keys' format \
'ref' '$(coalesce "%b" "%p" "%c")' \
'status' '%s%D%A%B%S%a%d%m%r%U%u'
# Define prompts.
PROMPT='
${(e)$(prompt_paradox_build_prompt)}
${editor_info[keymap]} '
RPROMPT='%F{blue}[%F{green}%D{%H:%M:%S}%F{blue}]%f'
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
}
prompt_paradox_setup "$@"

View file

@ -8,6 +8,8 @@
#
# General
#
source ~/.samrc
# source ~/.discordrc
# Set case-sensitivity for completion, history lookup, etc.
# zstyle ':prezto:*:*' case-sensitive 'yes'
@ -31,13 +33,16 @@ zstyle ':prezto:*:*' color 'yes'
# The order matters.
zstyle ':prezto:load' pmodule \
'environment' \
'directory' \
'terminal' \
'editor' \
'git' \
'history' \
'directory' \
'spectrum' \
'utility' \
'completion' \
'syntax-highlighting' \
'history-substring-search' \
'prompt'
@ -61,10 +66,10 @@ zstyle ':prezto:load' pmodule \
#
# Set the key mapping style to 'emacs' or 'vi'.
zstyle ':prezto:module:editor' key-bindings 'emacs'
# zstyle ':prezto:module:editor' key-bindings 'vi'
# Auto convert .... to ../..
# zstyle ':prezto:module:editor' dot-expansion 'yes'
zstyle ':prezto:module:editor' dot-expansion 'yes'
# Allow the zsh prompt context to be shown.
#zstyle ':prezto:module:editor' ps-context 'yes'
@ -130,7 +135,8 @@ zstyle ':prezto:module:editor' key-bindings 'emacs'
# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
zstyle ':prezto:module:prompt' theme 'sorin'
#zstyle ':prezto:module:prompt' theme 'sorin'
zstyle :prezto:module:prompt theme powerlevel10k
# Set the working directory prompt display length.
# By default, it is set to 'short'. Set it to 'long' (without '~' expansion)

View file

@ -18,10 +18,10 @@ fi
#
if [[ -z "$EDITOR" ]]; then
export EDITOR='nano'
export EDITOR='vim'
fi
if [[ -z "$VISUAL" ]]; then
export VISUAL='nano'
export VISUAL='vim'
fi
if [[ -z "$PAGER" ]]; then
export PAGER='less'
@ -50,6 +50,7 @@ typeset -gU cdpath fpath mailpath path
# Set the list of directories that Zsh searches for programs.
path=(
$HOME/{,s}bin(N)
$HOME/.local/{,s}bin(N)
/opt/{homebrew,local}/{,s}bin(N)
/usr/local/{,s}bin(N)
$path
@ -71,3 +72,18 @@ fi
if [[ -z "$LESSOPEN" ]] && (( $#commands[(i)lesspipe(|.sh)] )); then
export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-"
fi
#
# Temporary Files
#
# if [[ ! -d "$TMPDIR" ]]; then
# export TMPDIR="/tmp/$LOGNAME"
# mkdir -p -m 700 "$TMPDIR"
# fi
# TMPPREFIX="${TMPDIR%/}/zsh"
# Ubuntu make installation of Go Lang
# PATH=/home/sam/.local/share/umake/go/go-lang/bin:$PATH
# export GOROOT=/home/sam/.local/share/umake/go/go-lang

View file

@ -9,3 +9,5 @@
if [[ ( "$SHLVL" -eq 1 && ! -o LOGIN ) && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
source "${ZDOTDIR:-$HOME}/.zprofile"
fi
source ~/.samrc

View file

@ -1,3 +1,10 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
#
# Executes commands at the start of an interactive session.
#
@ -11,3 +18,23 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
fi
# Customize to your needs...
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Plugins
zstyle ':prezto:load' pmodule \
'environment' \
'terminal' \
'editor' \
'history' \
'directory' \
'spectrum' \
'utility' \
'ssh' \
'git' \
'completion' \
'syntax-highlighting' \
'history-substring-search' \
'prompt'