mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
plugins: Add fasd plugin
Fasd offers quick access to files and directories. It is inspired by tools like autojump, z and v. Fasd keeps track of files and directories you have accessed, so that you can quickly reference them in the command line This plugin sets up fasd to use safe_command_prompt handling of oh-my-bash to avoid conflicts with fasd's normal bash prompt handling. More information about fasd can be found here: https://github.com/clvv/fasd.
This commit is contained in:
committed by
Koichi Murase
parent
a3b8e5fdbf
commit
0b1a6153f9
23
plugins/fasd/fasd.plugin.sh
Normal file
23
plugins/fasd/fasd.plugin.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Initialize fasd, without setting up the prompt hook, which
|
||||
# we want to be handled by oh-my-bash.
|
||||
|
||||
_fasd_prompt_func() {
|
||||
[ -z "$_FASD_SINK" ] && _FASD_SINK=/dev/null
|
||||
eval "fasd --proc \$(fasd --sanitize \$(history 1 | \\
|
||||
sed "s/^[ ]*[0-9]*[ ]*//"))" >> "$_FASD_SINK" 2>&1
|
||||
}
|
||||
|
||||
function _install_fasd() {
|
||||
type fasd >/dev/null 2>&1
|
||||
if [ "$?" == "0" ]; then
|
||||
eval "$(fasd --init posix-alias bash-ccomp bash-ccomp-install)"
|
||||
_omb_util_add_prompt_command _fasd_prompt_func
|
||||
else
|
||||
echo "fasd not found, plugin not activated."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
_install_fasd
|
Reference in New Issue
Block a user