~yerinalexey/dotfiles

59d4e7e810d26573f21290ee928dec22406587d4 — Alexey Yerin 8 months ago a5d9b72
zsh: use tabs
4 files changed, 120 insertions(+), 120 deletions(-)

M zsh/functions.zsh
M zsh/p10k.zsh
M zsh/plugins.zsh
M zsh/profile.zsh
M zsh/functions.zsh => zsh/functions.zsh +5 -5
@@ 2,12 2,12 @@

# lf + cd
function lc() {
  tempfile="$(mktemp '/tmp/lfpath-XXXX')"
	tempfile="$(mktemp '/tmp/lfpath-XXXX')"

  lf -last-dir-path "$tempfile"
	lf -last-dir-path "$tempfile"

  dest="$(cat "$tempfile")"
  [ -n "$dest" -a -d "$dest" -a "$dest" != "$(pwd)" ] && cd "$dest"
	dest="$(cat "$tempfile")"
	[ -n "$dest" -a -d "$dest" -a "$dest" != "$(pwd)" ] && cd "$dest"

  rm "$tempfile"
	rm "$tempfile"
}

M zsh/p10k.zsh => zsh/p10k.zsh +105 -105
@@ 8,114 8,114 @@
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'

() {
  emulate -L zsh

  # Unset all configuration options.
  unset -m 'POWERLEVEL9K_*|DEFAULT_USER'

  # Zsh >= 5.1 is required.
  autoload -Uz is-at-least && is-at-least 5.1 || return

  # Prompt colors
  local grey='242'
  local red='#FF5C57'
  local yellow='#F3F99D'
  local blue='#57C7FF'
  local green='#6CBD68'
  local magenta='#FF6AC1'
  local cyan='#9AEDFE'
  local white='#F1F1F0'

  # Left prompt segments
  typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
    # =========================[ Line #1 ]=========================
    dir                       # current directory
    vcs                       # git status
    command_execution_time    # previous command duration
    prompt_char               # prompt symbol
  )

  # Disable right prompt
  typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()

  # Basic style options that define the overall prompt look.
  typeset -g POWERLEVEL9K_BACKGROUND=                            # transparent background
  typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE=  # no surrounding whitespace
  typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' '  # separate segments with a space
  typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR=        # no end-of-line symbol
  typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=           # no segment icons

  # Do not add an empty line before prompt
  typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false

  # Magenta prompt symbol if the last command succeeded.
  typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta
  # Red prompt symbol if the last command failed.
  typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
  # Default prompt symbol.
  typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='>'
  # Prompt symbol in Vi mode.
  typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION=':'
  typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION=':'
  typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true

  # --- Current directory module ---
  typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue
	emulate -L zsh

	# Unset all configuration options.
	unset -m 'POWERLEVEL9K_*|DEFAULT_USER'

	# Zsh >= 5.1 is required.
	autoload -Uz is-at-least && is-at-least 5.1 || return

	# Prompt colors
	local grey='242'
	local red='#FF5C57'
	local yellow='#F3F99D'
	local blue='#57C7FF'
	local green='#6CBD68'
	local magenta='#FF6AC1'
	local cyan='#9AEDFE'
	local white='#F1F1F0'

	# Left prompt segments
	typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
		# =========================[ Line #1 ]=========================
		dir                       # current directory
		vcs                       # git status
		command_execution_time    # previous command duration
		prompt_char               # prompt symbol
	)

	# Disable right prompt
	typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()

	# Basic style options that define the overall prompt look.
	typeset -g POWERLEVEL9K_BACKGROUND=                           # transparent background
	typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
	typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
	typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR=       # no end-of-line symbol
	typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=          # no segment icons

	# Do not add an empty line before prompt
	typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false

	# Magenta prompt symbol if the last command succeeded.
	typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta
	# Red prompt symbol if the last command failed.
	typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
	# Default prompt symbol.
	typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='>'
	# Prompt symbol in Vi mode.
	typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION=':'
	typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION=':'
	typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true

	# --- Current directory module ---
	typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue

	# Shorten directory
  typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=240
	typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=240
	typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
  typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1

  # --- Time module ---
  typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow

  # Show previous command duration only if it's >= 5s
  typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
  # Don't show fractional seconds. Thus, 7s rather than 7.3s
  typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
  # Format: took 1d 2h 3m 4s
  typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
  typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='took '

  # --- VCS module ---
  typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey

  # Disable async loading indicator
  typeset -g POWERLEVEL9K_VCS_LOADING_TEXT=

  # Don't wait for Git status
  typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0

  # Show changes, tag, untracked files and how many commits local branch is ahead/behind a remote
  typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-tagname git-untracked git-aheadbehind)

  # Icons
  typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=''     # Current branch
  typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'    # Detached HEAD
  typeset -g POWERLEVEL9K_VCS_STAGED_ICON='+'    # Changed files count
  typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' # Untracked files count
  typeset -g POWERLEVEL9K_VCS_UNSTAGED_ICON='*'  # Unstaged files count

  # --- Misc ---
  # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
  # when accepting a command line. Supported values:
  #
  #   - off:      Don't change prompt when accepting a command line.
  #   - always:   Trim down prompt when accepting a command line.
  #   - same-dir: Trim down prompt when accepting a command line unless this is the first command
  #               typed after changing current working directory.
  typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always

  # Enable instant prompt
  typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet

  # Disable hot reload
  typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true

  # If p10k is already loaded, reload configuration.
  # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
  (( ! $+functions[p10k] )) || p10k reload
	typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1

	# --- Time module ---
	typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow

	# Show previous command duration only if it's >= 5s
	typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
	# Don't show fractional seconds. Thus, 7s rather than 7.3s
	typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
	# Format: took 1d 2h 3m 4s
	typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
	typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='took '

	# --- VCS module ---
	typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey

	# Disable async loading indicator
	typeset -g POWERLEVEL9K_VCS_LOADING_TEXT=

	# Don't wait for Git status
	typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0

	# Show changes, tag, untracked files and how many commits local branch is ahead/behind a remote
	typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-tagname git-untracked git-aheadbehind)

	# Icons
	typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=''     # Current branch
	typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'    # Detached HEAD
	typeset -g POWERLEVEL9K_VCS_STAGED_ICON='+'    # Changed files count
	typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' # Untracked files count
	typeset -g POWERLEVEL9K_VCS_UNSTAGED_ICON='*'  # Unstaged files count

	# --- Misc ---
	# Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
	# when accepting a command line. Supported values:
	#
	#   - off:      Don't change prompt when accepting a command line.
	#   - always:   Trim down prompt when accepting a command line.
	#   - same-dir: Trim down prompt when accepting a command line unless this is the first command
	#               typed after changing current working directory.
	typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always

	# Enable instant prompt
	typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet

	# Disable hot reload
	typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true

	# If p10k is already loaded, reload configuration.
	# This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
	(( ! $+functions[p10k] )) || p10k reload
}

