diff --git a/etc/lf.csh b/etc/lf.csh new file mode 100644 index 00000000..54657e38 --- /dev/null +++ b/etc/lf.csh @@ -0,0 +1,12 @@ +# +# For using these completions you must load it from .tcshrc +# +# source ~/.config/lf/lf.csh +# +set lf_args = "-command -cpuprofile -doc --help -last-dir-path -memprofile -remote -selection-path -server -version --version" + +uncomplete lf +uncomplete lfcd + +complete lf "C/-*/(${lf_args})/" +complete lfcd "C/-*/(${lf_args})/" diff --git a/etc/lfcd.csh b/etc/lfcd.csh new file mode 100644 index 00000000..3fa1d6b5 --- /dev/null +++ b/etc/lfcd.csh @@ -0,0 +1,13 @@ +# Change working dir in shell to last dir in lf on exit. +# +# You need to either copy the content of this file to your shell rc file +# (e.g. ~/.tcshrc) or source this file directly: +# +# setenv LF_HOME "${HOME}/.config/lf" +# [ -e "${LF_HOME}/lfcd.csh" ] && source "${LF_HOME}/lfcd.csh" +# +# You may also like to assign a key to this command: +# +# bindkey -c "^O" lfcd +# +alias lfcd 'set _=`mktemp` && lf -last-dir-path=$_ "\!*" && set _=`cat $_ && rm -f $_` && [ -d "$_" ] && cd "$_"'