dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 5e6d4214b9e8567e3188f21c76230146b00b8377
parent 6a0a9de8e553e5c42f90c54e318ff013b552799f
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Wed, 10 Aug 2022 00:08:18 +0200

shell: move lfcd to functions file, not reliant on zsh

Diffstat:
Mshell/functions | 12++++++++++++
Mshell/zshrc | 12+-----------
2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/shell/functions b/shell/functions @@ -158,5 +158,17 @@ if [ -d ~/.config/fzf ]; then && echo "$var=$(printenv "$var")" \ && unset var } +fi +# lf-reliant functions +if command -v lf >/dev/null 2>&1; then + lfcd() { + tmp="$(mktemp)" + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm "$tmp" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi + } fi diff --git a/shell/zshrc b/shell/zshrc @@ -110,17 +110,7 @@ bindkey -M menuselect 'down' vi-down-line-or-history bindkey -M menuselect 'up' vi-up-line-or-history bindkey -M menuselect 'right' vi-forward-char -# Use lf to switch directories and bind it to ctrl-o -lfcd () { - if ! command -v lf &>/dev/null; then echo "lf not installed." && return; fi - tmp="$(mktemp)" - lf -last-dir-path="$tmp" "$@" - if [ -f "$tmp" ]; then - dir="$(cat "$tmp")" - rm -f "$tmp" - [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" - fi -} +# Bind lfcd (lf with cd) to ctrl-o bindkey -s '^o' '^ulfcd\n' _zsh_cli_fg() { fg; }