zsh: powerlevel + zim
This commit is contained in:
parent
10ff9d19d2
commit
6be14cd936
12 changed files with 464 additions and 112 deletions
29
dot_config/zsh/include/aliases.zsh
Normal file
29
dot_config/zsh/include/aliases.zsh
Normal file
|
@ -0,0 +1,29 @@
|
|||
alias hosts="sudo vim /etc/hosts"
|
||||
|
||||
alias vi=nvim
|
||||
alias vim=nvim
|
||||
|
||||
alias kid3=kid3-qt
|
||||
|
||||
alias grevert="git checkout --"
|
||||
alias gst='git status -s'
|
||||
alias gp='git push'
|
||||
alias gd='git diff'
|
||||
alias gup='git pull --rebase'
|
||||
alias gwch='git log -p --ext-diff'
|
||||
|
||||
alias wine32='WINEARCH=win32 WINEPREFIX=/home/sogun/.wine32 wine'
|
||||
|
||||
alias lg=lazygit
|
||||
|
||||
alias catdb='git --no-pager show HEAD:www/app/config/database.cfg.d/connections.cfg.d/basic.cfg.php'
|
||||
|
||||
alias scur='systemctl --user restart'
|
||||
alias scus='systemctl --user stop'
|
||||
alias scust='systemctl --user status'
|
||||
alias slog='journalctl --user -u'
|
||||
|
||||
alias ls='ls --color=tty --hyperlink=auto'
|
||||
alias l='ls -lh'
|
||||
|
||||
alias rg='rg --no-ignore'
|
15
dot_config/zsh/include/direnv.zsh
Normal file
15
dot_config/zsh/include/direnv.zsh
Normal file
|
@ -0,0 +1,15 @@
|
|||
[[ -n $MC_SID ]] && return
|
||||
|
||||
_direnv_hook() {
|
||||
trap -- '' SIGINT;
|
||||
eval "$("/usr/bin/direnv" export zsh)";
|
||||
trap - SIGINT;
|
||||
}
|
||||
typeset -ag precmd_functions;
|
||||
if [[ -z "${precmd_functions[(r)_direnv_hook]+1}" ]]; then
|
||||
precmd_functions=( _direnv_hook ${precmd_functions[@]} )
|
||||
fi
|
||||
typeset -ag chpwd_functions;
|
||||
if [[ -z "${chpwd_functions[(r)_direnv_hook]+1}" ]]; then
|
||||
chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
|
||||
fi
|
27
dot_config/zsh/include/functions.zsh
Normal file
27
dot_config/zsh/include/functions.zsh
Normal file
|
@ -0,0 +1,27 @@
|
|||
pomerge() {
|
||||
name="$1"
|
||||
lang="${2:-cs_CZ.UTF-8}"
|
||||
git_root="$(git worktree list --porcelain | awk 'NR == 1 {print $2; exit}')"
|
||||
app_po="${git_root}/www/app/translate/gettext/$lang/LC_MESSAGES/$name.po"
|
||||
new_po="${git_root}/www/userdata/locale/${name}_new.po"
|
||||
[[ -d "$(dirname "$app_po")" ]] || mkdir -p "$(dirname "$app_po")"
|
||||
[[ -e "$new_po" ]] || { echo "$new_po does not exist" ; return 1 ;}
|
||||
if ! [[ -e "$app_po" ]]
|
||||
then
|
||||
cp -v "$new_po" "$app_po"
|
||||
return
|
||||
fi
|
||||
tmp="$(mktemp)"
|
||||
msgcat --use-first --no-location --no-wrap "$app_po" "$new_po" > "$tmp"
|
||||
mv "$tmp" "$app_po"
|
||||
}
|
||||
|
||||
pocompile() {
|
||||
name="$1"
|
||||
lang="${2:-cs_CZ.UTF-8}"
|
||||
git_root="$(git worktree list --porcelain | awk 'NR == 1 {print $2; exit}')"
|
||||
app_po="${git_root}/www/app/translate/gettext/$lang/LC_MESSAGES/$name.po"
|
||||
[[ -e "$app_po" ]] || { echo "$app_po does not exists"; return 1; }
|
||||
|
||||
msgfmt -o "${app_po%po}mo" "$app_po"
|
||||
}
|
120
dot_config/zsh/include/fzf.zsh
Normal file
120
dot_config/zsh/include/fzf.zsh
Normal file
|
@ -0,0 +1,120 @@
|
|||
# ____ ____
|
||||
# / __/___ / __/
|
||||
# / /_/_ / / /_
|
||||
# / __/ / /_/ __/
|
||||
# /_/ /___/_/ key-bindings.zsh
|
||||
#
|
||||
# - $FZF_TMUX_OPTS
|
||||
# - $FZF_CTRL_T_COMMAND
|
||||
# - $FZF_CTRL_T_OPTS
|
||||
# - $FZF_CTRL_R_OPTS
|
||||
# - $FZF_ALT_C_COMMAND
|
||||
# - $FZF_ALT_C_OPTS
|
||||
|
||||
# Key bindings
|
||||
# ------------
|
||||
|
||||
# The code at the top and the bottom of this file is the same as in completion.zsh.
|
||||
# Refer to that file for explanation.
|
||||
if 'zmodload' 'zsh/parameter' 2>'/dev/null' && (( ${+options} )); then
|
||||
__fzf_key_bindings_options="options=(${(j: :)${(kv)options[@]}})"
|
||||
else
|
||||
() {
|
||||
__fzf_key_bindings_options="setopt"
|
||||
'local' '__fzf_opt'
|
||||
for __fzf_opt in "${(@)${(@f)$(set -o)}%% *}"; do
|
||||
if [[ -o "$__fzf_opt" ]]; then
|
||||
__fzf_key_bindings_options+=" -o $__fzf_opt"
|
||||
else
|
||||
__fzf_key_bindings_options+=" +o $__fzf_opt"
|
||||
fi
|
||||
done
|
||||
}
|
||||
fi
|
||||
|
||||
'emulate' 'zsh' '-o' 'no_aliases'
|
||||
|
||||
{
|
||||
|
||||
[[ -o interactive ]] || return 0
|
||||
|
||||
# CTRL-T - Paste the selected file path(s) into the command line
|
||||
__fsel() {
|
||||
local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
-o -type f -print \
|
||||
-o -type d -print \
|
||||
-o -type l -print 2> /dev/null | cut -b3-"}"
|
||||
setopt localoptions pipefail no_aliases 2> /dev/null
|
||||
local item
|
||||
eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_CTRL_T_OPTS-}" $(__fzfcmd) -m "$@" | while read item; do
|
||||
echo -n "${(q)item} "
|
||||
done
|
||||
local ret=$?
|
||||
echo
|
||||
return $ret
|
||||
}
|
||||
|
||||
__fzfcmd() {
|
||||
[ -n "${TMUX_PANE-}" ] && { [ "${FZF_TMUX:-0}" != 0 ] || [ -n "${FZF_TMUX_OPTS-}" ]; } &&
|
||||
echo "fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- " || echo "fzf"
|
||||
}
|
||||
|
||||
fzf-file-widget() {
|
||||
LBUFFER="${LBUFFER}$(__fsel)"
|
||||
local ret=$?
|
||||
zle reset-prompt
|
||||
return $ret
|
||||
}
|
||||
zle -N fzf-file-widget
|
||||
bindkey -M emacs '^T' fzf-file-widget
|
||||
bindkey -M vicmd '^T' fzf-file-widget
|
||||
bindkey -M viins '^T' fzf-file-widget
|
||||
|
||||
# ALT-C - cd into the selected directory
|
||||
fzf-cd-widget() {
|
||||
local cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | cut -b3-"}"
|
||||
setopt localoptions pipefail no_aliases 2> /dev/null
|
||||
local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-}" $(__fzfcmd) +m)"
|
||||
if [[ -z "$dir" ]]; then
|
||||
zle redisplay
|
||||
return 0
|
||||
fi
|
||||
zle push-line # Clear buffer. Auto-restored on next prompt.
|
||||
BUFFER="builtin cd -- ${(q)dir}"
|
||||
zle accept-line
|
||||
local ret=$?
|
||||
unset dir # ensure this doesn't end up appearing in prompt expansion
|
||||
zle reset-prompt
|
||||
return $ret
|
||||
}
|
||||
zle -N fzf-cd-widget
|
||||
bindkey -M emacs '\ec' fzf-cd-widget
|
||||
bindkey -M vicmd '\ec' fzf-cd-widget
|
||||
bindkey -M viins '\ec' fzf-cd-widget
|
||||
|
||||
# CTRL-R - Paste the selected command from history into the command line
|
||||
fzf-history-widget() {
|
||||
local selected num
|
||||
setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null
|
||||
selected=( $(fc -rl 1 | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' |
|
||||
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} ${FZF_DEFAULT_OPTS-} -n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore ${FZF_CTRL_R_OPTS-} +m" $(__fzfcmd)) )
|
||||
local ret=$?
|
||||
if [ -n "$selected" ]; then
|
||||
num=$selected[1]
|
||||
if [ -n "$num" ]; then
|
||||
zle vi-fetch-history -n $num
|
||||
fi
|
||||
fi
|
||||
zle reset-prompt
|
||||
return $ret
|
||||
}
|
||||
zle -N fzf-history-widget
|
||||
bindkey -M emacs '^R' fzf-history-widget
|
||||
bindkey -M vicmd '^R' fzf-history-widget
|
||||
bindkey -M viins '^R' fzf-history-widget
|
||||
|
||||
} always {
|
||||
eval $__fzf_key_bindings_options
|
||||
'unset' '__fzf_key_bindings_options'
|
||||
}
|
8
dot_config/zsh/include/keys.zsh
Normal file
8
dot_config/zsh/include/keys.zsh
Normal file
|
@ -0,0 +1,8 @@
|
|||
zmodload zsh/terminfo
|
||||
|
||||
autoload -U down-line-or-beginning-search
|
||||
autoload -U up-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search # down
|
||||
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search #up
|
193
dot_config/zsh/include/p10k.zsh
Normal file
193
dot_config/zsh/include/p10k.zsh
Normal file
|
@ -0,0 +1,193 @@
|
|||
# Generated by Powerlevel10k configuration wizard on 2022-11-22 at 09:53 CET.
|
||||
# Based on romkatv/powerlevel10k/config/p10k-pure.zsh, checksum 35142.
|
||||
# Wizard options: nerdfont-complete + powerline, small icons, pure, original, rprompt,
|
||||
# 1 line, compact, instant_prompt=verbose.
|
||||
# Type `p10k configure` to generate another config.
|
||||
#
|
||||
# Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure).
|
||||
#
|
||||
# Differences from Pure:
|
||||
#
|
||||
# - Git:
|
||||
# - `@c4d3ec2c` instead of something like `v1.4.0~11` when in detached HEAD state.
|
||||
# - No automatic `git fetch` (the same as in Pure with `PURE_GIT_PULL=0`).
|
||||
#
|
||||
# Apart from the differences listed above, the replication of Pure prompt is exact. This includes
|
||||
# even the questionable parts. For example, just like in Pure, there is no indication of Git status
|
||||
# being stale; prompt symbol is the same in command, visual and overwrite vi modes; when prompt
|
||||
# doesn't fit on one line, it wraps around with no attempt to shorten it.
|
||||
#
|
||||
# If you like the general style of Pure but not particularly attached to all its quirks, type
|
||||
# `p10k configure` and pick "Lean" style. This will give you slick minimalist prompt while taking
|
||||
# advantage of Powerlevel10k features that aren't present in Pure.
|
||||
|
||||
# Temporarily change options.
|
||||
'builtin' 'local' '-a' 'p10k_config_opts'
|
||||
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
|
||||
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
|
||||
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
|
||||
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
|
||||
|
||||
() {
|
||||
emulate -L zsh -o extended_glob
|
||||
|
||||
# Unset all configuration options.
|
||||
unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
|
||||
|
||||
# Zsh >= 5.1 is required.
|
||||
[[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return
|
||||
|
||||
# Prompt colors.
|
||||
local grey='242'
|
||||
local red='1'
|
||||
local yellow='3'
|
||||
local blue='4'
|
||||
local magenta='5'
|
||||
local cyan='6'
|
||||
local white='7'
|
||||
|
||||
# Left prompt segments.
|
||||
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
||||
context # user@host
|
||||
dir # current directory
|
||||
vcs # git status
|
||||
# command_execution_time # previous command duration
|
||||
# virtualenv # python virtual environment
|
||||
prompt_char # prompt symbol
|
||||
)
|
||||
|
||||
# Right prompt segments.
|
||||
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
|
||||
command_execution_time # previous command duration
|
||||
virtualenv # python virtual environment
|
||||
# context # user@host
|
||||
# time # current time
|
||||
)
|
||||
|
||||
# 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
|
||||
|
||||
# Add an empty line before each prompt except the first. This doesn't emulate the bug
|
||||
# in Pure that makes prompt drift down whenever you use the Alt-C binding from fzf or similar.
|
||||
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 command vi mode.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮'
|
||||
# Prompt symbol in visual vi mode is the same as in command mode.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='❮'
|
||||
# Prompt symbol in overwrite vi mode is the same as in command mode.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
|
||||
|
||||
# Grey Python Virtual Environment.
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey
|
||||
# Don't show Python version.
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
|
||||
|
||||
# Blue current directory.
|
||||
typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue
|
||||
|
||||
# Context format when root: user@host. The first part white, the rest grey.
|
||||
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f"
|
||||
# Context format when not root: user@host. The whole thing grey.
|
||||
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f"
|
||||
# Don't show context unless root or in SSH.
|
||||
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION=
|
||||
|
||||
# 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
|
||||
# Duration format: 1d 2h 3m 4s.
|
||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
|
||||
# Yellow previous command duration.
|
||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow
|
||||
|
||||
# Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones.
|
||||
typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey
|
||||
|
||||
# Disable async loading indicator to make directories that aren't Git repositories
|
||||
# indistinguishable from large Git repositories without known state.
|
||||
typeset -g POWERLEVEL9K_VCS_LOADING_TEXT=
|
||||
|
||||
# Don't wait for Git status even for a millisecond, so that prompt always updates
|
||||
# asynchronously when Git state changes.
|
||||
typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0
|
||||
|
||||
# Cyan ahead/behind arrows.
|
||||
typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=$cyan
|
||||
# Don't show remote branch, current tag or stashes.
|
||||
typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind)
|
||||
# Don't show the branch icon.
|
||||
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
|
||||
# When in detached HEAD state, show @commit where branch normally goes.
|
||||
typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'
|
||||
# Don't show staged, unstaged, untracked indicators.
|
||||
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED}_ICON=
|
||||
# Show '*' when there are staged, unstaged or untracked files.
|
||||
typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*'
|
||||
# Show '⇣' if local branch is behind remote.
|
||||
typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=':⇣'
|
||||
# Show '⇡' if local branch is ahead of remote.
|
||||
typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=':⇡'
|
||||
# Don't show the number of commits next to the ahead/behind arrows.
|
||||
typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1
|
||||
# Remove space between '⇣' and '⇡' and all trailing spaces.
|
||||
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }'
|
||||
|
||||
# Grey current time.
|
||||
typeset -g POWERLEVEL9K_TIME_FOREGROUND=$grey
|
||||
# Format for the current time: 09:51:02. See `man 3 strftime`.
|
||||
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
|
||||
# If set to true, time will update when you hit enter. This way prompts for the past
|
||||
# commands will contain the start times of their commands rather than the end times of
|
||||
# their preceding commands.
|
||||
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
|
||||
|
||||
# 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=off
|
||||
|
||||
# Instant prompt mode.
|
||||
#
|
||||
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
|
||||
# it incompatible with your zsh configuration files.
|
||||
# - quiet: Enable instant prompt and don't print warnings when detecting console output
|
||||
# during zsh initialization. Choose this if you've read and understood
|
||||
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
|
||||
# - verbose: Enable instant prompt and print a warning when detecting console output during
|
||||
# zsh initialization. Choose this if you've never tried instant prompt, haven't
|
||||
# seen the warning, or if you are unsure what this all means.
|
||||
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
|
||||
|
||||
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
|
||||
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
|
||||
# can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
|
||||
# really need it.
|
||||
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.
|
||||
typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
|
||||
|
||||
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
|
||||
'builtin' 'unset' 'p10k_config_opts'
|
35
dot_config/zsh/init.zsh
Normal file
35
dot_config/zsh/init.zsh
Normal file
|
@ -0,0 +1,35 @@
|
|||
cachedir=${XDG_CACHE_HOME:-$HOME/.cache}/zsh
|
||||
datadir=${XDG_DATA_HOME:-$HOME/.local/share}/zsh
|
||||
confdir=$(dirname $(print -P %N))
|
||||
test -d $cachedir || mkdir -p $cachedir
|
||||
test -d $datadir || mkdir -p $datadir
|
||||
|
||||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ${ZDOTDIR:-${HOME}}/.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 "${cachedir}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||
source "${cachedir}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
|
||||
ZIM_HOME=$datadir/zim
|
||||
test -d $ZIM_HOME || mkdir -p $ZIM_HOME
|
||||
if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
|
||||
wget -O ${ZIM_HOME}/zimfw.zsh \
|
||||
https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
||||
fi
|
||||
|
||||
for cf in ~/.config/zsh/init/*.zsh ; do
|
||||
source $cf
|
||||
done
|
||||
|
||||
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
|
||||
source ${ZIM_HOME}/zimfw.zsh init -v
|
||||
fi
|
||||
|
||||
source ${ZIM_HOME}/init.zsh
|
||||
|
||||
for cf in ~/.config/zsh/include/*.zsh ; do
|
||||
source $cf
|
||||
done
|
||||
|
||||
unset cachedir datadir confdir
|
7
dot_config/zsh/init/env.zsh
Normal file
7
dot_config/zsh/init/env.zsh
Normal file
|
@ -0,0 +1,7 @@
|
|||
export GOPATH=~/.local/share/go
|
||||
export PATH=~/bin:~/.cargo/bin:$GOPATH/bin:$PATH
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
export EDITOR=nvim
|
||||
|
||||
GPG_TTY=$(tty)
|
||||
export GPG_TTY
|
1
dot_config/zsh/init/extra.zsh
Normal file
1
dot_config/zsh/init/extra.zsh
Normal file
|
@ -0,0 +1 @@
|
|||
# source /usr/share/fzf/key-bindings.zsh
|
19
dot_config/zsh/init/options.zsh
Normal file
19
dot_config/zsh/init/options.zsh
Normal file
|
@ -0,0 +1,19 @@
|
|||
zstyle ':zim' disable-version-check yes
|
||||
# set paths
|
||||
zstyle ':zim:completion' dumpfile ${cachedir}/compdump
|
||||
zstyle ':completion::complete:*' cache-path ${cachedir}/compcache
|
||||
HISTFILE=${datadir}/history
|
||||
ZSHZ_DATA=${datadir}/z
|
||||
|
||||
## History command configuration -- stolen from oh-my-zsh
|
||||
setopt extended_history # record timestamp of command in HISTFILE
|
||||
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||
setopt hist_ignore_space # ignore commands that start with space
|
||||
setopt hist_verify # show command with history expansion to user before running it
|
||||
setopt share_history # share command history data
|
||||
HISTSIZE=50000
|
||||
SAVEHIST=10000
|
||||
|
||||
# estabilish basic keybinding
|
||||
bindkey -e
|
8
dot_zimrc
Normal file
8
dot_zimrc
Normal file
|
@ -0,0 +1,8 @@
|
|||
zmodule zsh-users/zsh-syntax-highlighting
|
||||
zmodule input
|
||||
zmodule romkatv/powerlevel10k --use degit
|
||||
zmodule agkozak/zsh-z
|
||||
zmodule $confdir/completion --name custom-completion --fpath .
|
||||
zmodule completion
|
||||
|
||||
# vim:ft=zsh
|
114
dot_zshrc
114
dot_zshrc
|
@ -1,112 +1,2 @@
|
|||
# Path to your oh-my-zsh installation.
|
||||
export ZSH=$HOME/.oh-my-zsh
|
||||
|
||||
# Set name of the theme to load.
|
||||
# Look in ~/.oh-my-zsh/themes/
|
||||
# Optionally, if you set this to "random", it'll load a random theme each
|
||||
# time that oh-my-zsh is loaded.
|
||||
ZSH_THEME="gentoo"
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
# CASE_SENSITIVE="true"
|
||||
|
||||
# Uncomment the following line to disable bi-weekly auto-update checks.
|
||||
DISABLE_AUTO_UPDATE="true"
|
||||
|
||||
# Uncomment the following line to change how often to auto-update (in days).
|
||||
# export UPDATE_ZSH_DAYS=13
|
||||
|
||||
# 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="mm/dd/yyyy"
|
||||
|
||||
# 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? (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=(z sudo fzf)
|
||||
if [[ -z "$MC_SID" ]]
|
||||
then
|
||||
plugins+=direnv
|
||||
plugins+=timer
|
||||
fi
|
||||
|
||||
fpath+=~/.config/zsh/completion
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
if [[ -n "$MC_SID" ]]
|
||||
then
|
||||
zstyle ':vcs_info:*' check-for-changes false
|
||||
fi
|
||||
|
||||
# User configuration
|
||||
|
||||
export GOPATH=~/.local/share/go
|
||||
export PATH=~/bin:~/.cargo/bin:$GOPATH/bin:$PATH
|
||||
#export MANPAGER="bat -p -l manpage"
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
# 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"
|
||||
|
||||
# ssh
|
||||
# export SSH_KEY_PATH="~/.ssh/dsa_id"
|
||||
|
||||
# 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"
|
||||
GPG_TTY=$(tty)
|
||||
export GPG_TTY
|
||||
|
||||
for cf in ~/.config/zsh/*.zsh ; do
|
||||
source $cf
|
||||
done
|
||||
|
||||
#export LESS=-i
|
||||
|
||||
export EDITOR=nvim
|
||||
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
#source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
|
||||
if [[ -z "$MC_SID" ]]
|
||||
then
|
||||
RPS1='%{$fg_bold[red]%}%?%{$reset_color%}'
|
||||
fi
|
||||
_zprintlevel=1
|
||||
source ~/.config/zsh/init.zsh
|
||||
|
|
Loading…
Add table
Reference in a new issue