Zsh: Use more shell builtins, load modules explicitly
This commit is contained in:
parent
6cff8a5713
commit
e004081c5a
@ -40,6 +40,9 @@ export ALTERNATE_EDITOR="$(command -v nano)"
|
||||
|
||||
############################# Plugins ##########################################
|
||||
|
||||
zmodload zsh/stat
|
||||
zmodload zsh/datetime
|
||||
|
||||
if command -v fzf > /dev/null; then
|
||||
# Only load these plugins if fzf was found.
|
||||
local _depends_on_fzf="Aloxaf/fzf-tab"
|
||||
@ -50,9 +53,9 @@ if command -v antibody > /dev/null; then
|
||||
export ZSH_PLUGIN_SOURCE="${plugin_cache_dir}/antibody-plugins.zsh"
|
||||
|
||||
if [[ -f "${ZSH_PLUGIN_SOURCE}" ]] \
|
||||
&& [[ $(stat --format="%s" "${ZSH_PLUGIN_SOURCE}") -ne 0 ]]; then
|
||||
local _plugins_modified=$(stat --format="%Y" "${ZSH_PLUGIN_SOURCE}")
|
||||
local _now=$(date '+%s')
|
||||
&& [[ $(zstat +size "${ZSH_PLUGIN_SOURCE}") -ne 0 ]]; then
|
||||
local _plugins_modified=$(zstat +mtime "${ZSH_PLUGIN_SOURCE}")
|
||||
local _now=$(strftime '%s')
|
||||
# Update plugins every 10 days
|
||||
if [[ $(( ${_now} - ${_plugins_modified} - 60 * 60 * 24 * 10)) -gt 0 ]]; then
|
||||
print "\e[3;95mUpdating plugins…\e[0m"
|
||||
@ -171,7 +174,7 @@ export LS_COLORS
|
||||
unfunction _gen_lscolor
|
||||
|
||||
# Host specific settings.
|
||||
case $(hostname) in
|
||||
case ${HOST} in
|
||||
schnibble | gaffer | localhost)
|
||||
export GIT_SSH_COMMAND="ssha" # Termux command for ssh with key-add.
|
||||
export CPATH="/data/data/com.termux/files/usr/local/include"
|
||||
|
@ -5,11 +5,12 @@ function() # Keep local variables in here.
|
||||
|
||||
############################## Completion ######################################
|
||||
|
||||
zmodload -i zsh/complist
|
||||
zmodload zsh/complist
|
||||
autoload -Uz compinit && compinit -d "${ZSH_CACHE_DIR}/zcompdump"
|
||||
|
||||
setopt ALWAYS_TO_END COMPLETE_IN_WORD GLOB_COMPLETE
|
||||
|
||||
zmodload zsh/zutil
|
||||
# Configure completions.
|
||||
zstyle ':completion:*' use-cache on
|
||||
zstyle ':completion::complete:*' cache-path "${ZSH_CACHE_DIR}/zcompcache"
|
||||
@ -29,12 +30,6 @@ compdef '_dispatch git git' config # git completions for config.
|
||||
|
||||
autoload -Uz +X bashcompinit && bashcompinit
|
||||
|
||||
# Directory options
|
||||
setopt AUTO_CD AUTO_PUSHD PUSHD_IGNORE_DUPS PUSHD_MINUS
|
||||
|
||||
# Various options
|
||||
setopt CORRECT_ALL FLOW_CONTROL INTERACTIVE_COMMENTS LONG_LIST_JOBS
|
||||
|
||||
############################# History ##########################################
|
||||
export HISTSIZE=50000 # In memory.
|
||||
export SAVEHIST=10000 # On disk.
|
||||
@ -97,8 +92,15 @@ zstyle ':fzf-tab:complete:man:*' fzf-preview 'whatis -l $word | cut -d- -f2,3,4,
|
||||
|
||||
################################################################################
|
||||
|
||||
# Directory options
|
||||
setopt AUTO_CD AUTO_PUSHD PUSHD_IGNORE_DUPS PUSHD_MINUS
|
||||
# Various options
|
||||
setopt CORRECT_ALL FLOW_CONTROL INTERACTIVE_COMMENTS LONG_LIST_JOBS
|
||||
|
||||
zmodload zsh/terminfo
|
||||
|
||||
# Test for the title setting capability (To Status Line)
|
||||
if tput tsl > /dev/null; then
|
||||
if echoti tsl > /dev/null; then
|
||||
# Write some info to terminal title.
|
||||
# This is seen when the shell prompts for input.
|
||||
function _my_title_precmd() {
|
||||
|
@ -22,6 +22,7 @@ if [[ "${USERNAME}" != "${DEFAULT_USER}" ]] && [[ -n "${USERNAME}" ]]; then
|
||||
fi
|
||||
|
||||
autoload -Uz vcs_info
|
||||
zmodload zsh/zutil
|
||||
|
||||
zstyle ':vcs_info:*' enable git svn hg # vcs_info_printsys
|
||||
zstyle ':vcs_info:*' formats "%F{${zsh_theme_colours[vcs]}}(%b)%u%c%f "
|
||||
|
@ -89,7 +89,7 @@ case $(lsb_release -i -s 2> /dev/null) in
|
||||
Gentoo)
|
||||
# Directory aliases for some Gentoo paths
|
||||
for dir in /etc/portage/package.*; do
|
||||
hash -d -- -$(basename ${dir})=${dir}
|
||||
hash -d -- -${dir##*/}=${dir}
|
||||
done
|
||||
|
||||
# Directory aliases for all enabled repos
|
||||
|
Loading…
x
Reference in New Issue
Block a user