In that folder, just put a file named as the desired function and as content put the function body and let zsh do it's magic.
# filename: dbg# Activate shell debug mode for next command.set-o xtrace;eval"$@";rc=$?;set +o xtrace
return$rc
The function or however many you put there, will be lazy-loaded on first execution. For that, I just converted most of my aliases into functions and never looked back.
An approach more similar to yours for sourcing the files is to use shell globbing instead of find. With the right shopt settings this one-liner in ~/.zshrc or ~/.bashrc should do the trick.
for file in .zsh/{functions,aliases}/*.zsh;do
source"$(realpath"$file")"done
I strongly recommend you to try zsh + prezto, you just gonna love the tab completion!
Put that in your .zpreztorcas a starting point and play around with ssh and scp.
zstyle ':filter-select:highlight' matched fg=yellow,bold
zstyle ':filter-select' max-lines 18 # restrict lines for filter-select
zstyle ':filter-select' rotate-list yes# enable rotation for filter-select
zstyle ':filter-select'case-insensitiveyes# enable case-insensitive search
zstyle ':filter-select' extended-search yes# see below
zstyle ':filter-select' hist-find-no-dups yes# ignore duplicates in history source
zstyle ':filter-select' escape-descriptions no # display literal newlines, not \n, etc
zstyle ':completion:*' menu select
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion::complete:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zinit/zcompcache"# Set the entries to ignore in static */etc/hosts* for host completion.
zstyle ':prezto:module:completion:*:hosts' etc-host-ignores \'0.0.0.0''127.0.0.1'
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If you like the scripts in this post, then I can only imagine what this is gonna do to you:
Well, I think you get the idea.
For your function loading woes, try zsh and put something like these lines in your
~/.zshrc
file.In that folder, just put a file named as the desired function and as content put the function body and let zsh do it's magic.
The function or however many you put there, will be lazy-loaded on first execution. For that, I just converted most of my aliases into functions and never looked back.
An approach more similar to yours for sourcing the files is to use shell globbing instead of
find
. With the rightshopt settings
this one-liner in~/.zshrc
or~/.bashrc
should do the trick.I strongly recommend you to try zsh + prezto, you just gonna love the tab completion!
Put that in your
.zpreztorc
as a starting point and play around withssh
andscp
.