# Tell `p10k configure` which file it should overwrite.

M zsh/plugins.zsh => zsh/plugins.zsh +3 -3
@@ 4,9 4,9 @@ export MINIPLUG_HOME="$XDG_DATA_HOME/zsh/miniplug"

# Download Miniplug
[ ! -f "$MINIPLUG_HOME/miniplug.zsh" ] && \
  curl -sL --create-dirs \
    https://git.sr.ht/~yerinalexey/miniplug/blob/refs/heads/master/miniplug.zsh \
    -o "$MINIPLUG_HOME/miniplug.zsh"
	curl -sL --create-dirs \
		https://git.sr.ht/~yerinalexey/miniplug/blob/refs/heads/master/miniplug.zsh \
		-o "$MINIPLUG_HOME/miniplug.zsh"

# Load it
source "$MINIPLUG_HOME/miniplug.zsh"

M zsh/profile.zsh => zsh/profile.zsh +7 -7
@@ 20,13 20,13 @@ foreground='#eeeeee'
primary='#265abc'

export BEMENU_OPTS="--fn 'monospace 13' -n \
  --nb=${background} \
  --fb=${background} \
  --ff=${foreground} \
  --tb=${primary} \
  --tf=${foreground} \
  --hb=#313131 \
  --hf=#638cda"
	--nb=${background} \
	--fb=${background} \
	--ff=${foreground} \
	--tb=${primary} \
	--tf=${foreground} \
	--hb=#313131 \
	--hf=#638cda"

# Clean up the home directory
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"