Move plugins to plugin directory

This commit is contained in:
Eric Torres
2019-03-01 16:49:17 -08:00
parent aaea526054
commit 9d46615a56
5 changed files with 18 additions and 36 deletions

22
zsh/plugins/cf.zsh Normal file
View File

@ -0,0 +1,22 @@
# Fuzzy cd from anywhere
# Dependencies
# * fzf
# * mlocate
# ========== Shortcuts ==========
cf() {
[[ -z "${*}" ]] && return 1
[[ ! -x /usr/bin/fzf ]] && return 1
dir="$(locate --all --ignore-case --null -- "${@}" | fzf --read0 --select-1 --exit-0)"
[[ -z "${dir}" ]] && return 1
if [[ -f "${dir}" ]]; then
cd "${dir%/*}"
else
cd "${dir}"
fi
}
autoload -Uz cf

17
zsh/plugins/fedit.zsh Normal file
View File

@ -0,0 +1,17 @@
# Fuzzy find a file and then edit it
_fedit() {
/usr/bin/fedit
zle reset-prompt
}
_etcedit() {
/usr/bin/fedit --etc
zle reset-prompt
}
zle -N _fedit
bindkey -M viins '^o' _fedit
zle -N _etcedit
bindkey -M viins '^e' _etcedit

8
zsh/plugins/fless.zsh Normal file
View File

@ -0,0 +1,8 @@
# Fuzzy-find a file and open it in less
fless() {
/usr/bin/fless
zle reset-prompt
}
zle -N fless
bindkey -M viins '^n' fless

8
zsh/plugins/mkcd.zsh Normal file
View File

@ -0,0 +1,8 @@
# Make a directory, then change into it
mkcd() {
[[ ! -d "${1}" ]] && mkdir --parents -- "${1}"
cd "${1}" || exit
}
autoload -Uz mkcd